Latest version

Restore file version

put
https://api.box.com/2.0
/files/:file_id/versions/:file_version_id

Restores a specific version of a file after it was deleted. Don't use this endpoint to restore Box Notes, as it works with file formats such as PDF, DOC, PPTX or similar.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
12345

The unique identifier that represents a file.

The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123.

stringin pathrequired
1234

The ID of the file version

Request Body

stringin bodyoptional

Set this to null to clear the date and restore the file.

Response

application/jsonFile version (Full)

Returns a restored file version object.

application/jsonClient error

An unexpected client error.

put
Restore file version
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X POST "https://api.box.com/2.0/files/12345/versions/456456" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "trashed_at": null
     }'
TypeScript Gen
await client.fileVersions.updateFileVersionById(file.id, fileVersion.id, {
  requestBody: {
    trashedAt: createNull(),
  } satisfies UpdateFileVersionByIdRequestBody,
} satisfies UpdateFileVersionByIdOptionalsInput);
Python Gen
client.file_versions.update_file_version_by_id(
    file.id, file_version.id, trashed_at=create_null()
)
.NET Gen
await client.FileVersions.UpdateFileVersionByIdAsync(fileId: file.Id, fileVersionId: fileVersion.Id, requestBody: new UpdateFileVersionByIdRequestBody() { TrashedAt = null });

Response Example

{
  "id": "12345",
  "type": "file_version",
  "created_at": "2012-12-12T10:53:43-08:00",
  "modified_at": "2012-12-12T10:53:43-08:00",
  "modified_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "name": "tigers.jpeg",
  "purged_at": "2012-12-12T10:53:43-08:00",
  "restored_at": "2012-12-12T10:53:43-08:00",
  "restored_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
  "size": 629644,
  "trashed_at": "2012-12-12T10:53:43-08:00",
  "trashed_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "uploader_display_name": "Ellis Wiggins",
  "version_number": "1"
}