Manage Applications

    List all file versions

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

    Retrieve information on all version of a file. This endpoint can be used to retrieve information about older versions of a file.

    Versions are only tracked for Box users with premium accounts.

    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-1000

    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 file versions.

    If there are no previous versions of this file an empty array will be returned.

    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' } } ] }
    		*/
    	});

    Response Example

    {
      "total_count": 5000,
      "limit": 1000,
      "offset": 2000,
      "order": [
        {
          "by": "type",
          "direction": "ASC"
        }
      ],
      "entries": [
        {
          "id": 11446498,
          "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",
          "purged_at": "2012-12-12T10:53:43-08:00"
        }
      ]
    }