# Zapini API — Conversations

**Version:** 1.2.0
**Base URL:** `https://zapini.app/api/v1`

---

## Authentication

All endpoints require a Bearer Token:

```
Authorization: Bearer {your_token}
Accept: application/json
Content-Type: application/json
```

Generate API tokens in your admin panel under **API Docs → Manage Tokens**.

---

## Conversations

### GET /conversations

List conversations.

**Query Parameters:**

| Field | Type | Description |
|-------|------|-------------|
| instance_id | string | Instance UUID |
| unread | boolean | Only conversations with unread messages |
| search | string | Search by name or number |
| is_group | boolean | Filter groups or individuals |
| per_page | integer | Items per page |

---

### GET /conversations/archived

List archived conversations.

---

### GET /conversations/{uuid}

Returns conversation details.

---

### GET /conversations/{uuid}/messages

List messages from a conversation.

**Query Parameters:**

| Field | Type | Description |
|-------|------|-------------|
| from | datetime | Start date |
| to | datetime | End date |
| before_id | integer | Messages before this ID (for infinite scroll) |
| after_id | integer | Messages after this ID |
| limit | integer | Message limit (default: 50) |

---

### POST /conversations/{uuid}/mark-read

Mark conversation as read (reset unread counter).

---

### POST /conversations/{uuid}/archive

Archive the conversation.

---

### POST /conversations/{uuid}/unarchive

Unarchive the conversation.

---

### DELETE /conversations/{uuid}

Delete conversation and all messages.

---

*Generated by Zapini — https://zapini.app*
