Remove metadata from an item

Remove metadata from an item

Removing an instance of a metadata template assigned to a file or folder can be done using the item's id, and the template's templateKey and scope.

Metadata scopes can be either global for templates available to all enterprises, enterprise for templates available to the current enterprise, or the enterprise_:id for templates belonging to an enterprise whose ID is the :id value in the scope name.

Remove metadata from an file

Deleting an instance of a metadata template from a file be achieved by calling the DELETE /files/:file_id/metadata/:templateKey/schema API.

cURL
curl -i -X DELETE "https://api.box.com/2.0/files/12345/metadata/enterprise_27335/blueprintTemplate" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
.NET
await client.MetadataManager.DeleteFileMetadataAsync("11111", "enterprise", "marketingCollateral");
Java
BoxFile file = new BoxFile(api, "id");
file.deleteMetadata("myMetadataTemplate");
Python
client.file(file_id='11111').metadata(scope='enterprise', template='myMetadata').delete()
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")
}
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 (Beta)
await client.FileMetadata.DeleteFileMetadataByIdAsync(fileId: file.Id, scope: DeleteFileMetadataByIdScope.Global, templateKey: "properties");

This API returns a 204 No Content API response with no response body when the instance has been successfully removed from the file.

Remove metadata from an folder

Deleting an instance of a metadata template from a folder be achieved by calling the DELETE /folders/:folder_id/metadata/:templateKey/schema API.

cURL
curl -i -X DELETE "https://api.box.com/2.0/folders/4353455/metadata/enterprise_27335/blueprintTemplate" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
.NET
await client.MetadataManager.DeleteFolderMetadataAsync("11111", "enterprise", "marketingCollateral");
Java
BoxFolder folder = new BoxFolder(api, "id");
folder.deleteMetadata("myMetadataTemplate");
Python
client.folder(folder_id='11111').metadata(scope='enterprise', template='myMetadata').delete()
Node
client.folders.deleteMetadata('67890', client.metadata.scopes.GLOBAL, client.metadata.templates.PROPERTIES)
	.then(() => {
		// removal succeeded — no value returned
	});
iOS
client.metadata.delete(
    forFolderWithId: "22222",
    scope: "enterprise",
    templateKey: "personnelRecord"
) { (result: Result<Void, BoxSDKError>) in
    guard case .success = result {
        print("Error deleting metadata instance")
        return
    }

    print("Metadata instance deleted")
}
TypeScript Gen
await client.folderMetadata.deleteFolderMetadataById(
  folder.id,
  'enterprise' as DeleteFolderMetadataByIdScope,
  templateKey
);
Python Gen
client.folder_metadata.delete_folder_metadata_by_id(
    folder.id, DeleteFolderMetadataByIdScope.ENTERPRISE.value, template_key
)
.NET (Beta)
await client.FolderMetadata.DeleteFolderMetadataByIdAsync(folderId: folder.Id, scope: DeleteFolderMetadataByIdScope.Global, templateKey: "properties");

This API returns a 204 No Content API response with no response body when the instance has been successfully removed from the folder.