For AI agents: markdown of this page — /docs-content-en/bots/management/resubscribe.md documentation index — /llms.txt

Re-subscribe to events

POST /v1/bots/:botId/resubscribe

Restores the bot's subscription to Bitrix24 events. Use it when the bot is active but GET /v1/bots/:botId/events has stopped returning events. No request body is required.

Parameters

Parameter Type Required Description
ParameterbotId Typenumber Requiredyes DescriptionBot ID (path parameter)

Examples

curl — personal key

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/resubscribe \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/resubscribe \
  -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/bots/42/resubscribe', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
console.log(data) // { resubscribed: true, eventMode: 'fetch', b24EventMode: 'fetch', diverged: false, hint: '…' }

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/resubscribe', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typeobject DescriptionRe-subscription result
Fielddata.resubscribed Typeboolean Descriptiontrue on successful re-subscription
Fielddata.eventMode Typestring DescriptionThe event delivery mode stored by the platform: fetch or webhook
Fielddata.b24EventMode Typestring | null DescriptionThe delivery mode configured for the bot in Bitrix24 before the call: fetch or webhook. null means the Bitrix24 account did not report it
Fielddata.diverged Typeboolean Descriptiontrue when the mode in Bitrix24 differed from the stored one and the call aligned it. false when b24EventMode is null
Fielddata.hint Typestring DescriptionWhat the call did and what to check next

Response example

JSON
{
  "success": true,
  "data": {
    "resubscribed": true,
    "eventMode": "fetch",
    "b24EventMode": "fetch",
    "diverged": false,
    "hint": "Bitrix24 already had eventMode='fetch' for this bot, so this call rewrote the same value and did no subscription work — Bitrix24 rebinds only when the mode actually changes. A fetch-mode bot receives events only while Bitrix24's own eventMode is 'fetch', and b_rest_event subscriptions play no part in polling (they are a webhook-mode mechanism). If GET /v1/bots/42/events still returns an empty queue, the cause is upstream of the queue: confirm the bot is a participant of the chat where messages are sent, and that a mention-only (type='personal') bot is actually being mentioned."
  }
}

Error response example

409 — another change to the bot is still being reconciled with Bitrix24; the response carries the Retry-After: 30 header:

JSON
{
  "success": false,
  "error": {
    "code": "BOT_EFFECT_IN_PROGRESS",
    "message": "Another change to this bot is still being reconciled with Bitrix24",
    "retryAfter": 30
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_BOT_ID DescriptionbotId is not a number
HTTP404 CodeBOT_NOT_FOUND DescriptionBot not found
HTTP409 CodeBOT_RECOVERY_IN_PROGRESS DescriptionThe portal address changed after the bot was registered and the registration is being recovered. Nothing is sent to Bitrix24. Retry after the delay in the Retry-After: 5 header
HTTP409 CodeBOT_EFFECT_IN_PROGRESS DescriptionAnother change to the bot is still being reconciled with Bitrix24. Retry after the delay specified in the Retry-After header: 30 seconds, or, if the change is awaiting the next scheduled check, the time until that check (up to 300 seconds)
HTTP409 CodeBOT_UNAVAILABLE DescriptionThe bot's state must be repaired on the platform side. There is no Retry-After header and retrying will not help. Contact support and quote the request time
HTTP409 CodeBOT_ID_REPLACED DescriptionThe request uses a previous bot ID. Use the current ID from error.details.botId. No Retry-After header
HTTP409 CodeBOT_OAUTH_POLICY_INVALID DescriptionThe stored settings are incompatible with OAuth application ownership of the bot. No Retry-After header
HTTP409 CodeBOT_APP_EVENT_ENROLLMENT_REQUIRED DescriptionThe platform receiver requires a recent, verified INSTALL/placement of the bound application. No Retry-After header
HTTP409 CodeBOT_APP_EVENT_CONSUMER_REQUIRED DescriptionThe platform receiver requires a verified Agent or ManagedBot owner. No Retry-After header
HTTP409 CodeBOT_APP_EVENT_CREDENTIAL_CHANGED DescriptionThe application-event binding changed between admission and dispatch. Verify the application enrollment again before retrying. No Retry-After header
HTTP403 CodeBOT_ACCESS_DENIED DescriptionThe bot belongs to a different API key
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the imbot scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only — see access rights
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens

Full list of common API errors — Errors.

Known specifics

When to use. The bot is registered and active — messages arrive in chats and the bot appears in the GET /v1/bots list — but the event queue stays empty. A hint field in the GET /v1/bots/:botId/events response confirms the diagnosis, but its absence does not make the call unnecessary: the hint only shows up once the queue has stayed persistently empty. Re-subscription preserves the Open Channels and welcome-bot bindings, unlike re-registration via POST /v1/bots.

What the call actually repairs. Only aligning the mode restores delivery: diverged: true means the mode in Bitrix24 differed from the stored one and now matches it. With diverged: false and equal b24EventMode and eventMode, the call wrote the same value and did not change the event subscription. In that case, use the hint to find the cause of the empty queue: check whether the bot is in the chat and whether a personal bot is actually being mentioned. If the platform's stored mode is webhook and Bitrix24's mode was fetch, switching modes deletes unread events from the queue: retrieve them through GET /v1/bots/:botId/events before making the call.

Repeated calls are safe. Each request re-sends the bot's delivery mode to Bitrix24, so you can re-subscribe several times in a row.

Bitrix24 account address change. If the Bitrix24 account address changed after the bot was registered, the platform recovers the bot's registration and Open Channels bindings by itself. Until it finishes, event polling and every call that changes the bot, including re-subscription and deletion through DELETE /v1/bots/:botId, return 409 BOT_RECOVERY_IN_PROGRESS. Contact support if the recovery does not finish.

An address change made before this diagnostic became available does not produce a 409. If the address changed and re-subscription did not restore delivery: for a standalone Bot, delete the old registration through DELETE /v1/bots/:botId before reusing the same code, or register a new unique code, then restore the Open Channels and WELCOME_BOT bindings. The same code may reuse the old identity and does not guarantee a new bot ID. For a bot owned by an AI agent or a managed bot, do not call DELETE /v1/bots/:botId: use the owner resource's recovery lifecycle, or contact support if that recovery is unavailable.

webhook mode. For a bot with eventMode: "webhook", re-subscription also re-sends the stored webhook address.

See also