## Source analytics

`GET /v1/crm-tracking/analytics/sources`

Get end-to-end analytics metrics for selected sources over a specified period.

> **The method ships in the `crm 26.2100.0` update and is not yet available on all Bitrix24 accounts.** If the method is not enabled yet, the API returns `422 METHOD_NOT_YET_AVAILABLE`.

Requires the `crm` scope, the `crm-tracking-v3` flag, and the feature enabled in the Bitrix24 account. `READONLY` keys can read this resource.

## Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `sourceIds` (query) | string | yes | — | Comma-separated positive integer IDs, such as `2,3`. Get IDs from the [source list](/docs/entities/crm-tracking/sources-list). |
| `dateFrom` (query) | string | yes | — | Period start, `YYYY-MM-DD`. |
| `dateTo` (query) | string | yes | — | Period end, `YYYY-MM-DD`. |
| `limit` (query) | number | no | `50` | Page size, an integer from 1 to 500. |
| `offset` (query) | number | no | `0` | Number of records to skip, a nonnegative integer. |

Pagination: each request returns one page without fetching subsequent pages automatically. Increase `offset` by `limit` to request the next page. Sorting, additional filters, and field selection are not supported.

A maximum of 100 unique sources is allowed. Bitrix24 validates the source count limit and the permitted period.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/crm-tracking/analytics/sources?sourceIds=2,3&dateFrom=2026-10-01&dateTo=2026-10-07&limit=50&offset=0" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/crm-tracking/analytics/sources?sourceIds=2,3&dateFrom=2026-10-01&dateTo=2026-10-07&limit=50&offset=0" \
  -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/analytics/sources?sourceIds=2,3&dateFrom=2026-10-01&dateTo=2026-10-07&limit=50&offset=0', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})
const result = await res.json()
console.log(result)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-tracking/analytics/sources?sourceIds=2,3&dateFrom=2026-10-01&dateTo=2026-10-07&limit=50&offset=0', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const result = await res.json()
console.log(result)
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | `true` |
| `data` | array | Source metrics. |
| `data[].sourceId` | number | Source ID from the [source list](/docs/entities/crm-tracking/sources-list). |
| `data[].dateFrom` | string | Period start, `YYYY-MM-DD`. |
| `data[].dateTo` | string | Period end, `YYYY-MM-DD`. |
| `data[].currencyId` | string | Bitrix24 accounting currency code. |
| `data[].stages` | array | Metrics by stage. |
| `data[].stages[].code` | string | Stage code. |
| `data[].stages[].quantity` | number | Quantity at the stage. |
| `data[].stages[].sum` | number | Stage amount in `currencyId`. |
| `data[].stages[].views` | number | Number of views. |
| `data[].cost` | number | Expenses in `currencyId`. |
| `data[].income` | number | Income in `currencyId`. |
| `data[].roi` | number | Return on investment as a percentage. |
| `meta.limit` | number | Requested page size. |
| `meta.offset` | number | Number of records to skip. |

The response does not include a total record count.

## Response example

Response shape example.

```json
{
  "success": true,
  "data": [
    {
      "sourceId": 2,
      "dateFrom": "2026-10-01",
      "dateTo": "2026-10-07",
      "currencyId": "USD",
      "stages": [
        {
          "code": "actions",
          "quantity": 1,
          "sum": 12.5,
          "views": 2
        }
      ],
      "cost": 12.5,
      "income": 0,
      "roi": -100
    }
  ],
  "meta": {
    "limit": 50,
    "offset": 0
  }
}
```

## Error response example

400 — source list not supplied:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_REQUIRED_FIELDS",
    "message": "sourceIds is required"
  }
}
```

## Errors

| HTTP | Code | Description |
|---|---|---|
| 400 | `MISSING_REQUIRED_FIELDS` | `sourceIds`, `dateFrom`, or `dateTo` was not supplied. An empty `sourceIds` also counts as missing. |
| 400 | `INVALID_PARAMS` | Invalid ID list, date format, or pagination parameters. |
| 400 | `UNKNOWN_FILTER_FIELD` | An unsupported parameter, filter, sort, or field selection was supplied. |
| 403 | `SCOPE_DENIED` | The key lacks the `crm` scope. |
| 401 | `TOKEN_MISSING` | The key has no configured tokens. |
| 422 | `METHOD_NOT_YET_AVAILABLE` | The flag is off or the method is not enabled in the account. `error.release` is `crm 26.2100.0`. |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 returned an invalid list structure. |

Other Bitrix24 refusal codes, HTTP statuses, and messages are preserved, with secret values removed from text. For common API errors, see [Errors](/docs/errors).

## Known specifics

Metrics, monetary values, and accounting currency pass through from Bitrix24 without conversion. The API does not recalculate return on investment. Secret data is removed from text values.

## See also

- [List analytics sources](/docs/entities/crm-tracking/sources-list)
- [List analytics source expenses](/docs/entities/crm-tracking/expenses-list)
