History

Restore file version

Roll one or more files back to an earlier version. The target field is `toVersion`. Nothing is overwritten: each restore writes a NEW version pointing at the old content, and the whole batch lands as a single restore commit. Files whose target version doesn't exist (or whose blob is missing) come back in `skipped` rather than failing the call. Max 25,000 files per request.

POST/api/v1/projects/{projectId}/restore

Request

Body
json
{
  "files": [
    { "fileId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "toVersion": 8 }
  ]
}

Response

200 OK
json
{
  "commitId": "d4c3b2a1-6f5e-4d3c-8b2a-1f0e9d8c7b6a",
  "sequenceNum": 26,
  "restored": [
    { "fileId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "newVersion": 13 }
  ],
  "skipped": []
}

Examples

curlbash
curl -X POST https://usourcecontrol.com/api/v1/projects/7c9e6679-7425-40de-944b-e07fc1f90ae7/restore \
  -H "Authorization: Bearer usc_your_project_key" \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      { "fileId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "toVersion": 8 }
    ]
  }'

Try it

Try itChanges data
POST/api/v1/projects/{projectId}/restore

Kept in this tab only, sent straight to the API, and never to our servers. Create one in your project’s settings.

This is a POST request against the live API. It will really run, on the real project the key belongs to.

Was this helpful?

Back to top