Skip to content

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

Field Type Required Description
uuid string Required The end-user’s uuid.
ttl_seconds integer, nullable Optional Token lifetime. Default 3600, maximum 3600 (one hour).
max_concurrent integer, nullable Optional Simultaneous calls this token allows. Default 1, maximum 10.

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

Terminal window
# your backend: the secret key stays here
curl https://api.sautipbx.com/api/phone-tokens/mint \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{ "uuid": "the-end-user-uuid" }'
{
"token": "eyJhbGc...",
"phone_token": { "uuid": "...", "expires_at": "..." },
"iceServers": [{ "urls": "stun:..." }]
}
Status Meaning
402 The account cannot fund a call, so the token would be useless. Top up the wallet and retry.
400 The end-user belongs to another account, or is not active.
404 No end-user with that uuid.

A 402 looks like this:

// HTTP 402
{ "detail": "Cannot mint a phone token: insufficient balance. Top up the wallet and retry." }

Spendable balance is your wallet balance plus any grace amount and credit limit, so an account running on credit still mints normally. It is the same money test a call is admitted against, which is why a token is refused before it is issued rather than failing on the first call the user makes.

POST /phone-tokens/revoke

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

Field Type Description
uuid string Token identifier (use with revoke).
end_user string The end-user’s uuid.
extension_number string The end-user’s extension.
max_concurrent integer Concurrent-call limit.
is_valid boolean Whether the token is still usable.
expires_at / revoked_at / created_at string, nullable ISO-8601 timestamps.