Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

Remove metadata instance from file

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

Deletes a piece of file metadata.

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.

stringin pathrequired
global

The scope of the metadata template

Value is one of global,enterprise

stringin pathrequired
properties

The name of the metadata template

Response

none

Returns an empty response when the metadata is successfully deleted.

application/jsonClient error

Returned when the request parameters are not valid. This may happen of the scope is not valid.

application/jsonClient error

Returns an error when the file does not have an instance of the metadata template applied to it, or when the user does not have access to the file.

  • instance_not_found - An instance of the metadata template with the given scope and templateKey was not found on this file.
  • not_found - The file was not found, or the user does not have access to the file.
application/jsonClient error

Returned when the method was not allowed.

application/jsonClient error

An unexpected client error.

delete
Remove metadata instance from file
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X DELETE "https://api.box.com/2.0/files/12345/metadata/enterprise_27335/blueprintTemplate" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.fileMetadata.deleteFileMetadataById(
  file.id,
  'enterprise' as DeleteFileMetadataByIdScope,
  templateKey,
);
Python Gen
client.file_metadata.delete_file_metadata_by_id(
    file.id, DeleteFileMetadataByIdScope.ENTERPRISE.value, template_key
)
.NET Gen
await client.FileMetadata.DeleteFileMetadataByIdAsync(fileId: file.Id, scope: DeleteFileMetadataByIdScope.Enterprise, templateKey: templateKey);
Swift Gen (Beta)
try await client.fileMetadata.deleteFileMetadataById(fileId: file.id, scope: DeleteFileMetadataByIdScope.global, templateKey: "properties")
Java
BoxFile file = new BoxFile(api, "id");
file.deleteMetadata("myMetadataTemplate");
Python
client.file(file_id='11111').metadata(scope='enterprise', template='myMetadata').delete()
.NET
await client.MetadataManager.DeleteFileMetadataAsync("11111", "enterprise", "marketingCollateral");
Node
client.files.deleteMetadata('67890', client.metadata.scopes.GLOBAL, client.metadata.templates.PROPERTIES)
	.then(() => {
		// removal succeeded — no value returned
	});;
iOS
client.metadata.delete(
    forFileWithId: "11111",
    scope: "enterprise",
    templateKey: "personnelRecord"
) { (result: Result<Void, BoxSDKError>) in
    guard case .success = result {
        print("Error deleting metadata instance")
        return
    }

    print("Metadata instance deleted")
}