> ## 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.

# Chats

> Mute, pin, archive, read, lock, star, clear, and delete chats for a connected token.

Chat actions update the linked device's own chat list and settings. They do not remove content from other participants' devices.

Before using chat actions, the token must be paired and connected:

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

## Apply a chat action

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

```json theme={null}
{
  "chatJid": "15551234567@s.whatsapp.net",
  "action": "mute",
  "muteEndTimestampMs": 4102444800000
}
```

Supported actions:

| Action                      | Effect                                       |
| --------------------------- | -------------------------------------------- |
| `mute` / `unmute`           | Turn notifications off or on.                |
| `pin` / `unpin`             | Pin or unpin the chat in your chat list.     |
| `archive` / `unarchive`     | Move the chat into or out of archived chats. |
| `mark_read` / `mark_unread` | Update read state.                           |
| `lock` / `unlock`           | Update chat lock state.                      |
| `clear`                     | Clear messages from your linked device.      |
| `delete`                    | Delete the chat from your linked device.     |

For `clear`, you can include `deleteStarred` and `deleteMedia`. For `delete`, you can include `deleteMedia`.

Successful responses are wrapped in `data`:

```json theme={null}
{
  "data": {
    "sessionId": "01J...",
    "to": "15551234567@s.whatsapp.net",
    "action": "mute",
    "messageId": null
  }
}
```

## Star a message

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

```json theme={null}
{
  "message": {
    "chatJid": "15551234567@s.whatsapp.net",
    "id": "3EB0A1B2C3D4E5F6",
    "fromMe": false
  },
  "starred": true
}
```

Set `starred` to `false` to remove the star.
