Manage Applications

    Delete file version

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

    Move a file version to the trash.

    Versions are only tracked for Box users with premium accounts.

    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
    1234

    The ID of the file version

    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.

    Response

    none

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

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

    Request Example

    cURL
    curl -X DELETE https://api.box.com/2.0/files/12345/versions/456456 \
         -H "Authorization: Bearer <ACCESS_TOKEN>"
    .NET
    string fileId = "11111";
    await client.FilesManager.DeleteOldVersionAsync(fileId, versionId: "22222");
    Java
    BoxFile file = new BoxFile(api, "id");
    List<BoxFileVersion> versions = file.getVersions();
    BoxFileVersion firstVersion = versions.get(0);
    firstVersion.delete();
    Python
    file_id = '11111'
    version_id = '12345'
    
    version_to_delete = client.file_version(version_id)
    client.file(file_id).delete_version(version_to_delete)
    Node
    var fileID = '11111';
    var versionID = '22222';
    client.files.deleteVersion(fileID, versionID)
    	.then(() => {
    		// deletion succeeded — no value returned
    	});