[{"data":1,"prerenderedAt":13},["ShallowReactive",2],{"docs-entities\u002Fcrm-traces":3,"docs-tabs-entities\u002Fcrm-traces":6},{"content":4,"lastmod":5},"# Sales-intelligence traces\n\nA trace stores a site visitor's journey and acquisition source and is bound to CRM leads, deals, contacts, companies or quotes.\n\nBitrix24 API: `crm.tracking.trace.list`, `crm.tracking.trace.get`, `crm.tracking.trace.add`, `crm.tracking.trace.delete`\nScope: `crm`\n\n## Operations\n\n- [List traces (REST v3, rolling out)](.\u002Fcrm-traces\u002Fv3-list.md) — `GET \u002Fv1\u002Fcrm-traces`\n- [Read a trace (REST v3, rolling out)](.\u002Fcrm-traces\u002Fv3-get.md) — `GET \u002Fv1\u002Fcrm-traces\u002F:id`\n- [Create with a source (REST v3, rolling out)](.\u002Fcrm-traces\u002Fv3-create.md) — `POST \u002Fv1\u002Fcrm-traces`\n- [Delete a complete trace (REST v3, rolling out)](.\u002Fcrm-traces\u002Fv3-delete.md) — `DELETE \u002Fv1\u002Fcrm-traces\u002F:id`\n\n- [Create a trace (REST v1)](.\u002Fcrm-traces\u002Fcreate.md) — `POST \u002Fv1\u002Fcrm-traces`\n- [Delete a trace (flag off)](.\u002Fcrm-traces\u002Fdelete.md) — `DELETE \u002Fv1\u002Fcrm-traces\u002F:id`\n\n## Key fields\n\nBody fields of [`POST \u002Fv1\u002Fcrm-traces`](.\u002Fcrm-traces\u002Fcreate.md).\n\n| Field | Description |\n|------|---------|\n| `sourceId` | Explicit source for [REST v3 creation](.\u002Fcrm-traces\u002Fv3-create.md); mutually exclusive with `trace` |\n| `trace` | A trace object or a string containing a JSON object. The site tracker `b24Tracker.guest.getTrace()` returns the string |\n| `trace.url` | Address of the page the visitor was on |\n| `trace.ref` | Address the visitor came to the page from |\n| `trace.tags.list` | UTM tags, for example `utm_source` and `utm_campaign` |\n| `entities[].type` | CRM record type: `LEAD`, `DEAL`, `CONTACT`, `COMPANY`, `QUOTE` |\n| `entities[].id` | CRM record ID. List: [`GET \u002Fv1\u002Fleads`](.\u002Fleads\u002Flist.md), [`GET \u002Fv1\u002Fdeals`](.\u002Fdeals\u002Flist.md), [`GET \u002Fv1\u002Fcontacts`](.\u002Fcontacts\u002Flist.md), [`GET \u002Fv1\u002Fcompanies`](.\u002Fcompanies\u002Flist.md), [`GET \u002Fv1\u002Fquotes`](.\u002Fquotes\u002Flist.md) |\n\nThe create response contains only `data.id` — the trace identifier. You need it to delete the trace.\n\n## What to know before you start\n\n1. **Writes require a key with write access.** A read-only key can read traces; POST and DELETE return `403 WRITE_BLOCKED_READONLY_KEY`.\n2. **Legacy creation checks bindings before writing.** Every record from `entities` is read before the trace is created. If at least one record does not exist, the response is `404 ENTITY_NOT_FOUND`, and the trace is not created.\n3. **Legacy creation allows a trace without bindings.** Without `entities` or with an empty array, an unbound trace is created.\n4. **Trace reads are rolling out.** List and get use REST v3, the `crm-tracking-v3` platform flag and the Bitrix24 RestV3Tracking feature. An unavailable operation returns `422 METHOD_NOT_YET_AVAILABLE` with `error.release`.\n5. **Deletion depends on the platform flag.** With `crm-tracking-v3` off, legacy deletion is idempotent and can remove only accessible bindings. With the flag on, REST v3 deletes the complete trace, requires update access to all bound records and returns `404 ENTITY_NOT_FOUND` for a missing trace.\n\n## Typical scenario\n\nA form on a website creates a lead and saves where the visitor came from:\n\n1. On the site page, get the trace from `b24Tracker.guest.getTrace()`.\n2. Create a lead: [`POST \u002Fv1\u002Fleads`](.\u002Fleads\u002Fcreate.md). Its identifier is `data.id`.\n3. Create a trace bound to the lead: [`POST \u002Fv1\u002Fcrm-traces`](.\u002Fcrm-traces\u002Fcreate.md) with the body `{\"trace\": ..., \"entities\": [{\"type\": \"LEAD\", \"id\": \u003Clead id>}]}`. Save the trace's `data.id`.\n4. To delete the trace, call [`DELETE \u002Fv1\u002Fcrm-traces\u002F:id`](.\u002Fcrm-traces\u002Fdelete.md) with the saved identifier.\n\n## Limits\n\n| Limit | Value |\n|-------|----------|\n| Bitrix24 calls per legacy create | one read for each unique record from `entities` and one trace creation. Repeats of the same record in `entities` are read once |\n| Request body size | up to 1 MiB |\n| Request rate | shared Vibecode API limit — see [Request limits](\u002Fdocs\u002Fkeys-auth#request-limits) |\n\n## See also\n\n- [Leads](\u002Fdocs\u002Fentities\u002Fleads)\n- [Deals](\u002Fdocs\u002Fentities\u002Fdeals)\n- [Limits and optimization](\u002Fdocs\u002Foptimization)\n- [Errors](\u002Fdocs\u002Ferrors)\n","2026-10-28",{"crm-traces\u002Fv3-list.md":7,"crm-traces\u002Fv3-get.md":8,"crm-traces\u002Fv3-create.md":9,"crm-traces\u002Fv3-delete.md":10,"crm-traces\u002Fcreate.md":11,"crm-traces\u002Fdelete.md":12},"> **The method is rolling out in update `crm 26.2000.0`.** It is not available on every Bitrix24 account. If the method is not yet available on your account, the API returns `422 METHOD_NOT_YET_AVAILABLE` — this indicates that the update has not reached the account yet, rather than an integration error.\n\n## List analytics traces\n\n`GET \u002Fv1\u002Fcrm-traces`\n\nLists visit traces linked to one CRM record to help analyze the sources of customer inquiries.\n\n> This operation requires the `crm-tracking-v3` flag and the REST v3 analytics capability enabled in the Bitrix24 account. The key needs the `crm` scope.\n\nA `READONLY` key can read this resource.\n\n## Parameters\n\n| Parameter | Type | Required | Default | Description |\n|---|---|---|---|---|\n| `entityType` (query) | string | yes | — | Record type: `LEAD`, `DEAL`, `CONTACT`, `COMPANY`, `QUOTE`. |\n| `entityId` (query) | number | yes | — | Positive record ID of the selected type. Use the lists of [leads](\u002Fdocs\u002Fentities\u002Fleads\u002Flist), [deals](\u002Fdocs\u002Fentities\u002Fdeals\u002Flist), [contacts](\u002Fdocs\u002Fentities\u002Fcontacts\u002Flist), [companies](\u002Fdocs\u002Fentities\u002Fcompanies\u002Flist), or [quotes](\u002Fdocs\u002Fentities\u002Fquotes\u002Flist). |\n| `limit` (query) | number | no | 50 | Page size, from 1 to 500. |\n| `offset` (query) | number | no | 0 | Number of records to skip before the page. A nonnegative integer. |\n\nPagination: one request reads one page. Increase `offset` by `limit` for the next page. No total count or next-page indicator is returned. The `filter`, `select` and `sort` parameters are not accepted.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X GET \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces?entityType=DEAL&entityId=11&limit=50&offset=0\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X GET \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces?entityType=DEAL&entityId=11&limit=50&offset=0\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces?entityType=DEAL&entityId=11&limit=50&offset=0', {\n  \"method\": \"GET\",\n  \"headers\": {\n    \"X-Api-Key\": \"YOUR_API_KEY\"\n  }\n})\nconst result = await res.json()\nconsole.log(result)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces?entityType=DEAL&entityId=11&limit=50&offset=0', {\n  \"method\": \"GET\",\n  \"headers\": {\n    \"X-Api-Key\": \"YOUR_APP_KEY\",\n    \"Authorization\": \"Bearer USER_SESSION_TOKEN\"\n  }\n})\nconst result = await res.json()\nconsole.log(result)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|---|---|---|\n| `success` | boolean | `true` |\n| `data` | array | Visit traces. |\n| `data[].id` | number | Trace ID. |\n| `data[].sourceId` | number or null | Analytics source ID. |\n| `data[].createdTime` | string | Creation time, ISO 8601. |\n| `data[].isMobile` | boolean | Whether the visit used a mobile device. |\n| `data[].channels` | array | Channels with `code`, `value` fields. Text can be `null`. |\n| `data[].pages` | array | Pages with `url`, `title`, `time` fields. Time is ISO 8601. Text can be `null`. |\n| `data[].utm` | object or null | Tags `source`, `medium`, `campaign`, `content`, `term`, each a string or `null`. |\n| `meta.limit` | number | Requested page size. |\n| `meta.offset` | number | Requested offset. |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": [\n    {\n      \"id\": 1,\n      \"sourceId\": 2,\n      \"createdTime\": \"2026-10-28T11:59:18+00:00\",\n      \"isMobile\": false,\n      \"channels\": [\n        {\n          \"code\": \"form\",\n          \"value\": \"5\"\n        }\n      ],\n      \"pages\": [\n        {\n          \"url\": \"https:\u002F\u002Fexample.com\u002Fp\",\n          \"title\": \"VIBE-PROBE page\",\n          \"time\": \"2026-10-28T10:00:00+00:00\"\n        }\n      ],\n      \"utm\": {\n        \"source\": \"vibeprobe\",\n        \"medium\": null,\n        \"campaign\": \"x\",\n        \"content\": null,\n        \"term\": null\n      }\n    }\n  ],\n  \"meta\": {\n    \"limit\": 50,\n    \"offset\": 0\n  }\n}\n```\n\n## Error response example\n\n400: required filter missing.\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"MISSING_REQUIRED_FIELDS\",\n    \"message\": \"entityType and entityId are required\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|---|---|---|\n| 400 | `MISSING_REQUIRED_FIELDS` | Required request fields are missing. |\n| 400 | `INVALID_PARAMS` | Invalid request type or shape, or an invalid ID. |\n| 403 | `SCOPE_DENIED` | Missing `crm` scope. |\n| 401 | `TOKEN_MISSING` | The key has no configured tokens. |\n| 422 | `METHOD_NOT_YET_AVAILABLE` | The platform flag is off or RestV3Tracking is not enabled on the Bitrix24 account. `error.release` is `crm 26.2000.0`. |\n| 502 | `BITRIX_UNAVAILABLE` | Invalid Bitrix24 response. |\n| 400 | `UNKNOWN_FILTER_FIELD` | An unsupported query parameter was supplied. |\n| 404 | `ENTITY_NOT_FOUND` | The CRM record is missing or cannot be read. |\n| 403 | `BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION` | Insufficient permissions for linked CRM records. |\n\nOther Bitrix24 refusal codes, statuses and messages are preserved. See [Errors](\u002Fdocs\u002Ferrors) for common failures.\n\n## Known specifics\n\nCredential fragments in text fields are redacted. Page addresses without sensitive data are preserved unchanged.\n\n## See also\n\n- [Get an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-get)\n- [Create an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-create)\n- [Delete an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-delete)\n","> **The method is rolling out in update `crm 26.2000.0`.** It is not available on every Bitrix24 account. If the method is not yet available on your account, the API returns `422 METHOD_NOT_YET_AVAILABLE` — this indicates that the update has not reached the account yet, rather than an integration error.\n\n## Get an analytics trace\n\n`GET \u002Fv1\u002Fcrm-traces\u002F:id`\n\nReads a visit, its source, channels and viewed pages by the trace identifier.\n\n> This operation requires the `crm-tracking-v3` flag and the REST v3 analytics capability enabled in the Bitrix24 account. The key needs the `crm` scope.\n\nA `READONLY` key can read this resource.\n\n## Parameters\n\n| Parameter | Type | Required | Default | Description |\n|---|---|---|---|---|\n| `id` (path) | number | yes | — | Positive trace ID from the [list](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-list) or [create response](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-create). |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X GET \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F1\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X GET \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F1\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F1', {\n  \"method\": \"GET\",\n  \"headers\": {\n    \"X-Api-Key\": \"YOUR_API_KEY\"\n  }\n})\nconst result = await res.json()\nconsole.log(result)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F1', {\n  \"method\": \"GET\",\n  \"headers\": {\n    \"X-Api-Key\": \"YOUR_APP_KEY\",\n    \"Authorization\": \"Bearer USER_SESSION_TOKEN\"\n  }\n})\nconst result = await res.json()\nconsole.log(result)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|---|---|---|\n| `success` | boolean | `true` |\n| `data` | object | One visit trace. |\n| `data.id` | number | Trace ID. |\n| `data.sourceId` | number or null | Analytics source ID. |\n| `data.createdTime` | string | Creation time, ISO 8601. |\n| `data.isMobile` | boolean | Whether the visit used a mobile device. |\n| `data.channels` | array | Channels with `code`, `value` fields. Text can be `null`. |\n| `data.pages` | array | Pages with `url`, `title`, `time` fields. Time is ISO 8601. Text can be `null`. |\n| `data.utm` | object or null | Tags `source`, `medium`, `campaign`, `content`, `term`, each a string or `null`. |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 1,\n    \"sourceId\": 2,\n    \"createdTime\": \"2026-10-28T11:59:18+00:00\",\n    \"isMobile\": false,\n    \"channels\": [\n      {\n        \"code\": \"form\",\n        \"value\": \"5\"\n      }\n    ],\n    \"pages\": [\n      {\n        \"url\": \"https:\u002F\u002Fexample.com\u002Fp\",\n        \"title\": \"VIBE-PROBE page\",\n        \"time\": \"2026-10-28T10:00:00+00:00\"\n      }\n    ],\n    \"utm\": {\n      \"source\": \"vibeprobe\",\n      \"medium\": null,\n      \"campaign\": \"x\",\n      \"content\": null,\n      \"term\": null\n    }\n  }\n}\n```\n\n## Error response example\n\n404: trace not found. Error messages follow the Bitrix24 account language.\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Entity with ID 1 was not found.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|---|---|---|\n| 400 | `INVALID_PARAMS` | Invalid request type or shape, or an invalid ID. |\n| 403 | `SCOPE_DENIED` | Missing `crm` scope. |\n| 401 | `TOKEN_MISSING` | The key has no configured tokens. |\n| 422 | `METHOD_NOT_YET_AVAILABLE` | The platform flag is off or RestV3Tracking is not enabled on the Bitrix24 portal. `error.release` is `crm 26.2000.0`. |\n| 502 | `BITRIX_UNAVAILABLE` | Invalid Bitrix24 response. |\n| 400 | `UNKNOWN_FILTER_FIELD` | An unsupported query parameter was supplied. |\n| 404 | `ENTITY_NOT_FOUND` | The trace is absent or not readable. |\n| 403 | `BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION` | Insufficient permissions for linked CRM records. |\n\nOther Bitrix24 refusal codes, statuses and messages are preserved. See [Errors](\u002Fdocs\u002Ferrors) for common failures.\n\n## Known specifics\n\nCredential fragments in text fields are redacted. Page addresses without sensitive data are preserved unchanged.\n\n## See also\n\n- [List analytics traces](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-list)\n- [Create an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-create)\n- [Delete an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-delete)\n","> **The method is rolling out in update `crm 26.2000.0`.** It is not available on every Bitrix24 account. If the method is not yet available on your account, the API returns `422 METHOD_NOT_YET_AVAILABLE` — this indicates that the update has not reached the account yet, rather than an integration error.\n\n## Create an analytics trace\n\nEndpoint: `POST \u002Fv1\u002Fcrm-traces`\n\nRecords a visit with its analytics source and links it to CRM records. Send the fields at the JSON root.\n\n> This operation requires the `crm-tracking-v3` flag and the REST v3 analytics capability enabled in the Bitrix24 account. The key needs the `crm` scope.\n\nWrites require a `READWRITE` key.\n\n## Request body fields\n\n| Field | Type | Required | Description |\n|---|---|---|---|\n| `sourceId` | number | yes | Active analytics source ID. Obtain it from the Bitrix24 account administrator. This is not a lead source dictionary ID. |\n| `entities` | array | no | CRM links. Bitrix24 requires 1 to 50 links in total to create a trace. |\n| `entities[].type` | string | yes | Type: `LEAD`, `DEAL`, `CONTACT`, `COMPANY`, `QUOTE`. |\n| `entities[].id` | number or string | yes | Positive record ID. Use [leads](\u002Fdocs\u002Fentities\u002Fleads\u002Flist), [deals](\u002Fdocs\u002Fentities\u002Fdeals\u002Flist), [contacts](\u002Fdocs\u002Fentities\u002Fcontacts\u002Flist), [companies](\u002Fdocs\u002Fentities\u002Fcompanies\u002Flist), or [quotes](\u002Fdocs\u002Fentities\u002Fquotes\u002Flist). |\n| `isMobile` | boolean | no | Whether the visit used a mobile device. Omitted means `false`. |\n| `utm` | object | no | Tags `source`, `medium`, `campaign`, `content`, `term`. Each is an optional string. |\n| `pages` | array | no | Visited pages, up to 10. |\n| `pages[].url` | string | yes | Absolute `http` or `https` address, up to 1000 characters. |\n| `pages[].title` | string | no | Page title, up to 255 characters. |\n| `pages[].time` | string | no | ISO 8601 date and time, such as `2026-10-28T10:00:00+00:00`. Do not use a Unix timestamp. |\n| `channels` | array | no | Visit channels, up to 20. |\n| `channels[].code` | string | yes | Channel code, such as `form`, `call`, `mail`, `site`. |\n| `channels[].value` | string | no | Channel value, up to 255 characters. |\n\nRequired nested fields apply to each supplied array item. Bitrix24 validates count and length limits. The `trace` and `sourceId` fields are mutually exclusive.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"sourceId\":2,\"entities\":[{\"type\":\"DEAL\",\"id\":11}],\"isMobile\":false,\"utm\":{\"source\":\"vibeprobe\",\"campaign\":\"x\"},\"pages\":[{\"url\":\"https:\u002F\u002Fexample.com\u002Fp\",\"title\":\"VIBE-PROBE page\",\"time\":\"2026-10-28T10:00:00+00:00\"}],\"channels\":[{\"code\":\"form\",\"value\":\"5\"}]}'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"sourceId\":2,\"entities\":[{\"type\":\"DEAL\",\"id\":11}],\"isMobile\":false,\"utm\":{\"source\":\"vibeprobe\",\"campaign\":\"x\"},\"pages\":[{\"url\":\"https:\u002F\u002Fexample.com\u002Fp\",\"title\":\"VIBE-PROBE page\",\"time\":\"2026-10-28T10:00:00+00:00\"}],\"channels\":[{\"code\":\"form\",\"value\":\"5\"}]}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces', {\n  \"method\": \"POST\",\n  \"headers\": {\n    \"X-Api-Key\": \"YOUR_API_KEY\",\n    \"Content-Type\": \"application\u002Fjson\"\n  },\n  \"body\": JSON.stringify({\n  \"sourceId\": 2,\n  \"entities\": [\n    {\n      \"type\": \"DEAL\",\n      \"id\": 11\n    }\n  ],\n  \"isMobile\": false,\n  \"utm\": {\n    \"source\": \"vibeprobe\",\n    \"campaign\": \"x\"\n  },\n  \"pages\": [\n    {\n      \"url\": \"https:\u002F\u002Fexample.com\u002Fp\",\n      \"title\": \"VIBE-PROBE page\",\n      \"time\": \"2026-10-28T10:00:00+00:00\"\n    }\n  ],\n  \"channels\": [\n    {\n      \"code\": \"form\",\n      \"value\": \"5\"\n    }\n  ]\n})\n})\nconst result = await res.json()\nconsole.log(result)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces', {\n  \"method\": \"POST\",\n  \"headers\": {\n    \"X-Api-Key\": \"YOUR_APP_KEY\",\n    \"Authorization\": \"Bearer USER_SESSION_TOKEN\",\n    \"Content-Type\": \"application\u002Fjson\"\n  },\n  \"body\": JSON.stringify({\n  \"sourceId\": 2,\n  \"entities\": [\n    {\n      \"type\": \"DEAL\",\n      \"id\": 11\n    }\n  ],\n  \"isMobile\": false,\n  \"utm\": {\n    \"source\": \"vibeprobe\",\n    \"campaign\": \"x\"\n  },\n  \"pages\": [\n    {\n      \"url\": \"https:\u002F\u002Fexample.com\u002Fp\",\n      \"title\": \"VIBE-PROBE page\",\n      \"time\": \"2026-10-28T10:00:00+00:00\"\n    }\n  ],\n  \"channels\": [\n    {\n      \"code\": \"form\",\n      \"value\": \"5\"\n    }\n  ]\n})\n})\nconst result = await res.json()\nconsole.log(result)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|---|---|---|\n| `success` | boolean | `true` |\n| `data.id` | number | Created trace ID. Read the full record: [Get an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-get). |\n\n## Response example\n\nHTTP status: `201 Created`.\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 1\n  }\n}\n```\n\n## Error response example\n\n400: both creation formats supplied.\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"trace and sourceId are mutually exclusive\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|---|---|---|\n| 400 | `MISSING_REQUIRED_FIELDS` | Required request fields are missing. |\n| 400 | `INVALID_PARAMS` | Invalid request type or shape, or an invalid ID. |\n| 403 | `SCOPE_DENIED` | Missing `crm` scope. |\n| 401 | `TOKEN_MISSING` | The key has no configured tokens. |\n| 422 | `METHOD_NOT_YET_AVAILABLE` | The platform flag is off or RestV3Tracking is not enabled on the Bitrix24 portal. `error.release` is `crm 26.2000.0`. |\n| 502 | `BITRIX_UNAVAILABLE` | Invalid Bitrix24 response. |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only. |\n| 403 | `BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION` | Insufficient permissions for linked CRM records. |\n| 400 | `BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION` | Bitrix24 rejected the source, channel, links, or visit data. Details appear in `error.validation`. |\n\nOther Bitrix24 refusal codes, statuses and messages are preserved. See [Errors](\u002Fdocs\u002Ferrors) for common failures.\n\n## Known specifics\n\nThe `sourceId` field selects this format. A request with `trace` uses the existing creation format regardless of the flag. Bitrix24 validates record update permissions and source eligibility during creation.\n\n## See also\n\n- [List analytics traces](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-list)\n- [Get an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-get)\n- [Delete an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-delete)\n","> **The method is rolling out in update `crm 26.2000.0`.** It is not available on every Bitrix24 account. If the method is not yet available on your account, the API returns `422 METHOD_NOT_YET_AVAILABLE` — this indicates that the update has not reached the account yet, rather than an integration error.\n\n## Delete an analytics trace\n\nEndpoint: `DELETE \u002Fv1\u002Fcrm-traces\u002F:id`\n\nDeletes an analytics trace and its links to CRM records. A deleted trace cannot be restored through the API.\n\n> The key needs the `crm` scope. How the deletion runs depends on whether the `crm-tracking-v3` platform flag is on for the Bitrix24 account. The differences are described under \"Known specifics\".\n\nWrites require a `READWRITE` key.\n\n## Parameters\n\n| Parameter | Type | Required | Default | Description |\n|---|---|---|---|---|\n| `id` (path) | number | yes | — | Positive trace ID from the [list](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-list) or [create response](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-create). |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X DELETE \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F1\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X DELETE \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F1\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F1', {\n  \"method\": \"DELETE\",\n  \"headers\": {\n    \"X-Api-Key\": \"YOUR_API_KEY\"\n  }\n})\nconsole.log(res.status === 204)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F1', {\n  \"method\": \"DELETE\",\n  \"headers\": {\n    \"X-Api-Key\": \"YOUR_APP_KEY\",\n    \"Authorization\": \"Bearer USER_SESSION_TOKEN\"\n  }\n})\nconsole.log(res.status === 204)\n```\n\n## Response\n\nSuccess is `204 No Content` with an empty body. Check the status without parsing JSON.\n\n## Response example\n\n```http\nHTTP\u002F1.1 204 No Content\n```\n\n## Error response example\n\n404: trace not found. Error messages follow the Bitrix24 account language.\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Entity with ID 1 was not found.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|---|---|---|\n| 400 | `INVALID_PARAMS` | Invalid request type or shape, or an invalid ID. |\n| 403 | `SCOPE_DENIED` | Missing `crm` scope. |\n| 401 | `TOKEN_MISSING` | The key has no configured tokens. |\n| 422 | `METHOD_NOT_YET_AVAILABLE` | The platform flag is on, but RestV3Tracking is not yet enabled on the Bitrix24 portal. `error.release` is `crm 26.2000.0`. |\n| 502 | `BITRIX_UNAVAILABLE` | Invalid Bitrix24 response. |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only. |\n| 404 | `ENTITY_NOT_FOUND` | The trace is absent or not readable. |\n| 403 | `BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION` | Insufficient permissions for linked CRM records. |\n| — | `CRM_TRACKING_TRACE_TOO_MANY_BINDINGS` | Only with the flag on: the trace has more than 500 links. Nothing was deleted. The HTTP status is passed through from Bitrix24 unchanged. |\n\nOther Bitrix24 refusal codes, statuses and messages are preserved. See [Errors](\u002Fdocs\u002Ferrors) for common failures.\n\n## Known specifics\n\nWith the flag enabled, deletion requires permission to update every linked CRM record and removes the whole trace. If permission for any record is missing, nothing is deleted.\n\nWith the flag off, the legacy REST v1 path applies: the API returns 204 even if the trace does not exist, and accessible links may be removed without deleting the whole trace.\n\n## See also\n\n- [List analytics traces](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-list)\n- [Get an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-get)\n- [Create an analytics trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fv3-create)\n","## Create a trace\n\n`POST \u002Fv1\u002Fcrm-traces`\n\nCreates a sales-intelligence trace and binds it to CRM records. Call it after creating a lead or another record to save where the visitor came from.\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `trace` | object \\| string | yes | A trace object or a string containing a JSON object. An array, a number, `null` and a string without a JSON object are rejected with `400 INVALID_PARAMS` |\n| `entities` | array | no | Bindings to CRM records. Without the array or with an empty array, an unbound trace is created |\n| `entities[].type` | string | yes | Record type: `LEAD`, `DEAL`, `CONTACT`, `COMPANY` or `QUOTE` |\n| `entities[].id` | number \\| string | yes | ID of an existing record — a positive integer; a string of digits is also accepted. List: [`GET \u002Fv1\u002Fleads`](\u002Fdocs\u002Fentities\u002Fleads\u002Flist), [`GET \u002Fv1\u002Fdeals`](\u002Fdocs\u002Fentities\u002Fdeals\u002Flist), [`GET \u002Fv1\u002Fcontacts`](\u002Fdocs\u002Fentities\u002Fcontacts\u002Flist), [`GET \u002Fv1\u002Fcompanies`](\u002Fdocs\u002Fentities\u002Fcompanies\u002Flist), [`GET \u002Fv1\u002Fquotes`](\u002Fdocs\u002Fentities\u002Fquotes\u002Flist) |\n\nA `trace` object is passed without renaming its keys; a string is passed as is. The site tracker `b24Tracker.guest.getTrace()` returns a ready-to-use string. Sales intelligence uses the following trace keys: `url`, `ref` — the address the visitor came from, `client` — the analytics client identifier, `gid`, `device.isMobile`, `pages.list` with `[url, timestamp, title]` triples, `tags.ts`, `tags.list` with UTM tags, `previous.list`, `channels` with the `code` and `value` fields. The object may be empty: `{\"trace\": {}}` creates a trace.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"trace\": {\n      \"url\": \"https:\u002F\u002Fexample.com\u002Fform\",\n      \"ref\": \"https:\u002F\u002Fexample.com\u002Fnews\",\n      \"tags\": { \"list\": { \"utm_source\": \"newsletter\", \"utm_campaign\": \"autumn\" } }\n    },\n    \"entities\": [{ \"type\": \"LEAD\", \"id\": 123 }]\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"trace\": {\n      \"url\": \"https:\u002F\u002Fexample.com\u002Fform\",\n      \"ref\": \"https:\u002F\u002Fexample.com\u002Fnews\",\n      \"tags\": { \"list\": { \"utm_source\": \"newsletter\", \"utm_campaign\": \"autumn\" } }\n    },\n    \"entities\": [{ \"type\": \"LEAD\", \"id\": 123 }]\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    trace: {\n      url: 'https:\u002F\u002Fexample.com\u002Fform',\n      ref: 'https:\u002F\u002Fexample.com\u002Fnews',\n      tags: { list: { utm_source: 'newsletter', utm_campaign: 'autumn' } },\n    },\n    entities: [{ type: 'LEAD', id: 123 }],\n  }),\n})\n\nconst { data } = await res.json()\nconsole.log('Trace ID:', data.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    trace: {\n      url: 'https:\u002F\u002Fexample.com\u002Fform',\n      ref: 'https:\u002F\u002Fexample.com\u002Fnews',\n      tags: { list: { utm_source: 'newsletter', utm_campaign: 'autumn' } },\n    },\n    entities: [{ type: 'LEAD', id: 123 }],\n  }),\n})\n\nconst { data } = await res.json()\nconsole.log('Trace ID:', data.id)\n```\n\n## Response fields\n\nHTTP status `201 Created`.\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | object | The created trace |\n| `data.id` | number | Trace identifier. Needed for [deletion](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fdelete) |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 2025\n  }\n}\n```\n\n## Error response example\n\n404 — a CRM record from `entities` was not found, the trace was not created:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Not found\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `MISSING_REQUIRED_FIELDS` | The body has no `trace`, or the body is not a JSON object |\n| 400 | `INVALID_PARAMS` | `trace` is neither an object nor a string with a JSON object, the body root or an `entities` element has an extra key, `entities` is not an array, `entities[].type` is unknown, or `entities[].id` is not a positive integer |\n| 404 | `ENTITY_NOT_FOUND` | A CRM record from `entities` was not found. The trace is not created |\n| 403 | `BITRIX_ACCESS_DENIED` | No permission to read or update a CRM record from `entities` |\n| 422 | `BITRIX_ERROR` | Bitrix24 rejected the trace creation. The error text is returned in `error.message` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 returned an invalid response to the record read or to the trace creation |\n| 403 | `SCOPE_DENIED` | The key does not have the `crm` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key works in read-only mode |\n| 401 | `TOKEN_MISSING` | The key has no configured tokens |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**Records are checked before creation.** All records from `entities` are read before the trace is created; duplicate records are read only once. If at least one record is not found or not accessible, the trace is not created. Permission to update a record is checked when the trace is created. The check does not protect against a record being deleted between the read and the trace creation.\n\n## See also\n\n- [Delete a trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fdelete)\n- [Sales-intelligence traces](\u002Fdocs\u002Fentities\u002Fcrm-traces)\n- [Create a lead](\u002Fdocs\u002Fentities\u002Fleads\u002Fcreate)\n","## Delete a trace\n\n`DELETE \u002Fv1\u002Fcrm-traces\u002F:id`\n\nDeletes a sales-intelligence trace together with its bindings to CRM records. A deleted trace cannot be restored via the API — create a new one if needed.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `id` (path) | number | yes | Trace identifier — a positive integer. Returned in `data.id` when [creating a trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fcreate) |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X DELETE \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F2025\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X DELETE \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F2025\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F2025', {\n  method: 'DELETE',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n  },\n})\n\nif (res.status === 204) {\n  console.log('Trace deleted')\n}\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcrm-traces\u002F2025', {\n  method: 'DELETE',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nif (res.status === 204) {\n  console.log('Trace deleted')\n}\n```\n\n## Response\n\nOn successful deletion, HTTP status `204 No Content` is returned with an empty body — success is checked by the status.\n\n## Response example\n\n```http\nHTTP\u002F1.1 204 No Content\n```\n\n## Error response example\n\n400 — `id` is not a positive integer:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"id must be a positive safe integer\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `INVALID_PARAMS` | `id` is not a positive integer |\n| 422 | `BITRIX_ERROR` | Bitrix24 rejected the deletion. The error text is returned in `error.message` |\n| 403 | `SCOPE_DENIED` | The key does not have the `crm` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key works in read-only mode |\n| 401 | `TOKEN_MISSING` | The key has no configured tokens |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**Deletion is idempotent.** A nonexistent or already deleted trace also returns `204`. The response does not say whether the trace existed. You cannot check in advance whether a trace exists: there is no method for reading traces.\n\n**Partial permissions.** If you have update permission for only some of the bound CRM records, the bindings to the accessible records are removed. The other bindings and the trace itself remain, and the response is still `204`.\n\n## See also\n\n- [Create a trace](\u002Fdocs\u002Fentities\u002Fcrm-traces\u002Fcreate)\n- [Sales-intelligence traces](\u002Fdocs\u002Fentities\u002Fcrm-traces)\n",1795000317997]