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

Get trashed file

Retrieves a file that has been moved to the trash.

Please note that only if the file itself has been moved to the trash can it be retrieved with this API call. If instead one of its parent folders was moved to the trash, only that folder can be inspected using the GET /folders/:id/trash API.

To list all items that have been moved to the trash, please use the GET /folders/trash/items API.

2 parameters
file_idstringrequired
The unique identifier that represents 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`.
fieldsarray<string>optional
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.

3 status codes
200Returns the file that was trashed, including information about when the it was moved to the trash.
idstringrequired
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`.
etagstringoptional
The HTTP `etag` of this file. This can be used within some API endpoints in the `If-Match` and `If-None-Match` headers to only perform changes on the file if (no) changes have happened.
typestringrequired
The value will always be `file`.
Allowed:file
sequence_idobjectrequired
namestringoptional
The name of the file.
sha1stringrequired
The SHA1 hash of the file. This can be used to compare the contents of a file on Box with a local file.
file_versionobjectoptional
descriptionstringrequired
The optional description of this file.
sizeintegerrequired
The file size in bytes. Be careful parsing this integer as it can get very large and cause an integer overflow.
path_collectionobjectrequired
created_atstringrequired
The date and time when the file was created on Box.
modified_atstringrequired
The date and time when the file was last updated on Box.
trashed_atstringoptional
The time at which this file was put in the trash.
purged_atstringoptional
The time at which this file is expected to be purged from the trash.
content_created_atstringoptional
The date and time at which this file was originally created, which might be before it was uploaded to Box.
content_modified_atstringoptional
The date and time at which this file was last updated, which might be before it was uploaded to Box.
created_byobjectoptional
modified_byobjectrequired
owned_byobjectrequired
shared_linkstringoptional
The shared link for this file. This will be `null` if a file has been trashed, since the link will no longer be active.
parentobjectoptional
item_statusstringrequired
Defines if this item has been deleted or not. * `active` when the item has is not in the trash * `trashed` when the item has been moved to the trash but not deleted * `deleted` when the item has been permanently deleted.
Allowed:activetrasheddeleted
404Returns an error if the file can not be found directly in the trash. Please note that a `HTTP 404` is also returned if any of the file's parent folders have been moved to the trash. In that case, only that parent folder can be inspected using the [`GET /folders/:id/trash`](https://developer.box.com/reference/get-folders-id-trash) API.
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.
defaultAn 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 404 is returned: Returns an error if the file can not be found directly in the trash.

Please note that a HTTP 404 is also returned if any of the file's parent folders have been moved to the trash.

In that case, only that parent folder can be inspected using the GET /folders/:id/trash API. Any other status is an error: An unexpected client error.