Sample - Box Platform API
OPTIONS/files/content

Check a file before upload

Verifies whether a file can be accepted before you upload its complete contents. Supply the file name, size, and destination parent to receive an upload session URL when the check passes.

3 body fields

Optional file details used to validate whether an upload can be accepted.

namestringoptional
The name for the file.
sizeintegeroptional
The size of the file in bytes.
parentobjectoptional
The parent folder to upload the file to, identified by its folder details.

3 status codes
200Returns an upload session URL in `upload_url` and, when applicable, an `upload_token` for uploading the file.
upload_urlstringoptional
A URL for an upload session that can be used to upload the file.
upload_tokenstringoptional
An optional access token to use to upload the file.
409Returned when the file cannot be created because the preflight check detects a conflict; the response includes details about why the check failed.
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
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.
defaultReturns a generic error object for an unexpected client error.
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

A 409 is returned when the file cannot be created because the destination or file conflicts with an existing resource. Provide a valid name, a byte count in size, and a destination parent to perform the preflight check.