---
title: "Create WebRTC agent routing code"
method: POST
path: "/v1/webrtc/codes"
tags: ["WebRTC"]
---

# Create WebRTC agent routing code

`POST /v1/webrtc/codes`

## Request

- Base URL: `https://app.goguava.ai`
- URL: `https://app.goguava.ai/v1/webrtc/codes`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/goguava/apis/guava-api-server/docs/v1/webrtc/codes/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a code that lets WebRTC clients connect to your agent.

## Query parameters

- `expires_in` integer, nullable: Lifetime of the code in seconds. If omitted, the code never expires.
- `label` string, nullable: Human-readable label for the code.
- `require_token` boolean: If true, clients must present a token to connect, not just the code.

## Response `200`

Successful Response

- WebRTCAgentCodeResponse
  - `webrtc_code` string, required
  - `label` string, nullable, required
  - `require_token` boolean, required
  - `created_at` string, date-time, required
  - `expires_at` string, date-time, nullable, required

## Other responses

- `401`: Missing or invalid credentials.
- `422`: Validation Error

---

[API](https://skmtc.dev/goguava/apis/guava-api-server.md) - [All operations](https://skmtc.dev/goguava/apis/guava-api-server/llms.txt) - [OpenAPI document](https://skmtc.dev/goguava/apis/guava-api-server/revisions/2d944746bc25?raw)
