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

Documentation articles are currently available in English.

Workflows

A workflow is a multi-step scenario that runs on a Bitrix24 document. Unlike CRM triggers, which change an entity's state instantly, a workflow can include pauses to wait for external events, conditional branching, parallel branches, and delays. Typical scenarios: approval chains, automatic document preparation, scheduled notifications.

Lifecycle: launch (start) → execution → instance inspection (list) → pause handling via an event (event) or a log entry (activity-log) → termination (terminate).

Bitrix24 API: bizproc.workflow.*, bizproc.event.*, bizproc.activity.* Scope: bizproc

Start a workflow

POST /v1/workflows/start

Starts a workflow instance from a template for a CRM entity, a list element or another Bitrix24 document. The document is given in one of two shapes: a type and ID for a deal, lead, contact or company, or an explicit Bitrix24 document identifier for everything else.

Request fields (body)

Pass templateId and exactly one document shape. A body that carries entityType or entityId together with documentId is rejected with 400 CONFLICTING_PARAMS.

Field Type Required Description
templateId number yes Workflow template ID. Source: GET /v1/bizproc-templates
entityType string no CRM entity type: deal, lead, contact, company. Required together with entityId when documentId is not passed
entityId number no CRM entity ID. Required together with entityType when documentId is not passed. Source: GET /v1/deals, GET /v1/leads, GET /v1/contacts, GET /v1/companies
documentId array no Bitrix24 document as an array of three non-empty strings [module, class, identifier]. Required when entityType and entityId are not passed. The module is crm, lists or disk. Pass the identifier as a string: a number in the third element is rejected. Values for CRM and lists are in the table below
parameters object no Template parameter values. The set of fields is defined by the specific template in Bitrix24

documentId values by module:

Module Class Identifier Example
crm CCrmDocumentDeal, CCrmDocumentLead, CCrmDocumentContact, CCrmDocumentCompany Type prefix plus entity ID: DEAL_5141, LEAD_12 ["crm", "CCrmDocumentDeal", "DEAL_5141"]
lists Bitrix\Lists\BizprocDocumentLists List element ID. Source: GET /v1/lists/:iblockId/elements ["lists", "Bitrix\\Lists\\BizprocDocumentLists", "7147"]

The class and the identifier are passed to Bitrix24 unchanged. In JSON, escape the backslash in the class name by doubling it, as in the lists example.

Examples

curl — personal key

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/workflows/start \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"templateId":713,"entityType":"deal","entityId":5141}'

curl — OAuth application

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/workflows/start \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"templateId":713,"entityType":"deal","entityId":5141}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/workflows/start', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    templateId: 713,
    entityType: 'deal',
    entityId: 5141,
  }),
})
const data = await res.json()
console.log(data.data.workflowId)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/workflows/start', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    templateId: 713,
    entityType: 'deal',
    entityId: 5141,
  }),
})
const data = await res.json()

Response fields

Field Type Description
success boolean true on a successful start
data.workflowId string Unique identifier of the started workflow instance

Response example

HTTP 201 Created

JSON
{
  "success": true,
  "data": {
    "workflowId": "69f0c2d5ade389.22457798"
  }
}

Error response example

400 — both document shapes in one body:

JSON
{
  "success": false,
  "error": {
    "code": "CONFLICTING_PARAMS",
    "message": "Pass either { entityType, entityId } OR { documentId }, not both. Pick the shape that matches your target document namespace."
  }
}

Errors

HTTP Code Description
400 MISSING_PARAMS templateId was not provided
400 MISSING_PARAMS documentId was not provided and the CRM shape is incomplete: entityType or entityId is missing
400 CONFLICTING_PARAMS entityType or entityId was passed together with documentId
400 INVALID_DOCUMENT_ID documentId is not an array, does not have three elements, or one of the elements is empty or not a string
400 INVALID_DOCUMENT_ID The module in documentId is not crm, lists or disk
400 INVALID_ENTITY_TYPE entityType is not deal, lead, contact or company. For other documents, use documentId
401 MISSING_API_KEY The X-Api-Key header was not provided
401 INVALID_API_KEY The key is not recognized — no such key exists on the platform
401 TOKEN_MISSING The key has no connected Bitrix24 tokens
401 TOKEN_EXPIRED The OAuth user session expired — re-authorize via /v1/oauth/authorize
403 SCOPE_DENIED The key is missing the bizproc scope
403 BITRIX_ACCESS_DENIED Bitrix24 denied access
409 BIZPROC_MODULE_NOT_ENABLED Business Processes are not available on the account: the module is not included in the plan, or it is switched off in account settings. Ask an account administrator to enable Business Processes — until then the method answers the same way for any number of retries
422 BITRIX_ERROR No template with the given templateId was found. message is Template not found
422 BITRIX_ERROR The class in documentId does not match the template's document type. message is Template type and DOCUMENT_ID mismatch!
429 RATE_LIMITED Request limit exceeded. Retry in 1–2 seconds
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable

Full list of common API errors — Errors.

Known specifics

  • One template — multiple instances. The same templateId can be started for different entities simultaneously. Each start receives its own unique workflowId.
  • A repeated call starts another instance. A request with the same body is not rejected and does not return the already running workflow: every 201 means a new instance on the same document. If a request may have gone through but the response was lost, check the list of running workflows before retrying. It shows only active instances: a workflow that has already finished does not appear there.
  • The document class must match the template. A template is bound to a document type, and the class in documentId must match it. For an element of an ordinary list it is Bitrix\Lists\BizprocDocumentLists. On a mismatch the response is 422 BITRIX_ERROR.

See also