Trigger Call API
Start an outbound AI call programmatically from any CRM or external system. The call is queued and placed during the organization's business hours.
Endpoint
POST https://your-host/api/public/trigger-call
Headers
| Header | Value |
|---|---|
| Authorization | Bearer YOUR_API_KEY — a key issued in your account |
| Content-Type | application/json |
Request body
| Field | Type | Description |
|---|---|---|
| phone | string, required | A number in any format: +79991234567, 89991234567, 8 (999) 123-45-67. Normalized to E.164. |
| campaign | string, ≤64 | The calling campaign to queue the call in — identified by its trigger_key (not the numeric id). The campaign decides which agent calls and with which script. You may omit the field only if the key is already bound to a campaign in your account; otherwise the request is rejected with 422. |
| payload | object, optional | Any JSON object with context. It is passed to the voice agent's prompt in the <client_context> block. Limit 5 KB; strings longer than 200 characters are truncated. |
| external_ref | string, optional, ≤128 | The entity ID in your CRM (e.g. LEAD_42). Used for deduplication and to update exactly this lead after the call. |
| external_system | string, optional, ≤32 | CRM name (bitrix, amocrm, custom). Determines how the lead is updated back. |
Minimal request
{
"phone": "+79991234567",
"campaign": "reactivation"
}Full request
{
"phone": "+79991234567",
"campaign": "reactivation",
"payload": {
"name": "John",
"stage": "Price negotiation",
"product": "CRM Pro",
"deal_amount": 240000
},
"external_ref": "LEAD_42",
"external_system": "bitrix"
}curl
curl -X POST 'https://your-host/api/public/trigger-call' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"phone":"+79991234567","campaign":"reactivation","payload":{"name":"John","stage":"Price negotiation","product":"CRM Pro","deal_amount":240000},"external_ref":"LEAD_42","external_system":"bitrix"}'Responses
| Code | When |
|---|---|
| 202 | The call is queued. Body: {"queued":true,"call_list_entry_id":N} |
| 400 | Invalid number, payload too large (>5 KB), malformed JSON. |
| 401 | The key is missing, revoked, or doesn't match the sk_live_… format. |
| 403 | The key lacks the trigger_call scope, or the key is bound to one campaign while campaign names another: the binding is strict and can't be overridden by the request body. |
| 404 | Your organization has no campaign with this campaign key (or it is archived). The response is the same for a non-existent key and for another organization's campaign key. |
| 409 | Duplicate within the same campaign. With external_ref — there is already an active entry with the same ref. Without it — there is an active entry for the same phone number. |
| 422 | There is nowhere to queue the call: campaign is not provided and the key isn't bound to a campaign. There is no fallback “default” campaign — otherwise the customer could get a call from the wrong agent. |
| 429 | Rate limit exceeded: 60 requests per minute or 1000 per day per key. The Retry-After header tells you how long to wait. |
Setting up a Bitrix24 automation rule
In Bitrix24, an “outgoing webhook” from a pipeline automation rule sends a POST with a templated body to our URL. This is the simplest route — no apps to install.
- In Bitrix24, open CRM → Pipelines → Automation rules on the stage you need.
- Add the “HTTP notification” rule or a similar “webhook” one.
- Method:
POST. URL:https://your-host/api/public/trigger-call - Headers:
Authorization: Bearer YOUR_API_KEYContent-Type: application/json
- Body — JSON with Bitrix placeholders. Take the
campaignvalue from the campaign's “Integration” tab — it is the campaign'strigger_key, not its numeric id:
{
"phone": "{{=Document:PHONE}}",
"campaign": "reactivation",
"payload": {
"name": "{{=Document:NAME}}",
"stage": "{{=Document:STAGE_ID}}",
"title": "{{=Document:TITLE}}"
},
"external_ref": "LEAD_{{=Document:ID}}",
"external_system": "bitrix"
}Once set up: when a lead moves to this stage, the rule calls our endpoint and we queue the call. The AI agent gets the context from payload in its system prompt, and after a successful call the result goes back into the same lead (instead of creating a duplicate) — thanks to external_ref.
amoCRM, Kommo and other CRMs
The endpoint is provider-neutral. Set up a webhook on a pipeline stage or an automation trigger with the same headers and body. The external_system field tells our backend how to talk to your CRM's API when updating the lead back.
Deduplication and idempotency
Deduplication applies within a single campaign. The same number can be in a reactivation campaign and a callback campaign at the same time — those are different conversations with different agents.
- With
external_ref: repeated requests with the same(campaign, external_ref)return 409 while the entry is active (pending/in_progress). This makes Bitrix retries safe. - Without
external_ref: deduplication by phone number within the same campaign — while there is an active entry with the same number, a new request is rejected. - Once the call has finished (
completed/failed/no_answer), the sameexternal_refcan be used again — that is the normal re-calling scenario.
When the call actually goes out
The call is queued instantly. It is actually dialed when:
- The current time falls within the organization's business hours (configured in your account).
- An outbound slot is free (up to 3 concurrent calls by default).
- The number is not on the organization's DNC list.
- If the call can't fit into the current window, it waits for the next one.
Call statuses and outcomes
When a call ends, the number in the call list gets an operational status and a business outcome. They mean different things and shouldn't be confused.
Status (what happened at the telephony level)
pending— waiting in the queue.ringing— dialing, the callee hasn't answered yet.talking— the callee answered, the conversation with the agent is in progress.completed— the conversation ended normally.no_answer— the callee didn't answer, rejected the call, it went to voicemail, or the agent didn't hear an answer.busy— the line was busy.failed— telephony error (no route, invalid number, provider unavailable).skipped— the number was on the DNC list or skipped by an operator.
Outcome (business result)
booked,interested,callback— success to varying degrees.not_interested— the customer declined.voicemail— an answering machine was detected (AMD).silent— the call connected, but the customer stayed silent (or it was voicemail without AMD).hung_up— the customer hung up before the conversation started.error— technical error.
Important: voicemail and silence are no longer marked as “Completed”. If AMD detected an answering machine, the status is no_answer and the outcome is voicemail. This means the lead can be called back, rather than counted as if a conversation took place.
Calling settings
Settings are configured per campaign on the “Settings” tab of the /campaigns/{id} page. So reactivation can call rarely and gently, while callback requests are handled often and persistently — all within the same account:
- Max attempts (1–10) — how many times to call one number before moving it to
failed. - Answer timeout (10–180 s) — how long to wait for the call to be answered.
- Retry delay (1–1440 min) — how long after
no_answerthe number may be called again. - Pause between calls (0–600 s) — delay after each call before starting the next one.
- Max call duration (30–1800 s) — after this the call is ended forcibly.
- Max concurrent calls (1–10) — the campaign's limit. It is capped by the number of active phone channels of the campaign's agent (that many workers are started), and on top of all campaigns there is an organization-wide limit that protects the SIP trunk from overload.
- Detect answering machine — enables the AMD check so you don't spend minutes on voicemail.
Changes apply on the fly — the worker loop picks up new values within a minute, no restart needed.
Security
- The key is shown once, at creation. It can't be recovered — only reissued, with the old one revoked.
- Keys are stored as SHA-256 hashes; even a database leak doesn't expose them.
- An organization can have several active keys (separate ones for prod / dev / each CRM).
- A key can be bound to a campaign. Then
campaignisn't needed in the body, and an attempt to specify another campaign is rejected with 403 — the reactivation rule's key can't queue calls into the callback campaign. - Rate limit: 60/min and 1000/day per key. Exceeding it → 429 with
Retry-After.