# Send a CRM form to a customer

`POST /v1/openlines/sessions/send-form`

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

Requires BOTH `imopenlines` and `crm` scopes and a READWRITE key.

## Parameters

| Body field | Type | Required | Description |
|---|---|---|---|
| `sessionId` | integer | yes | Positive session ID from [session search](/docs/openlines/sessions/search); this is not a `chatId` |
| `formId` | integer | yes | Positive [CRM form ID](/docs/entities/crm-forms/list) |

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.

## Example

```bash
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}'
```

For an OAuth application, use its key and the `Authorization: Bearer USER_SESSION_TOKEN` header.

Success is HTTP 200:

```json
{"success":true,"data":{"sent":true}}
```

`sent` acknowledges that Bitrix24 accepted the call, not that the customer received the message. Internal form codes are not returned. Do not retry blindly after an ambiguous failure: it may send a duplicate message.

## Errors

| HTTP | Code | Reason |
|---|---|---|
| 400 | `MISSING_REQUIRED_FIELDS` | Missing `sessionId` or `formId` |
| 400 | `INVALID_PARAMS` | Invalid id, body or an extra parameter |
| 400 | `SESSION_ID_EMPTY`, `FORM_INFO_EMPTY` | Bitrix24 parameter refusal |
| 403 | `SCOPE_DENIED` | Missing one of the two scopes |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | READONLY key |
| 403 | `ACCESS_ERROR` | Bitrix24 refused dialog access |
| 404 | `NO_SESSION_ERROR` | Session not found |
| 404 | `ENTITY_NOT_FOUND` | Form not found |
| 502 | `BITRIX_RESPONSE_INVALID` | Invalid Bitrix24 response |

Bitrix24 refusal messages are retained. See [limits](/docs/optimization) for common errors. To submit form data entered by a visitor, use [form results](/docs/entities/crm-forms/results).
