List all file versions

get
https://api.box.com/2.0
/files/:file_id/versions

Retrieve a list of the past versions for a file.

Versions are only tracked by Box users with premium accounts. To fetch the ID of the current version of a file, use the GET /file/:id API.

Request

application/json

Path Parameters

stringin pathrequired
12345

The unique identifier that represent 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

string arrayin queryoptional
id,type,name

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.

integer / int64in queryoptional
10001000

The maximum number of items to return per page.

integer / int64in queryoptional
10000

The offset of the item at which to begin the response.

Response

application/jsonFile versions

Returns an array of past versions for this file.

application/jsonClient error

An unexpected client error.

get
List all file versions
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -X GET https://api.box.com/2.0/files/12345/versions \
     -H 'Authorization: Bearer <ACCESS_TOKEN>'
.NET
BoxCollection<BoxFileVersion> previousVersions = await client.FilesManager
    .ViewVersionsAsync(id: "11111");
Java
BoxFile file = new BoxFile(api, "id");
List<BoxFileVersion> versions = file.getVersions();
for (BoxFileVersion version : versions) {
    System.out.format("SHA1 of \"%s\": %s\n", item.getName(), version.getSha1());
}
Python
file_id = '11111'

file_versions = client.file(file_id).get_previous_versions()
for version in file_versions:
    print('File version {0} was created at {1}'.format(version.id, version.created_at))
Node
client.files.getVersions('12345')
	.then(versions => {
		/* versions -> {
			total_count: 1,
			entries: 
			[ { type: 'file_version',
				id: '22222',
				sha1: '359c6c1ed98081b9a69eb3513b9deced59c957f9',
				name: 'script.js',
				size: 92556,
				created_at: '2012-08-20T10:20:30-07:00',
				modified_at: '2012-11-28T13:14:58-08:00',
				modified_by: 
					{ type: 'user',
					id: '33333',
					name: 'Example User',
					login: 'user@example.com' } } ] }
		*/
	});