For AI agents: markdown of this page — /docs-content-en/chats/messages/forward.md documentation index — /llms.txt

Forward messages

POST /v1/chats/:dialogId/forward

Forwards up to 20 messages to a chat, optionally with a comment.

Parameters

Parameter Type Required Default Description
ParameterdialogId (path) Typestring Requiredyes Default— DescriptionID of the dialog the messages go to: numeric user ID for personal messages, chatXXX for group chats. The special me alias refers to the current user's personal dialog. chatXXX is the id field of a recent dialogs row; a user ID comes from the user list

Request body fields

Field Type Required Description
FieldforwardIds Typeobject Requiredyes DescriptionWhat to forward: the key is a client UUID v4 in lower case, the value is the ID of the message to forward, from the chat feed. From 1 to 20 entries; each message can appear only once
Fieldmessage Typestring Requiredno DescriptionA comment posted before the forwarded messages, up to 20000 Unicode code points. Must pass the blank-comment check below
FieldtemplateId Typestring Requiredno DescriptionClient ID of the comment, up to 255 characters. Returned in push events. Accepted only together with message

Any other body field and any query parameter are rejected with 400 INVALID_PARAMS.

For a valid non-blank comment, the complete outgoing string is counted, including markup, URLs and mentions, without truncation or trimming. For example, 😀 is one code point, while a compound emoji may occupy several. A comment longer than 20000 code points is rejected with 400 MESSAGE_TOO_LONG before any Bitrix24 call, including resolving me.

The existing input checks run before the length check. When supplied, message must be a string and contain something besides spaces, tabs, line feeds, carriage returns, NUL characters and vertical tabs. Otherwise, the request returns 400 INVALID_PARAMS, even when the string exceeds 20000 code points. Invalid forwardIds, templateId and disallowed fields also retain their priority. Omitting message still forwards without a comment.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat42/forward" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"forwardIds":{"3f2b8c1e-5d4a-4b6f-9e7d-1a2b3c4d5e6f":1001},"message":"Please take a look"}'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat42/forward" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"forwardIds":{"3f2b8c1e-5d4a-4b6f-9e7d-1a2b3c4d5e6f":1001},"message":"Please take a look"}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/forward', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"forwardIds":{"3f2b8c1e-5d4a-4b6f-9e7d-1a2b3c4d5e6f":1001},"message":"Please take a look"}),
})

const { data } = await res.json()
console.log('Forwarded:', Object.keys(data.uuidMap).length)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/forward', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"forwardIds":{"3f2b8c1e-5d4a-4b6f-9e7d-1a2b3c4d5e6f":1001},"message":"Please take a look"}),
})

const { data } = await res.json()
console.log('Forwarded:', Object.keys(data.uuidMap).length)

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.id Typenumber | null DescriptionID of the comment. null when there was no comment
Fielddata.uuidMap Typeobject DescriptionUUID from the request → ID of the message copy in the chat. Exactly what is listed here was forwarded
Fielddata.failureMap Typeobject | array DescriptionUUID → Bitrix24 refusal code for the messages that could not be forwarded. An empty array [] when nothing was refused. Returned starting with im 26.1300
Fielddata.legacyFailureMap Typeobject DescriptionMessage ID → refusal code for messages without a client UUID. Returned starting with im 26.1300, and only when non-empty

Response example

JSON
{
  "success": true,
  "data": {
    "id": 1100,
    "uuidMap": {
      "3f2b8c1e-5d4a-4b6f-9e7d-1a2b3c4d5e6f": 1101
    },
    "failureMap": []
  }
}

Error response example

400 — a forwardIds key is not a lower-case UUID v4:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Every key of `forwardIds` must be a UUID v4 in lower case. `forwardIds` is required: an object mapping a client UUID v4 (lower case) to the id of a message to forward, e.g. {\"3f2b8c1e-5d4a-4b6f-9e7d-1a2b3c4d5e6f\": 1001}."
  }
}

Errors

HTTP Code Description
HTTP400 CodeMESSAGE_TOO_LONG DescriptionAfter the other input checks, a valid non-blank comment exceeds 20000 Unicode code points. error.details contains only field: "message", used, limit: 20000, unit: "unicode-code-points". No Bitrix24 call is made
HTTP400 CodeINVALID_PARAMS DescriptionNo forwardIds, it is not an object, it has no entries or more than 20. A key is not a lower-case UUID v4. A value is not a positive integer. The same message is listed twice. message is blank or not a string. templateId without message or longer than 255 characters. Any other body field or any query parameter. Checked before any call to Bitrix24
HTTP404 CodeENTITY_NOT_FOUND DescriptionBitrix24 reported "not found". The portal code is in error.b24Code
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 returned an error. The code is in error.b24Code: MESSAGE_NOT_FOUND — one of the messages does not exist, in which case nothing is forwarded. CHAT_NOT_FOUND — the target chat does not exist
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the im scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only, and forwarding posts messages — see access rights
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no Bitrix24 tokens configured
HTTP502 CodeME_ALIAS_RESOLUTION_FAILED DescriptionThe me alias could not be resolved: Bitrix24 returned no ID of the current user. Nothing was sent to the chat

The full list of common API errors — Errors.

Known specifics

200 does not mean "everything was forwarded". If the key's user cannot forward a message, that message is skipped instead of the whole call being rejected. Starting with im 26.1300, the skipped messages are listed with their refusal code in data.failureMap. On earlier versions these fields are absent and the skip is silent — compare the request with uuidMap.

The UUID identifies the copy on the client side. Use it to find the copy in the response and in push events before the copy's ID is known.

Repeating with the same UUID does not create a second copy. The UUID of a forwarded message is remembered for about a month, and a repeated request returns the ID of the existing copy in uuidMap. A request whose response was lost can therefore be safely repeated with the same forwardIds. For a new forward, generate a new UUID — for example, crypto.randomUUID().

See also