#Start a workflow

POST /v1/workflows/start

Starts a workflow instance from a template for the specified CRM entity. Returns the unique identifier of the started instance.

#Request fields (body)

Field Type Required Description
templateId number Workflow template ID. Source: GET /v1/entities/bizproc-templates
entityType string CRM entity type: deal, lead, contact, company
entityId number CRM entity ID. Source: GET /v1/deals, GET /v1/leads, GET /v1/contacts, GET /v1/companies
parameters object no Template parameter values. The set of fields is defined by the specific template in Bitrix24

#Examples

#curl — personal key

Terminal
curl -X POST https://vibecode.bitrix24.tech/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.tech/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.tech/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.tech/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 — required parameters not provided:

JSON
{
  "success": false,
  "error": {
    "code": "MISSING_PARAMS",
    "message": "Required: templateId (number), entityType (\"deal\"|\"lead\"|\"contact\"|\"company\"), entityId (number)"
  }
}

#Errors

HTTP Code Description
400 MISSING_PARAMS One or more required parameters were not provided: templateId, entityType, entityId
401 MISSING_API_KEY The X-Api-Key header was not provided
401 INVALID_API_KEY Invalid or expired API key
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
422 BITRIX_ERROR Error on the Bitrix24 side — for example, no template with the given templateId was found
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.

#See also