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

Delete expenses from an end-to-end analytics source

DELETE /v1/crm-tracking/expenses/:id

Deletes a manually added expense pack. Expense packs from advertising integrations cannot be deleted. Deleted packs cannot be restored through the API; create a new one if needed.

The method ships in the crm 26.2100.0 update and is not yet available on all Bitrix24 accounts. Until the feature is enabled for your Bitrix24 account, the API returns 422 METHOD_NOT_YET_AVAILABLE.

Requires the crm scope and a key with READWRITE access.

Parameters

Parameter Type Required Default Description
Parameterid (path) Typeinteger Requiredyes Default— DescriptionPositive expense pack ID. Expense list

Query parameters and request body fields are not accepted.

Examples

curl — personal key

Terminal
curl -i -X DELETE "https://vibecode.bitrix24.com/v1/crm-tracking/expenses/7" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -i -X DELETE "https://vibecode.bitrix24.com/v1/crm-tracking/expenses/7" \
  -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/crm-tracking/expenses/7', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY'
  }
})
if (res.status === 204) {
  console.log('Deleted')
}

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-tracking/expenses/7', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN'
  }
})
if (res.status === 204) {
  console.log('Deleted')
}

Response

Successful deletion returns HTTP 204 No Content with an empty body. Check the status code to confirm success.

Response example

Response shape example.

http
HTTP/1.1 204 No Content

Error response example

400 — invalid ID.

JSON
{"success":false,"error":{"code":"INVALID_PARAMS","message":"id must be a positive safe integer"}}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionInvalid ID or request body fields were supplied
HTTP400 CodeUNKNOWN_FILTER_FIELD DescriptionA query parameter was supplied
HTTP403 CodeSCOPE_DENIED DescriptionThe crm scope is missing
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key permits reads only
HTTP404 CodeENTITY_NOT_FOUND DescriptionExpense pack not found
HTTP422 CodeMETHOD_NOT_YET_AVAILABLE DescriptionThe feature is disabled for the Bitrix24 account or its version does not support the method
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 returned an invalid response

Other Bitrix24 refusals retain their codes and messages. Secrets are removed from messages. General errors — Errors.

See also