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

Lead from a dialog

Scope: imopenlines. Writes require a write-enabled key. Bitrix24 checks user permissions.

POST /v1/openlines/dialogs/:chatId/lead

POST /v1/openlines/dialogs/:chatId/lead

Bitrix24 returns true even when any CRM card is already linked. After the call the wrapper reads the dialog binding and returns { chatId, crmEntityType, crmEntityId, leadId }. When the existing binding is a deal, company or contact, it remains and leadId is null. A true response with no readable binding returns 502; the action may have completed, so read the dialog before repeating it.

Example

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/openlines/dialogs/123/lead" \
  -H "X-Api-Key: YOUR_API_KEY"

Response:

JSON
{
  "success": true,
  "data": {
    "chatId": 123,
    "crmEntityType": "lead",
    "crmEntityId": 42,
    "leadId": 42
  }
}

Errors

400 INVALID_PARAMS / INVALID_CHAT_ID / MISSING_REQUIRED_FIELDS, 401 TOKEN_MISSING, 403 SCOPE_DENIED / WRITE_BLOCKED_READONLY_KEY / BITRIX_ACCESS_DENIED, 404 ENTITY_NOT_FOUND, 422 BITRIX_ERROR, 429, 502 OPENLINE_OPERATOR_FAILED / BITRIX_UNAVAILABLE, 503.