For AI agents: markdown of this page — /docs-content-en/chats/sharing/join.md documentation index — /llms.txt
Join a chat by code
POST /v1/chats/join-by-code
Adds you to the chat that the link with this code leads to and returns the dialog ID. The code comes from the chat's primary link or from a member's individual link.
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
code |
string | yes | The link code — the code field of the link object or the IM_CODE parameter of its address. From 1 to 64 printable characters without spaces |
Other body fields and query parameters are rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/chats/join-by-code" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"code": "Xk9pQ2mZ7rT4vB1c"}'
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/chats/join-by-code" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"code": "Xk9pQ2mZ7rT4vB1c"}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/join-by-code', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ code: 'Xk9pQ2mZ7rT4vB1c' }),
})
const { data } = await res.json()
console.log('Dialog:', data.dialogId)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/join-by-code', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({ code: 'Xk9pQ2mZ7rT4vB1c' }),
})
const { data } = await res.json()
console.log('Dialog:', data.dialogId)
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data.dialogId |
string | The chat's dialog ID in the chatXXX format — for reading messages and sending |
Response example
{
"success": true,
"data": {
"dialogId": "chat42"
}
}
Error response example
422 — the link is revoked:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "SHARING_LINK_REVOKED",
"b24Code": "SHARING_LINK_REVOKED"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS |
No code, a code that does not look like a link code, a body that is not an object, another body field or a query parameter. Checked before any call to Bitrix24 |
| 422 | BITRIX_ERROR |
Bitrix24 returned an error; the portal code is in error.b24Code. SHARING_LINK_REVOKED — the link is revoked, SHARING_LINK_EXPIRED — the link expired, SHARING_LINK_USES_LIMIT_REACHED — its use limit was reached, SHARING_LINK_NOT_FOUND — no link with this code exists |
| 404 | ENTITY_NOT_FOUND |
Bitrix24 answered with an unspecified "not found" code; the portal code is in error.b24Code |
| 403 | BITRIX_ACCESS_DENIED |
No right to join chats — Bitrix24 refused with the ACCESS_DENIED code |
| 403 | SCOPE_DENIED |
The API key does not have the im scope |
| 403 | WRITE_BLOCKED_READONLY_KEY |
The key is read-only — see access rights |
| 401 | TOKEN_MISSING |
The API key has no Bitrix24 tokens configured |
The full list of general API errors — Errors.
Known specifics
Joining again changes nothing. If you are already a chat member, the call returns the same dialogId and does not change the chat membership.