Skip to content
DhvaneeDocs
Dashboard
On this page

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.

The machine-readable contract is openapi.public.yaml. Download it for clients and codegen. This site has no live Try-it console.
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.
This API only shows the calls you placed with 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:read for GET
  • calls:write for placing a call and for stop

The call object

FieldTypeNotes
idstring (UUID)Set by Dhvanee. Use it to read or stop the call.
agentstring (UUID) or nullThe agent that makes the call.
tostringThe number called, in international format such as +919876543210.
fromstring or nullThe workspace number the call is made from.
statusstringSee the table below.
durationinteger or nullSeconds. null until the call has ended.
transcriptstring or nullThe 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
queuedAccepted and waiting to be dialed.
in_progressRinging or connected.
completedThe person answered and the call ended.
stoppedYou stopped it with POST /v1/calls/{id}/stop.
no_answer, busyThe call was not picked up.
failedThe call could not be placed. The reason is not returned here; check the number, the agent and your plan in the dashboard.
skippedNot dialed because the person is marked do-not-call or has withdrawn consent in your contacts.
cancelledCancelled 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"}'
FieldRequiredNotes
agent_idyesA published agent of this workspace. See the Agents API.
toyes3 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.
fromyesThe 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-Key for 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 status can be out of date; read GET /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}
  • limit is 1 to 200 (default 50) and offset is 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 queued or in_progress becomes stopped. It is not dialed if it was waiting, and a connected call is told to hang up. A call_ended webhook 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.

StatusWhen
401No key (Valid API key is required), or an unknown or revoked key (API key is invalid or revoked).
402The plan cannot place a call (detail.code above).
403The key lacks the scope (API key needs calls:write scope, or calls:read).
404No call with that id among this workspace's API calls (Call not found).
409The Idempotency-Key was used with a different body (Idempotency-Key was already used with a different request).
422Idempotency-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.
429Too 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.

Calls API · Dhvanee Docs