لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/automation/triggers.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
Triggers
A CRM trigger is an automation condition bound to a specific pipeline stage. When you fire a trigger through the API for a particular entity, Bitrix24 runs every automation rule and action configured on the matching pipeline step: sends notifications, changes the stage, launches workflows.
Get the list of available triggers and their codes through GET /v1/triggers — the CODE field of the response is the triggerId. Use triggers when an external system — a payment gateway, an accounting system, or a CRM integration — needs to notify Bitrix24 that a certain event has occurred.
Bitrix24 API: crm.automation.trigger.*
Scope: crm
Fire a trigger
POST /v1/triggers/fire
Sends an automation-activation signal for a given CRM entity. Bitrix24 runs all automation rules and actions configured for the specified trigger at the corresponding pipeline stage.
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
FieldentityType |
Typestring | Required★ | DescriptionCRM entity type: deal, lead, contact, company, quote, invoice, item |
FieldentityId |
Typenumber | Required★ | DescriptionCRM entity ID. Source: GET /v1/deals, GET /v1/leads, GET /v1/contacts, GET /v1/companies, GET /v1/quotes, GET /v1/invoices. For item — the element ID from GET /v1/items/:entityTypeId |
FieldentityTypeId |
Typenumber | Required | DescriptionSmart process type ID. Required when entityType: item. Type list: GET /v1/smart-processes |
FieldtriggerId |
Typestring | Required★ | DescriptionTrigger code. List of codes: GET /v1/triggers, field CODE |
Examples
curl — personal key
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":5141,"triggerId":"payment_received"}'
curl — OAuth application
curl -X POST https://vibecode.bitrix24.com/v1/triggers/fire \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entityType":"deal","entityId":5141,"triggerId":"payment_received"}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/triggers/fire', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
entityType: 'deal',
entityId: 5141,
triggerId: 'payment_received',
}),
})
const data = await res.json()
console.log(data.success, data.data) // true, true
curl — invoice (SmartInvoice)
An invoice is a smart invoice (a dynamic CRM type). Pass entityType: "invoice" and the invoice ID from GET /v1/invoices:
curl -X POST https://vibecode.bitrix24.com/v1/triggers/fire \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"entityType":"invoice","entityId":42,"triggerId":"payment_received"}'
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/triggers/fire', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
entityType: 'deal',
entityId: 5141,
triggerId: 'payment_received',
}),
})
const data = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue when the signal was sent successfully |
Fielddata |
Typeboolean | Descriptiontrue — signal accepted by Bitrix24 |
Response example
{
"success": true,
"data": true
}
Error response example
400 — unknown entity type:
{
"success": false,
"error": {
"code": "INVALID_ENTITY_TYPE",
"message": "Unknown entityType \"banana\". Supported: deal, lead, contact, company, quote, invoice, item"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeMISSING_PARAMS |
DescriptionA required parameter is missing — entityType, entityId or triggerId, or entityType: item without entityTypeId |
| HTTP400 | CodeINVALID_ENTITY_TYPE |
DescriptionUnknown entity type. Allowed: deal, lead, contact, company, quote, invoice, item |
| HTTP400 | CodeINVALID_ENTITY_TYPE_ID |
DescriptionentityTypeId belongs to a type with a dedicated entityType — use that type (deal, lead, contact, company, quote, or invoice for entityTypeId=31) instead of item |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header is missing |
| HTTP401 | CodeINVALID_API_KEY |
DescriptionThe key is not recognized — no such key exists on the platform |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no connected Bitrix24 tokens |
| HTTP401 | CodeTOKEN_EXPIRED |
DescriptionThe OAuth user session has expired — re-authorize via /v1/oauth/authorize |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the crm scope |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionBitrix24 denied access |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionBitrix24 could not find the signal target — entityId is invalid, for example non-numeric |
| HTTP429 | CodeRATE_LIMITED |
DescriptionRequest limit exceeded. Retry in 1–2 seconds |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 is unavailable |
Full list of common API errors — Errors.
Known specifics
- The signal is accepted regardless of automation configuration. If no automation rules are configured for the given
triggerIdat the current pipeline stage, Bitrix24 still returnsdata: true— no error occurs. - Entity existence is not checked. A valid numeric
entityIdis accepted even if no record with that ID exists —firereturnsdata: truewithout verifying the signal target. Pass anentityIdfrom the sources listed in the request fields.