> **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`. This is not an integration error: the update has not reached your Bitrix24 account yet.

## Get an advertising authorization link

`GET /v1/crm-tracking/sources/:id/ad-account/authorization`

Get a link to authorize access to advertising accounts for an analytics source.

Requires the `crm` scope and the `crm-tracking-v3` flag. A `READWRITE` key is required even though this operation uses GET.

## Parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` (path) | number | yes | Positive integer source ID from [List analytics sources](/docs/entities/crm-tracking/sources-list). |

Query parameters and request bodies are not supported.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/ad-account/authorization" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/ad-account/authorization" \
  -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/sources/2/ad-account/authorization', {
  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/sources/2/ad-account/authorization', {
  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` on success. |
| `data` | object | Authorization link. |
| `data.url` | string | Authorization URL, preserved byte for byte, including `state` and `code`. Open it to complete authorization. |

## Response example

```json
{
  "success": true,
  "data": {
    "url": "https://ads.example.com/oauth?client_id=example&state=DUMMY_STATE&code=DUMMY_CODE"
  }
}
```

## Error response example

400 — the source does not support advertising accounts:

```json
{
  "success": false,
  "error": {
    "code": "CRM_TRACKING_AD_PROVIDER_UNSUPPORTED",
    "message": "CRM_TRACKING_AD_PROVIDER_UNSUPPORTED"
  }
}
```

## Errors

| HTTP | Code | Description |
|---|---|---|
| 400 | `CRM_TRACKING_AD_PROVIDER_UNSUPPORTED` | The source does not support advertising account operations. |
| 400 | `INVALID_PARAMS` | The path ID is not a positive safe integer, or a request body was supplied. |
| 400 | `UNKNOWN_FILTER_FIELD` | An unsupported query parameter was supplied. |
| 404 | `ENTITY_NOT_FOUND` | The source was not found or is unavailable. |
| 403 | `SCOPE_DENIED` | The key lacks the `crm` scope. |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key has `READONLY` access. |
| 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 Bitrix24 account. `error.release` is `crm 26.2100.0`. |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 returned an invalid response. |

Other Bitrix24 refusal codes, HTTP statuses, and messages are preserved. Common API errors: [Errors](/docs/errors).

## See also

- [End-to-end analytics](/docs/entities/crm-tracking)
- [List analytics sources](/docs/entities/crm-tracking/sources-list)
- [List advertising accounts](/docs/entities/crm-tracking/ad-account-list)
- [Connect an advertising account](/docs/entities/crm-tracking/ad-account-connect)
