Get trashed file

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

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.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
12345

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.

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.

Response

application/jsonTrashed File

Returns the file that was trashed, including information about when the it was moved to the trash.

application/jsonClient error

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.

application/jsonClient error

An unexpected client error.

get
Get trashed file
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X GET "https://api.box.com/2.0/files/12345/trash" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
.NET
BoxFile trashedFile = await client.FilesManager.GetTrashedAsync("11111");
Java
String fileID = "9873459";
BoxTrash trash = new BoxTrash(api);
BoxFile.Info fileInfo = trash.getFileInfo(fileID);
Python
file_to_retrieve = client.file(file_id='11111')
file_from_trash = client.trash().get_item(file_to_retrieve)
print(f'File ID is {file_from_trash.id} and name is {file_from_trash.name}')
Node
client.files.getTrashedFile('11111')
	.then(trashedFile => {
		/* trashedFile -> {
			type: 'file',
			id: '11111',
			sequence_id: '2',
			etag: '2',
			sha1: '4bd9e98652799fc57cf9423e13629c151152ce6c',
			name: 'Screenshot_1_30_13_6_37_PM.png',
			description: '',
			size: 163265,
			path_collection: 
			{ total_count: 1,
				entries: 
				[ { type: 'folder',
					id: '1',
					sequence_id: null,
					etag: null,
					name: 'Trash' } ] },
			created_at: '2013-01-30T18:43:56-08:00',
			modified_at: '2013-01-30T18:44:00-08:00',
			trashed_at: '2013-02-07T10:49:34-08:00',
			purged_at: '2013-03-09T10:49:34-08:00',
			content_created_at: '2013-01-30T18:43:56-08:00',
			content_modified_at: '2013-01-30T18:44:00-08:00',
			created_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' },
			modified_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' },
			owned_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' },
			shared_link: null,
			parent: 
			{ type: 'folder',
				id: '0',
				sequence_id: null,
				etag: null,
				name: 'All Files' },
			item_status: 'trashed' }
		*/
	});
TypeScript (Beta)
await client.trashedFiles.getTrashedFileById(file.id);
Python (Beta)
client.trashed_files.get_trashed_file_by_id(file.id)
.NET (Beta)
await client.TrashedFiles.GetTrashedFileByIdAsync(fileId: file.Id).ConfigureAwait(false)

Response Example

{
  "id": "123456789",
  "type": "file",
  "content_created_at": "2012-12-12T10:53:43-08:00",
  "content_modified_at": "2012-12-12T10:53:43-08:00",
  "created_at": "2012-12-12T10:53:43-08:00",
  "created_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "description": "Contract for Q1 renewal",
  "etag": "1",
  "file_version": {
    "id": "12345",
    "type": "file_version",
    "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc"
  },
  "item_status": "trashed",
  "modified_at": "2012-12-12T10:53:43-08:00",
  "modified_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "name": "Contract.pdf",
  "owned_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "parent": {
    "id": "12345",
    "type": "folder",
    "etag": "1",
    "name": "Contracts",
    "sequence_id": "3"
  },
  "path_collection": {
    "entries": [
      {
        "type": "folder",
        "id": "123456789",
        "sequence_id": "null",
        "etag": "null",
        "name": "Trash"
      }
    ],
    "total_count": 1
  },
  "purged_at": "2012-12-12T10:53:43-08:00",
  "sequence_id": "3",
  "sha1": "85136C79CBF9FE36BB9D05D0639C70C265C18D37",
  "shared_link": "null",
  "size": 629644,
  "trashed_at": "2012-12-12T10:53:43-08:00"
}