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

# Manage chats

> Mute, pin, archive, mark read, lock, star, clear, and delete chats.

## 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": "archive"
}
```

Supported `action` values:

```json theme={null}
[
  "mute",
  "unmute",
  "pin",
  "unpin",
  "archive",
  "unarchive",
  "mark_read",
  "mark_unread",
  "lock",
  "unlock",
  "clear",
  "delete"
]
```

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

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

## Star or unstar 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 unstar the message.
