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

Add expenses to an end-to-end analytics source

POST /v1/crm-tracking/sources/:id/expenses

Manually adds an expense pack to a source for the specified period. Send fields at the JSON root.

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 source ID. Source list

Query parameters are not accepted.

Request body fields

Field Type Required Description
FielddateFrom Typestring Requiredyes DescriptionPeriod start in YYYY-MM-DD format
FielddateTo Typestring Requiredyes DescriptionPeriod end in YYYY-MM-DD format
Fieldamount Typenumber Requiredyes DescriptionAmount in currency units: 12.5 means 12.50, without conversion to minor units
FieldcurrencyId Typestring Requiredyes DescriptionCurrency code. Currency list
Fieldactions Typeinteger Requiredno DescriptionNumber of actions
Fieldcomment Typestring | null Requiredno DescriptionExpense comment

Specify the source only in the path. The sourceId field is not accepted in the request body.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/expenses" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dateFrom":"2026-10-01","dateTo":"2026-10-07","amount":12.5,"currencyId":"USD"}'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/expenses" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"dateFrom":"2026-10-01","dateTo":"2026-10-07","amount":12.5,"currencyId":"USD"}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/expenses', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ dateFrom: '2026-10-01', dateTo: '2026-10-07', amount: 12.5, currencyId: 'USD' })
})
const { data } = await res.json()
console.log(data.id)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/expenses', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ dateFrom: '2026-10-01', dateTo: '2026-10-07', amount: 12.5, currencyId: 'USD' })
})
const { data } = await res.json()
console.log(data.id)

Response fields

HTTP 201 on creation.

Field Type Description
Fieldsuccess Typeboolean Descriptiontrue on success
Fielddata Typeobject DescriptionCreation result
Fielddata.id Typenumber DescriptionExpense pack ID. Expense list

Response example

Response shape example.

JSON
{"success":true,"data":{"id":7}}

Error response example

400 — required fields are missing.

JSON
{"success":false,"error":{"code":"MISSING_REQUIRED_FIELDS","message":"dateFrom, dateTo, amount and currencyId are required"}}

Errors

HTTP Code Description
HTTP400 CodeMISSING_REQUIRED_FIELDS DescriptionA required field is missing
HTTP400 CodeINVALID_PARAMS DescriptionInvalid ID, date format, field type, or unknown body field
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
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.

Known specifics

Bitrix24 validates amount, currency, and period restrictions, including the 365-day limit. The API validates the request shape and does not impose its own bounds on these values.

See also