Calls API
Place a single outbound call with one of your published agents, read its status, duration and transcript, list recent calls and stop a call.
Use this API to start one outbound call at a time from your own systems, for example when a form is submitted, and to follow it until it ends. To call many people from a list, use a campaign instead.
POST /v1/calls rings a real phone and uses your plan's voice minutes. Test it with a number you own. The call is handed to the dialer before the response is sent, and it is placed right away when your plan, the number and the agent allow it.POST /v1/calls. Calls made by a campaign, by an automation or from the dashboard are not listed here and answer 404 on GET /v1/calls/{id}.Scopes
calls:readforGETcalls:writefor placing a call and for stop
The call object
| Field | Type | Notes |
|---|---|---|
id | string (UUID) | Set by Dhvanee. Use it to read or stop the call. |
agent | string (UUID) or null | The agent that makes the call. |
to | string | The number called, in international format such as +919876543210. |
from | string or null | The workspace number the call is made from. |
status | string | See the table below. |
duration | integer or null | Seconds. null until the call has ended. |
transcript | string or null | The messages of the call, one per line, in order. The speaker is not marked. null until there is a conversation. |
{"id": "3f0c6c1e-8a57-4d57-9a43-5d1b0a6a9c11", "agent": "ff296ea3-5c61-436e-9ed9-77aba6fcc4fc", "to": "+919876543210", "from": "+918045678101", "status": "completed", "duration": 42, "transcript": null}| `status` | Meaning |
|---|---|
queued | Accepted and waiting to be dialed. |
in_progress | Ringing or connected. |
completed | The person answered and the call ended. |
stopped | You stopped it with POST /v1/calls/{id}/stop. |
no_answer, busy | The call was not picked up. |
failed | The call could not be placed. The reason is not returned here; check the number, the agent and your plan in the dashboard. |
skipped | Not dialed because the person is marked do-not-call or has withdrawn consent in your contacts. |
cancelled | Cancelled before it was dialed. |
Place a call
curl -sS -X POST "https://api.stage.dhvanee.com/v1/calls" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY" \
-H "Idempotency-Key: order-1042-callback" \
-H "Content-Type: application/json" \
-d '{"agent_id":"AGENT_ID","to":"+919876543210","from":"NUMBER_ID"}'| Field | Required | Notes |
|---|---|---|
agent_id | yes | A published agent of this workspace. See the Agents API. |
to | yes | 3 to 40 characters. Written like a phone number; it is turned into international format using your workspace's country (a 10-digit Indian mobile number becomes +91...). Invalid numbers are rejected. |
from | yes | The id of a number this workspace owns. List them with GET /v1/phone-numbers (Phone numbers API). |
Returns 201 with the call. Its status is usually queued or in_progress; it can already be failed or skipped (see above), so check status and do not assume the phone is ringing. The call is not tied to any campaign list: it appears only in this API.
Idempotency-Key (required)
- Send a different
Idempotency-Keyfor every call you mean to place: 1 to 128 printable ASCII characters, no spaces. - Repeat the same key with the same body (for example after a timeout) and you get the same call back with `201`, and the phone is not called again. The repeated answer is the saved copy from the first request, so its
statuscan be out of date; readGET /v1/calls/{id}for the current one. - The same key with a different body answers
409(Idempotency-Key was already used with a different request). - A key is remembered for 24 hours and belongs to the API key that used it.
- A request that was refused (
4xx) is not remembered, so after fixing it you can send it again with the same key.
Read a call
curl -sS -X GET "https://api.stage.dhvanee.com/v1/calls/CALL_ID" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"Poll this to follow a call from queued to completed, or receive the call_started, call_ended and call_analyzed events instead (Webhooks). The call_id in those events is this call's id.
List recent calls
Newest first, only the calls placed with this API.
curl -sS -X GET "https://api.stage.dhvanee.com/v1/calls?limit=5&offset=0" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"{"items": [{"id": "3f0c6c1e-...", "agent": "ff296ea3-...", "to": "+919876543210", "from": "+918045678101", "status": "completed", "duration": 42, "transcript": null}], "limit": 5, "offset": 0}limitis 1 to 200 (default 50) andoffsetis 0 or more (default 0).- Outside those limits the answer is
422(limit must be 1-200 and offset non-negative).
Stop a call
curl -sS -X POST "https://api.stage.dhvanee.com/v1/calls/CALL_ID/stop" \
-H "Authorization: Bearer dhvanee_live_YOUR_KEY"- A call that is still
queuedorin_progressbecomesstopped. It is not dialed if it was waiting, and a connected call is told to hang up. Acall_endedwebhook event is sent. - A call that has already ended is returned unchanged, with
200. Stopping twice is safe.
Plan limits and errors
A call needs voice minutes, a free call slot and outbound calling on your plan. When one of them is missing the API answers 402 and no call is made:
{"detail": {"code": "minutes_limit_reached"}}code is one of minutes_limit_reached, wallet_empty, concurrent_limit_reached, outbound_disabled or workspace_inactive. See Credits.
| Status | When |
|---|---|
401 | No key (Valid API key is required), or an unknown or revoked key (API key is invalid or revoked). |
402 | The plan cannot place a call (detail.code above). |
403 | The key lacks the scope (API key needs calls:write scope, or calls:read). |
404 | No call with that id among this workspace's API calls (Call not found). |
409 | The Idempotency-Key was used with a different body (Idempotency-Key was already used with a different request). |
422 | Idempotency-Key is required, or Idempotency-Key must be 1-128 printable ASCII characters, Unknown workspace agent, Publish the agent before placing a call, Use a phone number this workspace already owns, Give a valid phone number. Also a missing or malformed field (agent_id, to or from absent, an id that is not a UUID, to shorter than 3 or longer than 40 characters), or limit / offset out of range. |
429 | Too many requests: detail.code is rate_limit_key, rate_limit_workspace, rate_limit_client or rate_limit_auth_fail. See Rate limits. |
Keys and scopes: Authentication. Other limits: Errors.