For AI agents: markdown of this page — /docs-content-en/entities/crm-tracking/ad-account-disconnect.md documentation index — /llms.txt
This method is rolling out with
crm 26.2100.0. It is not available on every Bitrix24 account yet. If the method is not yet available in your Bitrix24 account, the API returns422 METHOD_NOT_YET_AVAILABLE. This is not an integration error: the update has not reached your account yet.
Disconnect an advertising account
DELETE /v1/crm-tracking/sources/:id/ad-account
Disconnects an advertising account from an end-to-end analytics source and returns the resulting connection settings.
Requires the crm scope, a READWRITE key, the crm-tracking-v3 flag enabled, and the method available in the Bitrix24 account.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Parameterid (path) |
Typenumber | Requiredyes | DescriptionPositive integer source ID from the sources list. |
Omit the request body or send {}. Body fields and query parameters are not accepted.
Examples
curl — personal key
curl -X DELETE "https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/ad-account" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X DELETE "https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/ad-account" \
-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', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_API_KEY'
}
})
const { success, data } = await res.json()
console.log(data.sourceId)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-tracking/sources/2/ad-account', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN'
}
})
const { success, data } = await res.json()
console.log(data.sourceId)
Response fields
Success returns HTTP 200 with JSON.
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue on success. |
Fielddata |
Typeobject | DescriptionResulting connection settings. |
Fielddata.sourceId |
Typenumber | DescriptionSource ID from the sources list. |
Fielddata.provider |
Typestring | DescriptionAdvertising system code. |
Fielddata.clientId |
Typestring | null | DescriptionConnected client ID from the advertising accounts list or null. |
Fielddata.accountId |
Typestring | null | DescriptionConnected advertising account ID from the advertising accounts list or null. |
Response example
Example response structure.
{
"success": true,
"data": {
"sourceId": 2,
"provider": "google",
"clientId": null,
"accountId": null
}
}
Error response example
400 — the source does not support advertising account connections:
{
"success": false,
"error": {
"code": "CRM_TRACKING_AD_PROVIDER_UNSUPPORTED",
"message": "CRM_TRACKING_AD_PROVIDER_UNSUPPORTED"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionInvalid ID, non-object body, or a body with fields. |
| HTTP400 | CodeUNKNOWN_FILTER_FIELD |
DescriptionA query parameter was supplied. |
| HTTP400 | CodeCRM_TRACKING_AD_PROVIDER_UNSUPPORTED |
DescriptionThe source does not support this advertising operation. |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the crm scope. |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key access mode blocks writes. |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionThe specified source was not found. |
| HTTP422 | CodeMETHOD_NOT_YET_AVAILABLE |
DescriptionThe flag is off or the method is not yet available in the Bitrix24 account. |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 returned an invalid response. |
Other Bitrix24 refusal codes and messages are preserved. See Errors for shared API errors.