---
title: "Create room token"
method: POST
path: "/api/video/room_tokens"
tags: ["Room Tokens"]
---

# Create room token

`POST /api/video/room_tokens`

Generate a Room Token allowing a client to join a Room.

#### Permissions

The API token used to authenticate must have the following scope(s) enabled to make a successful request: _Video_.

[Learn more about API scopes](/docs/platform/your-signalwire-api-space).

## Request body

- VideoCreateRoomTokenRequest — Request body for creating a room token.
  - `room_name` string, required — Room's unique named identifier. Allowed characters: A-Za-z0-9_-. Up to 100 characters. The room does not have to exist when the token is created, but must exist prior to joining, or ensure auto_create_room is set to true.
  - `user_name` string — A display name to use for the user. Up to 100 characters. (If not supplied, a random alphanumeric string will be returned for each authorization with this token.)
  - `permissions` VideoRoomTokenPermission[] — A list of permissions, which define what user can do once they join the room. If `join_as` is `audience`, permissions are set to an empty array regardless of the value provided.
  - `join_from` string, date-time — The user can't join the room before this time. Expects RFC 3339 datetime: `2022-01-01T23:59:60Z`. Date only: `2022-01-01` will be converted to `2022-01-01T00:00:00Z`
  - `join_until` string, date-time — The user can't join the room after this time. Expects RFC 3339 datetime: `2022-01-01T23:59:60Z`. Date only: `2022-01-01` will be converted to `2022-01-01T00:00:00Z`
  - `remove_at` string, date-time — Remove user from the room at this time. Expects RFC 3339 datetime: `2022-01-01T23:59:60Z`. Date only: `2022-01-01` will be converted to `2022-01-01T00:00:00Z`
  - `remove_after_seconds_elapsed` integer — Remove user after they are in the room for N seconds.
  - `join_audio_muted` boolean — Whether the user joins the room with their audio muted.
  - `join_video_muted` boolean — Whether the user joins the room with their video muted.
  - `auto_create_room` boolean — By default, if the user tries to use this token to join a room that doesn't exist, it will be created with default configuration. Set this to false to require the room to exist beforehand.
  - `enable_room_previews` boolean — Whether to generate a video with a preview of the content of the room. This parameter has effect only if this token auto-creates the room, thus it will be ignored if the room already exists.
  - `room_display_name` string — Display name used if a room is auto-created when the token joins. Maximum of 200 characters. Defaults to the value of room_name.
  - `end_room_session_on_leave` boolean — Whether to end the room session when the member using this token leaves the room.
  - `join_as` 'audience' | 'member' — Join as type for room tokens.
  - `media_allowed` 'all' | 'video-only' | 'audio-only' — Media allowed type for room tokens.
  - `room_meta` object — Set the room meta. Maximum of 2000 characters when serialized to JSON.
  - `meta` object — Set the member meta. Maximum of 2000 characters when serialized to JSON.
  - `sync_audio_video` boolean — Enable/disable jitter buffer audio-video sync.

## Response `200`

The request has succeeded.

- VideoRoomTokenResponse — Room token response object.
  - `token` string, required — A Room Token to be used by clients to connect to the Room.

## Other responses

- `400` — The request is invalid.
- `401` — Access is unauthorized.
- `422` — The request contains invalid parameters. See errors for details.
- `500` — An internal server error occurred.

---

[API](https://skmtc.net/signalwire/apis/signalwire-rest-api.md) · [All operations](https://skmtc.net/signalwire/apis/signalwire-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/signalwire/signalwire-rest-api/revisions/05c5164b85c7/schema)
