For AI agents: markdown of this page — /docs-content-en/entities/crm-tracking/sources-create.md documentation index — /llms.txt
Create an end-to-end analytics source
POST /v1/crm-tracking/sources
Creates a custom end-to-end analytics source in your Bitrix24 account. Send fields at the JSON root, without a wrapper object.
The method ships in the
crm 26.2100.0update and is not yet available on all Bitrix24 accounts. Until the feature is enabled for your Bitrix24 account, the API returns422 METHOD_NOT_YET_AVAILABLE.
Requires the crm scope and a key that permits writes.
Request body fields
| Field | Type | Required | Description |
|---|---|---|---|
Fieldname |
Typestring | Requiredyes | DescriptionSource name |
Fieldcolor |
Typestring | Requiredno | DescriptionSource color in #rgb or #rrggbb format |
FieldrefDomains |
Typestring[] | Requiredno | DescriptionList of referring domains |
FieldutmSources |
Typestring[] | Requiredno | DescriptionList of utm_source values |
The body accepts no other fields. Bitrix24 trims whitespace, removes empty values, and limits each list to 100 values. The API validates the shape: an array of strings.
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/crm-tracking/sources" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Partner campaign",
"color": "#55d0e0",
"refDomains": [
"partner.example.com"
],
"utmSources": [
"partner"
]
}'
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/crm-tracking/sources" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Partner campaign",
"color": "#55d0e0",
"refDomains": [
"partner.example.com"
],
"utmSources": [
"partner"
]
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-tracking/sources', {
method: 'POST',
headers: {
"X-Api-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "Partner campaign",
"color": "#55d0e0",
"refDomains": [
"partner.example.com"
],
"utmSources": [
"partner"
]
}),
})
const { success, data } = await res.json()
console.log(data.id)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-tracking/sources', {
method: 'POST',
headers: {
"X-Api-Key": "YOUR_APP_KEY",
"Authorization": "Bearer USER_SESSION_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "Partner campaign",
"color": "#55d0e0",
"refDomains": [
"partner.example.com"
],
"utmSources": [
"partner"
]
}),
})
const { success, 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 | DescriptionSource ID for reading |
Response example
Response shape example, not a live call result.
{
"success": true,
"data": {
"id": 2
}
}
Error response example
400 — missing name:
{
"success": false,
"error": {
"code": "MISSING_REQUIRED_FIELDS",
"message": "name is required"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeMISSING_REQUIRED_FIELDS |
Descriptionname is missing |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionThe body is not an object, carries a field not listed above, name is not a string, color is not in #rgb or #rrggbb format, or refDomains or utmSources is not an array of strings. message names the cause |
| HTTP400 | CodeUNKNOWN_FILTER_FIELD |
DescriptionA query parameter was supplied |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key permits reads only |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe crm scope is missing |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionNo credentials are configured for the key |
| HTTP422 | CodeMETHOD_NOT_YET_AVAILABLE |
DescriptionThe feature is not enabled for the portal yet |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 returned an invalid response |
Bitrix24 refusals retain their code and message. For common errors, see Errors.