For AI agents: markdown of this page — /docs-content-en/entities/crm-tracking/ad-account-authorization.md documentation index — /llms.txt
The method ships in the
crm 26.2100.0update and is not yet available on all Bitrix24 accounts. If the method is not enabled yet, the API returns422 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 |
|---|---|---|---|
Parameterid (path) |
Typenumber | Requiredyes | DescriptionPositive integer source ID from List analytics sources. |
Query parameters and request bodies are not supported.
Examples
curl — personal key
curl "https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/ad-account/authorization" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
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
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
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 |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue on success. |
Fielddata |
Typeobject | DescriptionAuthorization link. |
Fielddata.url |
Typestring | DescriptionAuthorization URL, preserved byte for byte, including state and code. Open it to complete authorization. |
Response example
{
"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:
{
"success": false,
"error": {
"code": "CRM_TRACKING_AD_PROVIDER_UNSUPPORTED",
"message": "CRM_TRACKING_AD_PROVIDER_UNSUPPORTED"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeCRM_TRACKING_AD_PROVIDER_UNSUPPORTED |
DescriptionThe source does not support advertising account operations. |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionThe path ID is not a positive safe integer, or a request body was supplied. |
| HTTP400 | CodeUNKNOWN_FILTER_FIELD |
DescriptionAn unsupported query parameter was supplied. |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionThe source was not found or is unavailable. |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the crm scope. |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key has READONLY access. |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no configured tokens. |
| HTTP422 | CodeMETHOD_NOT_YET_AVAILABLE |
DescriptionThe flag is off or the method is not enabled in the Bitrix24 account. error.release is crm 26.2100.0. |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 returned an invalid response. |
Other Bitrix24 refusal codes, HTTP statuses, and messages are preserved. Common API errors: Errors.