Manage Applications

    Delete a file

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

    Deletes a file, either permanently or by moving it to the trash.

    The the enterprise settings determine whether the item will be permanently deleted from Box or moved to the trash.

    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.

    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.

    application/jsonClient Error

    Returns an error when the If-Match header does not match the current etag value of the file. This indicates that the file has changed since it was last requested.

    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 \
         -H "Authorization: Bearer <ACCESS_TOKEN>"
    .NET
    await client.FilesManager.DeleteAsync(id: "11111");
    Java
    BoxFile file = new BoxFile(api, "id");
    file.delete();
    Python
    client.file(file_id='11111').delete()
    Node
    client.files.delete('11111', { etag: '5' })
    	.then(() => {
    		// File successfully deleted
    	})
    	.catch(err => {
    		if (err.statusCode === 412) {
    			// Precondition failed — the file was modified before the deletion was processed
    			// Read the file again to ensure it is safe to delete and then retry
    		}
    	});