Skip to main content
Mints a short-lived, single-use client token that lets a browser on one of allowedOrigins open one session with this Roark-hosted agent: a voice call (modality: call) or a text chat (modality: chat). Call it from your server, never from the browser: it needs your API key, and the token it returns is the only thing your page should see. The agent must have a published version that takes calls or chats, to match.
Calls POST /v1/agent/{agentId}/web-session-tokens

Arguments

string
required
The agent-id.

Options

array
required
The origins the token may be spent from, exactly as the browser sends them: https only (http on localhost for development), no paths or wildcards. Repeatable.
integer
How long the token can be spent for, in seconds. Default 120.
string
What the token opens: call for a voice session, chat for a text chat. A token opens only that kind. Default call. One of call, chat

Example

Every command also takes the global options and sets one of the exit codes.