Request Format
The body is newline-delimited JSON. Send metadata first, followed by one or more blob chunks.Request Body Fields
| Parameter | Type | Description |
|---|---|---|
target_branch | Required | Branch name (for example main) |
commit_message | Required | The commit message |
author | Required | Object with name, email, and optional ISO 8601 date |
files | Required | Array of file operations (see below) |
expected_head_sha | Optional | Commit SHA that must match the branch tip before writing; omit to fast-forward unconditionally |
base_branch | Optional | Source branch to copy when target_branch does not exist. If you also provide expected_head_sha, it must match the source branch head; otherwise the branch is created from the latest base branch commit |
committer | Optional | Object with name, email, and optional ISO 8601 date |
File Operations
path(required): Repository-relative path; leading slashes are strippedoperation:upsert(default) to add or replace content,deleteto remove a filecontent_id(required): Identifier that blob chunks referencemode(optional): File mode such as100644or100755- For
deleteoperations, omit blob chunks—only the metadata entry is required
Blob Chunks
- Each line after the metadata must contain a
blob_chunkobject content_idties the chunk to a file operationdatais base64 encoded; decoded chunks must be 4 MiB or smaller- Use multiple
blob_chunkmessages per file for streaming; mark the last chunk with"eof": true - Empty files should send an EOF chunk with an empty base64 string
JWT Requirements
- The JWT must include the repository in the
repoclaim - Requires
git:writescope
Response
Notes
- Successful requests return
201 Created; validation errors return4xxcodes with error details - Use the SDK’s
repo.createCommit()helper for streaming, chunking, and authentication automatically - The
target_branchmust already exist unless you includebase_branch, in which case the service creates the target branch from that source branch when it is missing - If you passed an
expected_head_sha, the service verifies it matches the source branch head before creating the new branch - Repositories with no refs can still omit
expected_head_shato seed their default branch - Pair
expected_head_shawith a commit SHA to enforce fast-forward semantics during migrations or CI jobs result.old_shais always a 40-character hex string reflecting the previous tip; it is0000000000000000000000000000000000000000when the target branch did not previously exist
Error Responses
| Status | Description |
|---|---|
401 Unauthorized | Invalid JWT or missing git:write scope |
400 Bad Request | Invalid request format, missing required fields, or blob chunk validation errors |
409 Conflict | Expected head SHA doesn’t match current branch tip |
404 Not Found | Base branch doesn’t exist (when creating new target branch) |