For AI agents: markdown of this page — /docs-content-en/entities/files/delete.md documentation index — /llms.txt

Delete file

DELETE /v1/files/:id

Moves the file to the Bitrix24 trash. The file is not deleted permanently — it can be restored manually via Bitrix24.

Parameters

Parameter Type Required Description
id (path) number yes File ID. A positive integer

Examples

curl — personal key

Terminal
curl -X DELETE "https://vibecode.bitrix24.com/v1/files/3291" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth app

Terminal
curl -X DELETE "https://vibecode.bitrix24.com/v1/files/3291" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/files/3291', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

if (res.status === 204) {
  console.log('File moved to trash')
}

JavaScript — OAuth app

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/files/3291', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

if (res.status === 204) {
  console.log('File moved to trash')
}

Response

On a successful move to trash, the response is HTTP status 204 No Content with an empty body. The success indicator is the response code, not the body.

Response example

HTTP/1.1 204 No Content

Error response example

404 — file not found:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Could not find entity with id '99999999'."
  }
}

Errors

HTTP Code Description
404 ENTITY_NOT_FOUND File with the given ID not found
403 SCOPE_DENIED API key lacks the disk scope
401 TOKEN_MISSING API key has no configured authorization tokens
401 INVALID_API_KEY Invalid or expired API key

Full list of common API errors — Error codes.

Known specifics

The operation moves the file to the Bitrix24 trash — a soft delete. The file is kept in the trash and can be restored by a Bitrix24 account administrator via the Bitrix24 interface. Permanent deletion via the Vibecode API is not available.

See also