List file's metadata

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

Retrieves all metadata for a given file.

Request

application/json

Path Parameters

stringin pathrequired
12345

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.

Response

application/jsonMetadatas

Returns all the metadata associated with a file.

This API does not support pagination and will therefore always return all of the metadata associated to the file.

You can now try out some of our APIs live, right here in the documentation.
Log In

Request Example

cURL
curl -X GET https://api.box.com/2.0/files/12345/metadata \
     -H "Authorization: Bearer <ACCESS_TOKEN>"
.NET
BoxMetadataTemplateCollection<Dictionary<string, object>> metadataInstances = await client.MetadataManager
    .GetAllFileMetadataTemplatesAsync(fileId: "11111");
Java
BoxFile file = new BoxFile(api, "id");
Iterable<Metadata> metadataList = file.getAllMetadata();
for (Metadata metadata : metadataList) {
    // Do something with the metadata.
}
Python
file_metadata = client.file(file_id='11111').get_all_metadata()
for instance in file_metadata:
    if 'foo' in instance:
        print('Metadata instance {0} has value "{1}" for foo'.format(instance['id'], instance['foo']))
Node
client.files.getAllMetadata('11111')
	.then(metadata => {
		/* metadata -> {
			entries: 
			[ { currentDocumentStage: 'Init',
				'$type': 'documentFlow-452b4c9d-c3ad-4ac7-b1ad-9d5192f2fc5f',
				'$parent': 'file_11111',
				'$id': '50ba0dba-0f89-4395-b867-3e057c1f6ed9',
				'$version': 4,
				'$typeVersion': 2,
				needsApprovalFrom: 'Smith',
				'$template': 'documentFlow',
				'$scope': 'enterprise_12345' },
				{ '$type': 'productInfo-9d7b6993-b09e-4e52-b197-e42f0ea995b9',
				'$parent': 'file_11111',
				'$id': '15d1014a-06c2-47ad-9916-014eab456194',
				'$version': 2,
				'$typeVersion': 1,
				skuNumber: 45334223,
				description: 'Watch',
				'$template': 'productInfo',
				'$scope': 'enterprise_12345' },
				{ Popularity: '25',
				'$type': 'properties',
				'$parent': 'file_11111',
				'$id': 'b6f36cbc-fc7a-4eda-8889-130f350cc057',
				'$version': 0,
				'$typeVersion': 2,
				'$template': 'properties',
				'$scope': 'global' } ],
			limit: 100 }
		*/
	});

Response Example

{
  "entries": [
    {
      "$canEdit": true,
      "$id": "01234500-12f1-1234-aa12-b1d234cb567e",
      "$parent": "folder_59449484661,",
      "$scope": "enterprise_27335",
      "$template": "blueprintTemplate",
      "$type": "blueprintTemplate-6bcba49f-ca6d-4d2a-a758-57fe6edf44d0",
      "$typeVersion": 2,
      "$version": 1
    }
  ]
}