Sample - Box Platform API
GET/files/{file_id}/content

Download file content

Downloads the binary contents of a specific file. Use range to request a byte range, version to select a file version, or boxapi and access_token when downloading through a shared link or pre-authenticated URL.

5 parameters
file_idstringrequired
The unique identifier of the file to download.
versionstringoptional
The identifier of the file version to download.
access_tokenstringoptional
An optional access token that pre-authenticates the download request; scope it to read access for only the required file.
rangestringoptional
The byte range to download, using the format `bytes={start_byte}-{end_byte}`.
boxapistringoptional
The shared-link URL and optional password used to access the file or a nested item through a shared link.

4 status codes
200Returns the requested file as binary content when redirects are followed automatically.
202Returned when the file is not yet ready for download; the `Retry-After` header specifies how many seconds to wait before retrying.
302Returned when the file is available and the response provides a temporary `Location` URL on `dl.boxcloud.com` for the download.
defaultReturned when an unexpected client error occurs.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.

Error handling

The file_id must identify the file whose content you want to download. When supplied, range must use the bytes={start_byte}-{end_byte} format, and version must identify the file version to download. If the file is not ready, honor the Retry-After header before retrying.