Documentation menu

API reference

Phone tokens

Short-lived tokens that let an end-user place a call from a browser or mobile softphone — your API key never reaches the client. See the Browser SDK token flow for the full picture.

POST/phone-tokens/mint

Mint a token for an end-user.

FieldTypeRequiredDescription
uuidstringRequiredThe end-user's uuid.
ttl_secondsinteger, nullableOptionalToken lifetime (server default if omitted).
max_concurrentinteger, nullableOptionalSimultaneous calls this token allows.

Returns { token: string, phone_token: PhoneToken, iceServers: array }. The token and iceServers are what the Browser SDK's authenticate() takes directly.

# your backend — the secret key stays here
curl https://sauti-pbx.services.co.ke/api/phone-tokens/mint \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "uuid": "the-end-user-uuid" }'

// → 200 OK
{
  "token": "eyJhbGc...",
  "phone_token": { "uuid": "...", "expires_at": "..." },
  "iceServers": [ { "urls": "stun:..." } ]
}
POST/phone-tokens/revoke

Revoke a token immediately. Body { uuid: string } (the token's uuid). Returns { message: string }.

The PhoneToken object

FieldTypeDescription
uuidstringToken identifier (use with revoke).
end_userstringThe end-user's uuid.
extension_numberstringThe end-user's extension.
max_concurrentintegerConcurrent-call limit.
is_validbooleanWhether the token is still usable.
expires_at / revoked_at / created_atstring, nullableISO-8601 timestamps.