> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wadial.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tokens

> Create, list, inspect, and delete WhatsApp session tokens.

A token is a stable `sessionId`. Use it as the path parameter for pairing, status, connection, and messaging endpoints.

## Create token

```http theme={null}
POST /api/v1/sessions
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "displayName": "Support line",
  "deviceBrowser": "Chrome"
}
```

## List all tokens

```http theme={null}
GET /api/v1/sessions
Authorization: Bearer <api_key>
```

## List connected tokens

Call `GET /api/v1/sessions` and keep records where `connected` is `true`.

`status: "connected"` alone means the token has connected before. A backend restart or runtime stop can leave a paired token with `status: "connected"` and `connected: false`. In that case, reconnect the token before sending.

## Get token status

```http theme={null}
GET /api/v1/sessions/{sessionId}
Authorization: Bearer <api_key>
```

The status response includes connection state, pairing state, linked phone JID, QR availability, and timestamps.

Important fields:

```json theme={null}
{
  "paired": true,
  "active": true,
  "connected": true,
  "connectionState": "connected"
}
```

* `paired`: WhatsApp credentials exist for this token.
* `active`: WADial has a runtime loaded for this token.
* `connected`: the runtime is connected and ready for message sends.
* `connectionState`: current runtime state, such as `connecting`, `connected`, `inactive`, `disconnected`, or `error`.

## Delete token

```http theme={null}
DELETE /api/v1/sessions/{sessionId}
Authorization: Bearer <api_key>
```
