eSMS AfricaeSMS Africa
API ReferenceVoice API

Calls

eSMS Voice Calls API - create an outbound call (Idempotency-Key required), list and fetch calls with their events, cancel or hang up, plus caller numbers, pricing, settings and usage.

Early access - contact sales

eSMS Voice is in early access. Live calls need voice enabled on your account - contact sales. Every endpoint works today with an esms_test_ key (simulated calls, no charge). Guides: Overview, Call flows, Webhooks, Errors.

Base URL: https://sms.esmsafrica.io/v1 (also served under /api). Auth: Authorization: Bearer <API key or JWT>. Writes need the voice scope; reads accept voice or query.

MethodPathDescription
POST/voice/callsCreate an outbound call
GET/voice/callsList calls
GET/voice/calls/{id}Get a call with its flow and events
POST/voice/calls/{id}/actionscancel a queued call or hangup an active one
GET/voice/numbersCaller numbers you can use
GET/voice/pricingPer-minute prices per country (public)
GET/voice/settingsYour voice settings, limits and today's spend
GET/voice/usageUsage per day and per country

Create a call

POST /v1/voice/calls

Headers

HeaderRequiredDescription
Idempotency-KeyyesAny unique string, at most 80 characters. Same key + same body replays the first response (with Idempotent-Replayed: true) and never places a second call. Same key + different body returns 409 idempotency_conflict.
Content-Typeyesapplication/json

Body

FieldTypeRequiredDescription
tostringyesDestination in E.164, e.g. +256772123456. The country must be on your allow-list.
fromstringnoOne of your caller numbers for the destination country (GET /voice/numbers). Omit to use the shared caller number for that country.
flowobjectyes{"steps": [...]} - see Call flows.
max_duration_secondsintegerno30 up to your account's maximum call length (default 120). The call is cut at this length and the pre-call hold is based on it.
status_callbackstringnoPublic https:// URL that also receives this call's signed events.
metadataobjectnoYour own data, at most 2 KB, returned on the call and in every webhook.
environmentstringnoDashboard (JWT) callers only: "test" makes a sandbox call. API keys decide by prefix (esms_test_ = sandbox).

Unknown fields are refused (400 invalid_request).

curl -X POST https://sms.esmsafrica.io/v1/voice/calls \
  -H "Authorization: Bearer esms_live_your_api_key" \
  -H "Idempotency-Key: otp-7f3a91" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+256772123456",
    "flow": { "steps": [
      { "type": "say", "text": "Your Acme code is 4 8 2 1.", "loop": 2 },
      { "type": "hangup" }
    ] },
    "max_duration_seconds": 60,
    "metadata": { "user_id": "u_123" }
  }'

Response 202 Accepted

{
  "id": "call_6f1c2a9e4b7d8c0f1a2b3c4d",
  "status": "queued",
  "to": "+256772123456",
  "from": "+256312000000",
  "country": "UG",
  "livemode": true,
  "created_at": "2026-11-26T12:00:00Z",
  "estimate": { "per_minute_usd": 0.0, "hold_usd": 0.0, "estimated_seconds": 4 }
}

estimate.hold_usd is held from your balance now and settled when the call ends (prices shown as placeholders). The call is dialled in the background; follow it with webhooks or GET /voice/calls/{id}.

Errors

400 idempotency_key_required, 409 idempotency_conflict, 403 insufficient_scope, 503 voice_disabled, 403 voice_not_enabled, 400 invalid_phone, 403 country_not_allowed, 503 destination_unavailable, 400 invalid_caller_id, 400 invalid_flow, 400 flow_too_long, 400 feature_not_available, 400 invalid_metadata, 400 invalid_status_callback, 503 voice_paused, 429 rate_limited, 429 concurrency_limit, 429 daily_spend_cap_reached, 402 insufficient_balance. See Errors.

Call statuses

queued -> initiated -> ringing -> answered -> completed
                 \          \          \
                  +----------+----------+--> busy | no_answer | failed
queued --(cancel)--> canceled
StatusMeaning
queuedAccepted, waiting to be dialled. Can be canceled.
dispatchingBeing handed to the voice network.
initiatedThe network accepted the call.
ringingThe phone is ringing.
answeredAnswered; the flow is running.
completedFinal: ended normally after being answered.
busyFinal: busy or declined.
no_answerFinal: rang without an answer.
failedFinal: could not be completed; see error_code and retryable.
canceledFinal: canceled while queued.
unknownTemporary: the network did not confirm the call yet. Resolves to a final status, or to failed (provider_unknown) after 10 minutes with the hold released.

Final statuses never change.

The call object

FieldDescription
idcall_ + 24 hex characters.
objectcall
status, status_reason, error_code, retryableCurrent status and, when it did not complete, why.
directionoutbound
to, from, countryDestination, caller number, ISO country code.
livemode, environmenttrue / live for live keys, false / test for sandbox calls.
max_duration_seconds, estimated_secondsCap and flow estimate.
duration_seconds, billed_secondsAnswered length and billed length (whole minutes).
gather_digitsLast key presses collected (masked for sensitive gathers).
price{per_minute_usd, hold_usd, charge_usd, currency: "USD"}
metadata, status_callbackAs sent.
campaign_idvcmp_... when the call belongs to a campaign.
hangup_requestedtrue after a hangup action.
created_at, queued_at, dispatched_at, ringing_at, answered_at, ended_atISO 8601 UTC timestamps.
sequenceGrows with every event; use it to order webhooks.

List calls

GET /v1/voice/calls?status=completed,failed&to=+256772123456&page=1&limit=25
QueryDescription
statusOne status or a comma-separated list.
toExact destination number.
campaign_idCalls of one campaign (vcmp_...).
date_from, date_toISO 8601 date or date-time on created_at.
environmentlive (default), test or all. Test keys always see test calls only.
page, limitPage number (from 1) and size (1-100, default 25). Newest first.
{ "data": [ { "id": "call_...", "status": "completed", "...": "..." } ], "total": 42, "page": 1, "limit": 25 }

Get a call

GET /v1/voice/calls/{id}

Returns the call object plus its frozen flow and the events history. Event type is one of queued, dispatching, initiated, ringing, answered, gather, hangup_requested, completed, busy, no_answer, failed, canceled, unknown:

{
  "id": "call_6f1c2a9e4b7d8c0f1a2b3c4d",
  "status": "completed",
  "...": "...",
  "flow": { "steps": [ { "type": "say", "text": "Your Acme code is 4 8 2 1.", "voice": "female", "loop": 2 }, { "type": "hangup" } ] },
  "events": [
    { "id": "evt_...", "type": "queued", "source": "api", "sequence": 1, "received_at": "2026-11-26T12:00:00Z", "data": { "to": "+256772123456", "country": "UG" } },
    { "id": "evt_...", "type": "ringing", "source": "provider", "sequence": 4, "received_at": "2026-11-26T12:00:03Z", "data": {} },
    { "id": "evt_...", "type": "completed", "source": "provider", "sequence": 6, "received_at": "2026-11-26T12:00:21Z", "data": {} }
  ]
}

Cancel or hang up

POST /v1/voice/calls/{id}/actions
actionAllowed whenEffect
cancelqueuedThe call is never dialled; it becomes canceled and the hold is released.
hangupdispatching, initiated, ringing, answered, unknownThe call is ended at the next step of the flow. hangup_requested becomes true; the final status follows on the webhook.
curl -X POST https://sms.esmsafrica.io/v1/voice/calls/call_6f1c2a9e4b7d8c0f1a2b3c4d/actions \
  -H "Authorization: Bearer esms_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "action": "hangup" }'

Returns the call object. Any other state returns 409 invalid_state.

Caller numbers

GET /v1/voice/numbers
{ "data": [ { "number": "+256312000000", "country": "UG", "country_name": "Uganda", "type": "regular", "shared": true } ] }

shared: true numbers are eSMS shared caller numbers any enabled account may use; dedicated numbers are on request.

Pricing

GET /v1/voice/pricing

Public, no key needed. Lists countries with an approved per-minute price: country_code, country, currency, per_minute_local, per_minute_usd, billing_increment_s, min_billable_s, availability (live | early_access). During early access the list may be empty - pricing is on request. See Billing.

Settings

GET /v1/voice/settings

Returns voice_enabled, enabled, allowed_countries, campaigns_enabled, limits (cps, max_concurrent, daily_spend_cap_usd, max_call_seconds), today_spend_usd, recording_enabled and the sandbox magic_numbers. See Limits.

Usage

GET /v1/voice/usage?days=30&environment=live

days 1-366 (default 30). Returns totals, by_day and by_country, each with calls, answered, completed, minutes (billed) and cost_usd.

On this page