[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fsharing\u002Fjoin":3,"docs-tabs-chats\u002Fsharing\u002Fjoin":6},{"content":4,"lastmod":5},"## Join a chat by code\n\n`POST \u002Fv1\u002Fchats\u002Fjoin-by-code`\n\nAdds you to the chat that the link with this code leads to. The code comes from the chat's primary link or from a member's individual link.\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `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 |\n\nOther body fields and query parameters are rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fjoin-by-code\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"code\": \"Xk9pQ2mZ7rT4vB1c\"}'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fjoin-by-code\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"code\": \"Xk9pQ2mZ7rT4vB1c\"}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fjoin-by-code', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ code: 'Xk9pQ2mZ7rT4vB1c' }),\n})\n\nconst { data } = await res.json()\nconsole.log('Dialog:', data.dialogId)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fjoin-by-code', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ code: 'Xk9pQ2mZ7rT4vB1c' }),\n})\n\nconst { data } = await res.json()\nconsole.log('Dialog:', data.dialogId)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.dialogId` | string | The chat's dialog ID in the `chatXXX` format — for [reading messages](\u002Fdocs\u002Fchats\u002Fmessages\u002Flist) and [sending](\u002Fdocs\u002Fchats\u002Fmessages\u002Fsend) |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"dialogId\": \"chat42\"\n  }\n}\n```\n\n## Error response example\n\n422 — the link is revoked:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"SHARING_LINK_REVOKED\",\n    \"b24Code\": \"SHARING_LINK_REVOKED\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 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 |\n| 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 |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 answered with an unspecified \"not found\" code; the portal code is in `error.b24Code` |\n| 403 | `BITRIX_ACCESS_DENIED` | No right to join chats — Bitrix24 refused with the `ACCESS_DENIED` code |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](\u002Fdocs\u002Faccess-rights) |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n\nThe full list of general API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**Joining again changes nothing.** If you are already a chat member, the call returns the same `dialogId` and does not change the chat membership.\n\n## See also\n\n- [Get an individual chat link](\u002Fdocs\u002Fchats\u002Fsharing\u002Findividual-link)\n- [Get a link by code](\u002Fdocs\u002Fchats\u002Fsharing\u002Flink-get)\n- [List members](\u002Fdocs\u002Fchats\u002Fmembers\u002Flist)\n- [Links and guests](\u002Fdocs\u002Fchats\u002Fsharing)\n","2026-10-15",{},1794739554277]