v1

latestOpenAPI 3.0.2Apache-2.02026-07-142963051.0 MB
File versions

Promote file version

Promote a specific version of a file.

If previous versions exist, this method can be used to promote one of the older versions to the top of the version history.

This creates a new copy of the old version and puts it at the top of the versions history. The file will have the exact same contents as the older version, with the same hash digest, etag, and name as the original.

Other properties such as comments do not get updated to their former values.

Don't use this endpoint to restore Box Notes, as it works with file formats such as PDF, DOC, PPTX or similar.

post/files/{file_id}/versions/current

Path parameters

file_idstring required

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.

Query parameters

fieldsstring[]

A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.

Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.

Request body

idstring

The file version ID.

type'file_version'

The type to promote.

Example request

{
  "id": "11446498",
  "type": "file_version"
}

Response

Returns a newly created file version object.

idstring required

The unique identifier that represent a file version.

type'file_version' required

The value will always be file_version.

sha1string

The SHA1 hash of this version of the file.

namestring

The name of the file version.

sizeinteger

Size of the file version in bytes.

created_atstring date-time

When the file version object was created.

modified_atstring date-time

When the file version object was last updated.

trashed_atstring date-time nullable

When the file version object was trashed.

restored_atstring date-time nullable

When the file version was restored from the trash.

purged_atstring date-time nullable

When the file version object will be permanently deleted.

uploader_display_namestring

The display name of the user that uploaded the file. In most cases this is the name of the user logged in at the time of the upload.

If the file was uploaded using a File Request form that requires the user to provide an email address, this field is populated with that email address. If an email address was not required in the File Request form, this field is set to return a value of File Request.

In all other anonymous cases where no email was provided this field will default to a value of Someone.

version_numberstring

The version number of this file version.

Example response

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