Skip to main content
POST
/
api
/
v1
/
repos
/
restore-commit
Restore Commit
curl --request POST \
  --url https://api.{cluster}.code.storage/api/v1/repos/restore-commit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/x-ndjson' \
  --data '
"{\"metadata\":{\"target_branch\":\"main\",\"target_commit_sha\":\"abc123def4567890abc123def4567890abc123de\",\"expected_head_sha\":\"0123456789abcdef0123456789abcdef01234567\",\"commit_message\":\"Reset branch\",\"author\":{\"name\":\"Docs Bot\",\"email\":\"docs@example.com\"}}}\n"
'
{
  "commit": {
    "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.

Body

application/x-ndjson

Send a single NDJSON metadata line describing the branch to restore and the commit SHA to restore it to.

NDJSON stream containing one metadata object.

Response

Restore commit created successfully.

Result of a restore commit operation, including the created commit and the branch update.

commit
object
required

Created restore commit metadata.

result
object
required

Branch update result.