> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roark.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# roark agent web-session-token create

> Create a web session token

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.

```bash Synopsis theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
roark agent web-session-token create <agent-id> [options]
```

> [!NOTE]
>
> Calls `POST /v1/agent/{agentId}/web-session-tokens`

## Arguments

**agent-id** `string` *required*

The agent-id.

## Options

**--allowed-origins** `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.

**--ttl-seconds** `integer`

How long the token can be spent for, in seconds. Default 120.

**--modality** `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

```bash theme={"theme":{"light":"everforest-light","dark":"everforest-dark"}}
roark agent web-session-token create <agent-id> --allowed-origins <value>
```

Every command also takes the [global options](https://docs.roark.ai/cli-reference/overview.md#global-options) and sets one
of the [exit codes](https://docs.roark.ai/cli-reference/overview.md#exit-codes).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.