> **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.

## Create an analytics trace

Endpoint: `POST /v1/crm-traces`

Records a visit with its analytics source and links it to CRM records. Send the fields at the JSON root.

> 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.

Writes require a `READWRITE` key.

## Request body fields

| Field | Type | Required | Description |
|---|---|---|---|
| `sourceId` | number | yes | Active analytics source ID. Obtain it from the Bitrix24 account administrator. This is not a lead source dictionary ID. |
| `entities` | array | no | CRM links. Bitrix24 requires 1 to 50 links in total to create a trace. |
| `entities[].type` | string | yes | Type: `LEAD`, `DEAL`, `CONTACT`, `COMPANY`, `QUOTE`. |
| `entities[].id` | number or string | yes | Positive record ID. Use [leads](/docs/entities/leads/list), [deals](/docs/entities/deals/list), [contacts](/docs/entities/contacts/list), [companies](/docs/entities/companies/list), or [quotes](/docs/entities/quotes/list). |
| `isMobile` | boolean | no | Whether the visit used a mobile device. Omitted means `false`. |
| `utm` | object | no | Tags `source`, `medium`, `campaign`, `content`, `term`. Each is an optional string. |
| `pages` | array | no | Visited pages, up to 10. |
| `pages[].url` | string | yes | Absolute `http` or `https` address, up to 1000 characters. |
| `pages[].title` | string | no | Page title, up to 255 characters. |
| `pages[].time` | string | no | ISO 8601 date and time, such as `2026-10-28T10:00:00+00:00`. Do not use a Unix timestamp. |
| `channels` | array | no | Visit channels, up to 20. |
| `channels[].code` | string | yes | Channel code, such as `form`, `call`, `mail`, `site`. |
| `channels[].value` | string | no | Channel value, up to 255 characters. |

Required nested fields apply to each supplied array item. Bitrix24 validates count and length limits. The `trace` and `sourceId` fields are mutually exclusive.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/crm-traces" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":2,"entities":[{"type":"DEAL","id":11}],"isMobile":false,"utm":{"source":"vibeprobe","campaign":"x"},"pages":[{"url":"https://example.com/p","title":"VIBE-PROBE page","time":"2026-10-28T10:00:00+00:00"}],"channels":[{"code":"form","value":"5"}]}'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/crm-traces" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":2,"entities":[{"type":"DEAL","id":11}],"isMobile":false,"utm":{"source":"vibeprobe","campaign":"x"},"pages":[{"url":"https://example.com/p","title":"VIBE-PROBE page","time":"2026-10-28T10:00:00+00:00"}],"channels":[{"code":"form","value":"5"}]}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-traces', {
  "method": "POST",
  "headers": {
    "X-Api-Key": "YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  "body": JSON.stringify({
  "sourceId": 2,
  "entities": [
    {
      "type": "DEAL",
      "id": 11
    }
  ],
  "isMobile": false,
  "utm": {
    "source": "vibeprobe",
    "campaign": "x"
  },
  "pages": [
    {
      "url": "https://example.com/p",
      "title": "VIBE-PROBE page",
      "time": "2026-10-28T10:00:00+00:00"
    }
  ],
  "channels": [
    {
      "code": "form",
      "value": "5"
    }
  ]
})
})
const result = await res.json()
console.log(result)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-traces', {
  "method": "POST",
  "headers": {
    "X-Api-Key": "YOUR_APP_KEY",
    "Authorization": "Bearer USER_SESSION_TOKEN",
    "Content-Type": "application/json"
  },
  "body": JSON.stringify({
  "sourceId": 2,
  "entities": [
    {
      "type": "DEAL",
      "id": 11
    }
  ],
  "isMobile": false,
  "utm": {
    "source": "vibeprobe",
    "campaign": "x"
  },
  "pages": [
    {
      "url": "https://example.com/p",
      "title": "VIBE-PROBE page",
      "time": "2026-10-28T10:00:00+00:00"
    }
  ],
  "channels": [
    {
      "code": "form",
      "value": "5"
    }
  ]
})
})
const result = await res.json()
console.log(result)
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | `true` |
| `data.id` | number | Created trace ID. Read the full record: [Get an analytics trace](/docs/entities/crm-traces/v3-get). |

## Response example

HTTP status: `201 Created`.

```json
{
  "success": true,
  "data": {
    "id": 1
  }
}
```

## Error response example

400: both creation formats supplied.

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "trace and sourceId are mutually exclusive"
  }
}
```

## Errors

| HTTP | Code | Description |
|---|---|---|
| 400 | `MISSING_REQUIRED_FIELDS` | Required request fields are missing. |
| 400 | `INVALID_PARAMS` | Invalid request type or shape, or an invalid ID. |
| 403 | `SCOPE_DENIED` | Missing `crm` scope. |
| 401 | `TOKEN_MISSING` | The key has no configured tokens. |
| 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`. |
| 502 | `BITRIX_UNAVAILABLE` | Invalid Bitrix24 response. |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only. |
| 403 | `BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION` | Insufficient permissions for linked CRM records. |
| 400 | `BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION` | Bitrix24 rejected the source, channel, links, or visit data. Details appear in `error.validation`. |

Other Bitrix24 refusal codes, statuses and messages are preserved. See [Errors](/docs/errors) for common failures.

## Known specifics

The `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.

## See also

- [List analytics traces](/docs/entities/crm-traces/v3-list)
- [Get an analytics trace](/docs/entities/crm-traces/v3-get)
- [Delete an analytics trace](/docs/entities/crm-traces/v3-delete)
