Skip to main content
POST
Create Stream Token

Authorizations

Authorization
string
header
required

Specify the authorization token.

For more information, check out the Authorization Guide.

Path Parameters

pearlId
string
required

Your Pearl's id. It must be an active voice Pearl. Find it on your Pearl's overview page, in the Settings popover.

Body

Represents the data required to create a stream token.

endUserId
string | null

Your own id for the person on the call, such as a customer id, an e-mail or a phone number, up to 200 characters. A stream call has no phone number, so this takes its place: in the call history, in your Pearl's memory, and in the flow's Phone Number variable. Send the same value for the same person every time, and never one value for different people.

Maximum string length: 200
callData
object | null

The flow's pre-call variables, by variable name: the same dictionary as a phone call's callData.

Required entries: every variable used in the opening sentence, and every input of a pre-call API, present and not blank. Other variables are optional.

Keys are letters (any script), digits, _ and -, up to 40 characters. Values are strings, up to 200 characters.

audioFormat
string | null
default:ulaw_8000

The audio format of the call, the same in both directions. We recommend opus_24000: HD for far less bandwidth.

  • opus_24000: Opus at 24 kHz, HD.
  • opus_8000: Opus at 8 kHz, phone quality.
  • ulaw_8000: 8 kHz G.711 μ-law, phone quality.
  • pcm_24000: 24 kHz 16-bit little-endian PCM, HD.

Case-insensitive. Absent, null or empty means ulaw_8000, and any other value is refused.

Response

The call was created: connect with the token before it expires.

Represents what your server needs to connect a stream call.

callId
string | null

The call's id: the same id as in Get Call, the call list and the webhooks.

url
string | null

The WebSocket URL. Open it with the token: url?token=<token>. Always use the returned value rather than a fixed address.

token
string | null

The single-use token for the connection, starting with wst_. It is valid for 60 seconds and is consumed by the first successful connection. Treat it as a secret. From a server you can send it in the Authorization: Bearer header instead of the query.

expiresAt
string<date-time>

When the token stops being accepted, in ISO 8601 UTC: creation plus 60 seconds.

audio
object | null

The format of every audio frame, in both directions.