Realtime Tokens
Issue WebRTC session credentials backed by LiveKit-compatible access tokens. Use these to connect browser users directly to a voice agent without going through the full Calls API.
Create a Realtime Token
http
POST /v1/realtime/tokenCreates a queued WebRTC call record and returns LiveKit-compatible credentials for the caller.
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
agent_id | uuid | Yes | — | Agent the WebRTC caller should speak with |
metadata | object | No | {} | Custom data stored on the call record (tagged with type: "webrtc") |
Example Request
bash
curl -X POST https://api.rymi.live/v1/realtime/token \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"metadata": {
"source": "web-app",
"user_id": "usr_456"
}
}'Response 200
json
{
"client_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"room_name": "webrtc_550e8400-e29b-41d4-a716-446655440000",
"server_url": "wss://livekit.rymi.live"
}Response Fields
| Field | Type | Description |
|---|---|---|
client_token | string | LiveKit-compatible JWT access token |
room_name | string | LiveKit room name for this session |
server_url | string | WebSocket URL for the LiveKit server |
Use these credentials with the Browser SDK or any LiveKit-compatible client:
typescript
import { Rymi } from '@rymi/web';
const call = Rymi.createCall({ url: serverUrl, token: clientToken });
call.on('started', () => console.log('Connected'));
await call.connect();Errors
| Status | Meaning |
|---|---|
400 | Invalid payload (missing agent_id or malformed body) |
401 | Missing authentication context |
404 | Agent not found for the authenticated tenant |
500 | LiveKit configuration or call-session initialization failed |
Compatibility Alias
http
POST /v1/webrtc/tokenThis route behaves identically to POST /v1/realtime/token and exists for backward compatibility. New integrations should use /v1/realtime/token.

