# Create An API Token

`POST /tokens`

Creates an API token through a browser session. The token secret appears only in this response. If `scopes` is omitted, the token starts with `pages:read`.
## Authentication

Use the following authentication method:

- **Better Auth browser session** (`browserSession`) : Use the Better Auth session cookie from a signed-in browser session. Send it in the `better-auth.session_token` cookie.
## Request Body

Required.

### `application/json`

```json
{
  "name": "Local CLI",
  "scopes": [
    "pages:read"
  ],
  "expiresAt": null
}
```
## Responses

### 201

Token metadata and the secret, which is shown only once.


### `application/json`

```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "scopes": [
    "pages:read"
  ],
  "expiresAt": "string",
  "lastUsedAt": "string",
  "createdAt": "string",
  "token": "string"
}
```
