For AI agents: markdown of this page — /docs-content-en/openlines/send-form.md documentation index — /llms.txt

Send a CRM form to a customer

POST /v1/openlines/sessions/send-form

Sends a CRM form into an Open Channel dialog. The customer receives a real message. Bitrix24 checks the current user's access to the chat.

Requires both imopenlines and crm scopes and a key with write access.

Request fields (body)

Field Type Req. Description
FieldsessionId Typeinteger Req.yes DescriptionPositive Open Channel session ID, not a chatId. Search: POST /v1/openlines/sessions/search
FieldformId Typeinteger Req.yes DescriptionPositive CRM form ID. List: GET /v1/crm-forms

Only these two fields are accepted. The server resolves the form code, name and public security code. Retrieving this metadata may generate missing JavaScript loaders for forms in Bitrix24.

Examples

curl — personal key

Terminal
curl -X POST 'https://vibecode.bitrix24.com/v1/openlines/sessions/send-form' \
  -H 'X-Api-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"sessionId":9,"formId":8}'

curl — OAuth application

Terminal
curl -X POST 'https://vibecode.bitrix24.com/v1/openlines/sessions/send-form' \
  -H 'X-Api-Key: YOUR_APP_KEY' \
  -H 'Authorization: Bearer USER_SESSION_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"sessionId":9,"formId":8}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/sessions/send-form', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ sessionId: 9, formId: 8 }),
})
const { data } = await res.json()
console.log(data.sent)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/sessions/send-form', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ sessionId: 9, formId: 8 }),
})
const { data } = await res.json()
console.log(data.sent)

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.sent Typeboolean DescriptionAlways true: Bitrix24 accepted the send call

Response example

JSON
{
  "success": true,
  "data": {
    "sent": true
  }
}

Error response example

404 — session not found:

JSON
{
  "success": false,
  "error": {
    "code": "NO_SESSION_ERROR",
    "message": "Error getting session info"
  }
}

Errors

HTTP Code Description
HTTP400 CodeMISSING_REQUIRED_FIELDS DescriptionsessionId or formId is missing
HTTP400 CodeINVALID_PARAMS DescriptionThe body is not a JSON object, a field other than sessionId and formId was passed, or an ID is not a positive integer
HTTP400 CodeSESSION_ID_EMPTY DescriptionBitrix24 rejected the request: the session ID was not passed
HTTP400 CodeFORM_INFO_EMPTY DescriptionBitrix24 rejected the request: the form data is missing
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the imopenlines or crm scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only
HTTP403 CodeACCESS_ERROR DescriptionBitrix24 denied access to the dialog
HTTP404 CodeNO_SESSION_ERROR DescriptionNo session with this sessionId
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo form with this formId in the Bitrix24 account. The message text comes from Bitrix24
HTTP404 CodeENTITY_NOT_FOUND DescriptionThe form exists but is missing from the account's form list. The message is CRM form not found
HTTP502 CodeBITRIX_RESPONSE_INVALID DescriptionBitrix24 returned invalid form data or did not confirm the send

Bitrix24 refusal messages are passed through unchanged. For common refusals, see Limits and optimization. For the full list of common API errors, see Errors.

Known specifics

sent does not confirm delivery. The field means Bitrix24 accepted the call, not that the customer received the message. Internal form codes are not returned.

A retry after a failure may send a duplicate. If no response arrived or the response was 502 BITRIX_RESPONSE_INVALID, the form may already have reached the customer. Check the dialog before retrying, or the customer will receive the form twice.

See also