Manage Applications

    Get specific file metadata

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

    Retrieve a specific metadata template instance for a 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.

    stringin pathrequired
    enterprise_27335

    The scope of the metadata template

    Value is one of "global", "enterprise_<id>"

    stringin pathrequired
    blueprintTemplate

    The name of the metadata template

    Response

    application/jsonMetadata

    An instance of the metadata template that includes additional "key:value" pairs defined by the user or an application.

    application/jsonClient Error

    Returned if the metadata template specified was not applied to this 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/enterprise_27335/blueprintTemplate \
         -H "Authorization: Bearer <ACCESS_TOKEN>"
    .NET
    Dictionary<string, object> metadata = await client.MetadataManager.
        .GetFileMetadataAsync(fileId: "11111", "enterprise", "marketingCollateral");
    Java
    // Get the default free-form metadata properties
    BoxFile file = new BoxFile(api, "id");
    Metadata metadata = file.getMetadata();
    
    // Unknown type metadata field, you can test for type or try to get as any type
    JsonValue unknownValue = metadata.getValue("/someField");
    
    // String or Enum metadata fields
    String stringValue = metadata.getString("/author");
    
    // Float metadata fields can be interpreted as any numeric type
    float floatValue = metadata.getFloat("/price");
    
    // Date metadata fields
    Date dateValue = metadata.getDate("/deadline");
    
    // Multiselect metadata fields
    List<String> multiSelectValues = metadata.getMultiSelect("/categories");
    Python
    metadata = client.file(file_id='11111').metadata(scope='enterprise', template='myMetadata').get()
    print('Got metadata instance {0}'.format(metadata['$id']))
    Node
    client.files.getMetadata('11111', client.metadata.scopes.ENTERPRISE, 'marketingCollateral')
    	.then(metadata => {
    		/* metadata -> {
    			audience: 'internal',
    			documentType: 'Q1 plans',
    			competitiveDocument: 'no',
    			status: 'active',
    			author: 'Jones',
    			currentState: 'proposal',
    			'$type': 'marketingCollateral-d086c908-2498-4d3e-8a1f-01e82bfc2abe',
    			'$parent': 'file_11111',
    			'$id': '2094c584-68e1-475c-a581-534a4609594e',
    			'$version': 0,
    			'$typeVersion': 0,
    			'$template': 'marketingCollateral',
    			'$scope': 'enterprise_12345' }
    		*/
    	});

    Response Example

    {
      "$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
    }