---
title: "Create chat token"
method: POST
path: "/api/chat/tokens"
tags: ["Chat Tokens"]
---

# Create chat token

`POST /api/chat/tokens`

Generate a Chat Token to be used to authenticate clients to the Chat Service.

#### Permissions

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

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

## Request body

- ChatNewChatToken
  - `ttl` integer, required — The maximum time, in minutes, that the access token will be valid for. Between 1 and 43,200 (30 days).
  - `channels` ChatChatChannel, required — User-defined channel names. Each channel is an object with `read` and/or `write` properties. Max of 500 channels. Either `read`, `write`, or both are required inside each channel and default to `false`. Each channel name can be up to 250 characters. Channel names cannot start with the reserved prefix `sw_`. Must be valid JSON.
  - `member_id` string — The unique identifier of the member. Up to 250 characters. If not specified, a random UUID will be generated.
  - `state` ChatChatState — An arbitrary JSON object available to store stateful application information in. Must be valid JSON and have a maximum size of 2,000 characters.

## Response `200`

The request has succeeded.

- ChatChatToken
  - `token` string, required — The generated Chat Token.

## Other responses

- `400` — The request is invalid.
- `401` — Access is unauthorized.
- `422` — The request contains invalid parameters. See errors for details.

---

[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/91fbe575ddf9/schema)
