Add the power of the Box AI API to your custom apps at Content Cloud Summit on May 15

Learn more and register!

Download File Version

Guides Downloads Download File Version
Edit this page

Download File Version

To download a specific file version, pass the GET /files/:id/content the ID of the file to get the content for, as well as its version ID.

curl -i -L -X GET "" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
string fileId = "11111";
Stream versionContents = await client.FilesManager.DownloadStreamAsync(fileId, versionId: "22222");
BoxFile file = new BoxFile(api, "id");
Collection<BoxFileVersion> versions = file.getVersions();
BoxFileVersion firstVersion = versions.iterator().next();

FileOutputStream stream = new FileOutputStream(firstVersion.getName());;
file_id = '11111'
file_version = client.file_version('12345')
version_content = client.file(file_id).content(file_version=file_version)
client.files.getReadStream('123456', { version: '98765' }, callback);

Download URL

When not using the SDKs, this API call will return a HTTP 302 Found status code, with a location header containing a link to the download URL, which looks something like this.[long-random-string]/download

By using the -L flag in cURL we are able to automatically follow this redirect.

In our SDKs this will result in the binary data to be downloaded. In the API this will result in a download URL being returned via the location header.

It is possible to get the download URL via the SDKs as well.

Download URL expiry

Although this download URL can be passed to a user's browser to allow them to download the file, the URL does expire and should be requested again for any further downloads.

File not ready

If the file is not ready to be downloaded yet a retry-after header will be returned indicating the time in seconds after which the file will be available for the client to download.

This response can occur when the file was uploaded immediately before the download request.