Skip to main content
POST
/
api
/
repos
/
{repo_name}
/
commit-pack
Create Commit from Files
curl --request POST \
  --url https://api.{cluster}.code.storage/api/repos/{repo_name}/commit-pack \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/x-ndjson' \
  --data '
"{\"metadata\":{\"target_branch\":\"main\",\"expected_head_sha\":\"d34db33fd34db33fd34db33fd34db33fd34db33f\",\"commit_message\":\"Update docs\",\"author\":{\"name\":\"Docs Bot\",\"email\":\"docs@example.com\"},\"files\":[{\"path\":\"docs/changelog.md\",\"operation\":\"upsert\",\"content_id\":\"blob-1\",\"mode\":\"100644\"},{\"path\":\"docs/legacy.txt\",\"operation\":\"delete\",\"content_id\":\"blob-2\"}]}}\n{\"blob_chunk\":{\"content_id\":\"blob-1\",\"data\":\"IyBWZXJzaW9uIDIuMS4wCi0gcmVmcmVzaCBkb2NzCg==\",\"eof\":true}}\n{\"blob_chunk\":{\"content_id\":\"blob-2\",\"data\":\"\",\"eof\":true}}\n"
'
{
  "commit": {
    "blob_count": 1,
    "commit_sha": "<string>",
    "pack_bytes": 1,
    "target_branch": "<string>",
    "tree_sha": "<string>"
  },
  "result": {
    "branch": "<string>",
    "new_sha": "<string>",
    "old_sha": "<string>",
    "status": "<string>",
    "success": true,
    "message": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://code.storage/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

repo_name
string
required

Repository name. Names that contain / or any other character that is not safe in a URL path segment must be URL encoded so the value occupies a single path segment. For example pierre/example is sent as pierre%2Fexample. Plain names such as example can be sent as-is. The server URL-decodes the value before resolving the repository.

Body

application/x-ndjson

Send newline-delimited JSON where the first line is a metadata object and each following line is a blob_chunk. This lets you stream file contents without a local Git client.

NDJSON stream. The first line must be metadata; subsequent lines must be blob_chunk payloads. Decoded blob chunks are limited to 4 MiB each.

Response

Commit created and written to the target branch.

Result of applying an NDJSON commit pack, including the resulting commit and branch update.

commit
object
required

Commit object information generated by the storage service.

result
object
required

Final branch update outcome.