For AI agents: markdown of this page — /docs-content-en/automation.md documentation index — /llms.txt
CRM Automation
Fire CRM triggers and start workflows via the API. Automate your sales funnel, move deals through stages, and launch approval chains programmatically.
Scope: crm (triggers), bizproc (workflows) | Base URL: https://vibecode.bitrix24.com/v1 | Authorization: X-Api-Key
Documentation sections
- Triggers — firing CRM triggers for entities (2 endpoints).
- Workflows — starting, monitoring, and managing workflows (5 endpoints).
Quick start
Fire a CRM trigger
curl -X POST https://vibecode.bitrix24.com/v1/triggers/fire \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entityType": "deal",
"entityId": 100,
"triggerId": "payment_received"
}'
Response:
{
"success": true,
"data": true
}
Full documentation of parameters and error codes: POST /v1/triggers/fire
Start a workflow
curl -X POST https://vibecode.bitrix24.com/v1/workflows/start \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"templateId": 15,
"entityType": "deal",
"entityId": 100,
"parameters": {
"approver": 1,
"comment": "15% discount approval"
}
}'
Response:
{
"success": true,
"data": {
"workflowId": "67a1b2c3d4e5f6"
}
}
Full documentation of parameters and error codes: POST /v1/workflows/start
Full example
Scenario: a deal moved to the "Paid" stage — we fire a CRM trigger, then start a document-preparation workflow, send an event to continue a suspended process, and terminate an unneeded instance.
const VIBE_KEY = process.env.VIBE_KEY
const BASE = 'https://vibecode.bitrix24.com/v1'
async function api(method, path, body = null) {
const opts = {
method,
headers: { 'X-Api-Key': VIBE_KEY }
}
if (body) {
opts.headers['Content-Type'] = 'application/json'
opts.body = JSON.stringify(body)
}
const res = await fetch(`${BASE}${path}`, opts)
return res.json()
}
const dealId = 100
// 1. Deal paid — fire a CRM trigger
await api('POST', '/triggers/fire', {
entityType: 'deal',
entityId: dealId,
triggerId: 'payment_received'
})
console.log('Trigger "Payment received" fired')
// 2. Start the document-preparation workflow
const { data: wf } = await api('POST', '/workflows/start', {
templateId: 22,
entityType: 'deal',
entityId: dealId,
parameters: {
docType: 'act',
sendToClient: true
}
})
console.log('Workflow started:', wf.workflowId)
// 3. List running instances by template
const { data: instances, meta } = await api('GET', '/workflows?templateId=22')
console.log(`Active processes for template 22: ${meta.total}`)
for (const instance of instances) {
console.log(` ${instance.ID}: started=${instance.STARTED}`)
}
// 4. Send an event to a suspended process
// eventToken arrives at the handler of a registered activity from the B24 callback
// (see /docs/entities/bizproc-activities), here it is an illustrative value
await api('POST', '/workflows/event', {
eventToken: '55c1dc1c3f0d75.67',
returnValues: { approved: true },
logMessage: 'Automatic confirmation — amount within the limit'
})
console.log('Event sent, process continued')
// 5. Terminate the unneeded instance
await fetch(`${BASE}/workflows/${wf.workflowId}`, {
method: 'DELETE',
headers: { 'X-Api-Key': VIBE_KEY }
})
console.log('Process terminated')
Endpoint reference
| Method | Path | Bitrix24 method | Scope | Description |
|---|---|---|---|---|
| MethodPOST | Path/v1/triggers/fire |
Bitrix24 methodcrm.automation.trigger | Scopecrm | DescriptionFire a CRM trigger |
| MethodGET | Path/v1/triggers |
Bitrix24 methodcrm.automation.trigger.list | Scopecrm | DescriptionList Bitrix24 account triggers |
| MethodPOST | Path/v1/workflows/start |
Bitrix24 methodbizproc.workflow.start | Scopebizproc | DescriptionStart a workflow |
| MethodGET | Path/v1/workflows |
Bitrix24 methodbizproc.workflow.instances | Scopebizproc | DescriptionList running processes |
| MethodDELETE | Path/v1/workflows/:id |
Bitrix24 methodbizproc.workflow.terminate / kill | Scopebizproc | DescriptionTerminate a workflow |
| MethodPOST | Path/v1/workflows/event |
Bitrix24 methodbizproc.event.send | Scopebizproc | DescriptionSend an event to a process |
| MethodPOST | Path/v1/workflows/activity-log |
Bitrix24 methodbizproc.activity.log | Scopebizproc | DescriptionWrite to the process log |
Error codes
Automation errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_ENTITY_TYPE |
DescriptionTriggers: unknown entity type in entityType. Supported: deal, lead, contact, company, quote, invoice, item |
| HTTP400 | CodeINVALID_ENTITY_TYPE |
DescriptionWorkflows: entityType is not deal, lead, contact or company. For other documents, the start call accepts documentId |
| HTTP400 | CodeCONFLICTING_PARAMS |
DescriptionStarting a workflow: entityType or entityId was passed together with documentId |
| HTTP400 | CodeINVALID_DOCUMENT_ID |
DescriptionStarting a workflow: documentId is not an array of three non-empty strings, or its module is not crm, lists or disk |
| HTTP400 | CodeMISSING_PARAMS |
DescriptionRequired parameters not provided (listed in the response message field) |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionInvalid parameter value (returned by Bitrix24) |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe API key has no configured Bitrix24 tokens |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe API key lacks the required scope: crm for triggers, bizproc for workflows |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionThe Bitrix24 portal rejected the operation — insufficient permissions on the portal side |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionThe entity or template with the given ID was not found |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 REST API error (details in the message field) |
| HTTP429 | CodeRATE_LIMITED |
DescriptionRequest limit exceeded. Wait 1–2 seconds and retry |
| HTTP429 | CodeQUEUE_TIMEOUT |
DescriptionThe request to Bitrix24 waited in the queue longer than 80 seconds. The request was NOT sent to Bitrix24 — safe to retry (Retry-After) |
| HTTP500 | CodeINTERNAL_ERROR |
DescriptionInternal server error |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionThe Bitrix24 portal is unavailable |
| HTTP503 | CodeBITRIX_TIMEOUT |
DescriptionBitrix24 accepted the request but did not respond within 60 seconds. For write operations, re-read the entity first: the change may have been applied |
Full reference of common errors: Errors.