
## 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 | Req. | Description |
|------|-----|:-----:|---------|
| `entityType` | string | ★ | CRM entity type: `deal`, `lead`, `contact`, `company`, `quote`, `invoice`, `item` |
| `entityId` | number | ★ | CRM 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` |
| `entityTypeId` | number |  | Smart process type ID. Required when `entityType: item`. Type list: `GET /v1/smart-processes` |
| `triggerId` | string | ★ | Trigger code. List of codes: [`GET /v1/triggers`](/docs/automation/triggers/list), field `CODE` |

## Examples

### curl — personal key

```bash
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

```bash
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

```javascript
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`:

```bash
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

```javascript
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 |
|------|-----|---------|
| `success` | boolean | `true` when the signal was sent successfully |
| `data` | boolean | `true` — signal accepted by Bitrix24 |

## Response example

```json
{
  "success": true,
  "data": true
}
```

## Error response example

400 — unknown entity type:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_ENTITY_TYPE",
    "message": "Unknown entityType \"banana\". Supported: deal, lead, contact, company, quote, invoice, item"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `MISSING_PARAMS` | A required parameter is missing — `entityType`, `entityId` or `triggerId`, or `entityType: item` without `entityTypeId` |
| 400 | `INVALID_ENTITY_TYPE` | Unknown entity type. Allowed: `deal`, `lead`, `contact`, `company`, `quote`, `invoice`, `item` |
| 400 | `INVALID_ENTITY_TYPE_ID` | `entityTypeId` belongs to a type with a dedicated `entityType` — use that type (`deal`, `lead`, `contact`, `company`, `quote`, or `invoice` for `entityTypeId=31`) instead of `item` |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 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 has expired — re-authorize via `/v1/oauth/authorize` |
| 403 | `SCOPE_DENIED` | The key lacks the `crm` scope |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 could not find the signal target — `entityId` is invalid, for example non-numeric |
| 429 | `RATE_LIMITED` | Request limit exceeded. Retry in 1–2 seconds |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **The signal is accepted regardless of automation configuration.** If no automation rules are configured for the given `triggerId` at the current pipeline stage, Bitrix24 still returns `data: true` — no error occurs.
- **Entity existence is not checked.** A valid numeric `entityId` is accepted even if no record with that ID exists — `fire` returns `data: true` without verifying the signal target. Pass an `entityId` from the sources listed in the request fields.

## See also

- [Trigger list](/docs/automation/triggers/list)
- [CRM Automation](/docs/automation)
- [Workflows](/docs/automation/workflows)
