Box Developer Documentation
Latest version

Remove file version

delete
https://api.box.com/2.0
/files/:file_id/versions/:file_version_id

This endpoint is in the version 2024.0. No changes are required to continue using it. For more details, see Box API versioning.

Move a file version to the trash.

Versions are only tracked for Box users with premium accounts.

Request

bearer [ACCESS_TOKEN]
application/json

Request Headers

stringin headeroptional
1

Ensures this item hasn't recently changed before making changes.

Pass in the item's last observed etag value into this header and the endpoint will fail with a 412 Precondition Failed if it has changed since.

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
1234

The ID of the file version.

Response

none

Returns an empty response when the file has been successfully deleted.

application/jsonClient error

An unexpected client error.

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

Request Example

Learn more about Box SDK versionig strategy.


cURL
curl -i -X DELETE "https://api.box.com/2.0/files/12345/versions/456456" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
Node/TypeScript v10
await client.fileVersions.deleteFileVersionById(file.id, fileVersion.id);
Python v10
client.file_versions.delete_file_version_by_id(file.id, file_version.id)
.NET v10
await client.FileVersions.DeleteFileVersionByIdAsync(fileId: file.Id, fileVersionId: fileVersion.Id);
Swift v10
try await client.fileVersions.deleteFileVersionById(fileId: file.id, fileVersionId: fileVersion.id)
Java v10
client.getFileVersions().deleteFileVersionById(file.getId(), fileVersion.getId())
Java v4
BoxFile file = new BoxFile(api, "id");
Collection<BoxFileVersion> versions = file.getVersions();
BoxFileVersion firstVersion = versions.iterator().next();
firstVersion.delete();
Python v3
file_id = '11111'
version_id = '12345'

version_to_delete = client.file_version(version_id)
client.file(file_id).delete_version(version_to_delete)
.NET v5
string fileId = "11111";
await client.FilesManager.DeleteOldVersionAsync(fileId, versionId: "22222");
Node v3
var fileID = '11111';
var versionID = '22222';
client.files.deleteVersion(fileID, versionID)
	.then(() => {
		// deletion succeeded — no value returned
	});