# API: fãs, conversas e mensagens

_API · Leitura de 7 min · Atualizado 2026-10-22 · https://lanachat.ai/guides/pt/api-conversations/_

Um **fan** é um usuário do Telegram que escreveu para uma das suas criadoras. Uma **conversation** é o chat entre esse fã e uma conta do Telegram. As mensagens podem ser enviadas pela IA, por uma pessoa da equipe ou por um script. Esses endpoints correspondem a **Live Convs** e **Fans** no Console.

## Endpoints

| Method | Path | Description | Permission | Status |
|---|---|---|---|---|
| GET | `/fans` | Lista fãs (`creator_id=`, `status=`, `list_id=`, `q=`, `spent_min=`) | `can_fan_read` | Planned |
| GET | `/fans/{id}` | Um fã: idiomas, gastos, status, listas, notas | `can_fan_read` | Planned |
| PATCH | `/fans/{id}` | Altera o alias, idioma de resposta ou notas do fã | `can_chat` | Planned |
| GET | `/fans/{id}/sales` | Compras do fã | `can_sales_read` | Planned |
| POST | `/fans/import` | Importa fãs e mensagens antigas (nunca envia nada) | `can_fan_import` | Planned |
| GET | `/fan-lists` | Listas (VIPs, win back…) | `can_fan_read` | Planned |
| POST | `/fan-lists` | Cria uma lista | `can_chat` | Planned |
| POST | `/fan-lists/{id}/members` | Adiciona fãs a uma lista | `can_chat` | Planned |
| DELETE | `/fan-lists/{id}/members` | Remove fãs de uma lista | `can_chat` | Planned |
| GET | `/conversations` | Lista conversas (`creator_id=`, `account_id=`, `state=`, `unread=true`) | `can_fan_read` | Planned |
| GET | `/conversations/{id}` | Uma conversa e quem está respondendo | `can_fan_read` | Planned |
| GET | `/conversations/{id}/messages` | Mensagens, mais recentes primeiro (`translate=en` adiciona tradução) | `can_fan_read` | Planned |
| POST | `/conversations/{id}/messages` | Envia mensagem como a criadora (texto, mídia, oferta) | `can_chat` | Planned |
| POST | `/conversations/{id}/reactions` | Adiciona ou remove reação em mensagem do fã | `can_chat` | Planned |
| POST | `/conversations/{id}/takeover` | Uma pessoa assume: a IA para de responder esse fã | `can_chat` | Planned |
| POST | `/conversations/{id}/release` | Devolve a conversa para a IA | `can_chat` | Planned |
| POST | `/conversations/{id}/script` | Roda um script nessa conversa | `can_chat` | Planned |
| POST | `/conversations/{id}/read` | Marca a conversa como lida | `can_chat` | Planned |

## The fan object

```json
{
  "id": "fan_921",
  "display_name": "Marco",
  "username": "marco_dl",
  "creator_id": "cr_lea",
  "purchases": 9,
  "spent": { "stars": 1450, "net_cents": 1885 },
  "lists": ["vip"]
}
```

| Field | Type | Description |
|---|---|---|
| `id` | string | Começa com `fan_` |
| `display_name` | string | Nome do fã no Telegram |
| `username` | string or null | O @username do fã no Telegram, sem o @ |
| `creator_id` | string | A criadora para quem o fã escreveu |
| `purchases` | number | Compras verificadas até agora |
| `spent` | object | Total gasto: `stars` e `net_cents` em centavos de dólar, já descontando a taxa do Telegram e reembolsos |
| `lists` | array of strings | Ids das listas em que o fã está |

Um fã também traz os idiomas em que escreve, o status, as notas da equipe, um alias e o idioma de resposta, como na página **Fans**.

## The conversation object

```json
{
  "id": "conv_1001_88231",
  "fan_id": "fan_921",
  "creator_id": "cr_lea",
  "account_id": "acc_1001",
  "state": "ai",
  "status": { "tag": "active", "reason": null },
  "unread": 2,
  "last_message_at": "2026-10-06T14:02:51Z",
  "spent": { "stars": 1450, "net_cents": 1885 },
  "source_link_id": "lnk_3"
}
```

| Field | Type | Description |
|---|---|---|
| `id` | string | Começa com `conv_` |
| `fan_id`, `creator_id`, `account_id` | string | Quem fala com quem, em qual conta do Telegram |
| `state` | string | Quem responde: `ai`, `human` (assumida), `script` (um script está rodando) ou `off` |
| `status` | object | `tag` (os status da página Fans) e o `reason` quando houver |
| `unread` | number | Mensagens do fã ainda não lidas |
| `last_message_at` | string | ISO 8601, UTC |
| `spent` | object | O que o fã gastou nessa conversa: `stars` e `net_cents` |
| `source_link_id` | string or null | O link de rastreio de onde veio o fã |

`status.tag` corresponde aos status da página Fans (`review`, `safety_hold`, `converted`, `lost`, `underage`…). Uma conversa em `off` por motivo de segurança não pode ser devolvida para a IA (`409`).

## The message object

```json
{
  "id": "msg_77120",
  "from": "creator",
  "sent_by": "ai",
  "text": "Made this one this morning…",
  "media": [ { "id": "med_5521", "locked": true, "stars": 300 } ],
  "at": "2026-10-06T14:02:51Z"
}
```

| Field | Type | Description |
|---|---|---|
| `id` | string | Começa com `msg_` |
| `from` | string | `creator` ou `fan` |
| `sent_by` | string | Para mensagens da criadora: `ai`, `human` ou `script` |
| `member_id` | string | O membro da equipe que enviou, quando `sent_by` for `human` pelo Console |
| `token_id` | string | O token de acesso que enviou, quando veio da API |
| `text` | string | Texto da mensagem |
| `media` | array | Mídias enviadas: `id`, `locked` (paga e ainda não comprada) e preço em `stars` |
| `reactions` | array | Reações em mensagem do fã |
| `status` | string | Para mensagens enviadas: `queued`, `sent`, `read` ou `failed` |
| `at` | string | ISO 8601, UTC |

O campo `sent_by` define a comissão da venda, então ele é definido pelo servidor e nunca pelo seu request.

## The sale object

```json
{
  "sale_id": "sale_8812",
  "fan_id": "fan_921",
  "creator_id": "cr_lea",
  "account_id": "acc_1001",
  "conversation_id": "conv_1001_88231",
  "stars": 300,
  "net_cents": 390,
  "sent_by": "ai",
  "kind": "offer"
}
```

| Field | Type | Description |
|---|---|---|
| `sale_id` | string | Começa com `sale_` |
| `fan_id`, `creator_id`, `account_id`, `conversation_id` | string | Quem comprou, de quem, onde |
| `stars` | number | Valor pago em Telegram Stars |
| `net_cents` | number | Valor líquido em centavos de dólar (um Star vale $0.013) |
| `sent_by` | string | `ai`, `human` ou `script`: quem enviou a oferta, define a comissão |
| `kind` | string | O que foi comprado, por exemplo `offer` |

O mesmo objeto chega por [webhook](https://lanachat.ai/guides/pt/api-webhooks/), evento `sale.completed`.

## Fans

### List fans

`GET /fans` · `can_fan_read`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `creator_id` | string | No | Apenas fãs dessa criadora |
| `status` | string | No | Um status da página Fans, por exemplo `converted` |
| `list_id` | string | No | Apenas fãs dessa lista |
| `q` | string | No | Parte do nome ou username do fã |
| `spent_min` | number | No | Apenas fãs que gastaram pelo menos essa quantidade de Stars |
| `limit`, `cursor` | number, string | No | [Paginação](https://lanachat.ai/guides/pt/api-overview/) |

```bash
curl "https://api.lanachat.ai/v1/fans?creator_id=cr_lea&spent_min=1000&limit=50" \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

```json
{
  "data": [
    { "id": "fan_921", "display_name": "Marco", "username": "marco_dl", "creator_id": "cr_lea", "purchases": 9, "spent": { "stars": 1450, "net_cents": 1885 }, "lists": ["vip"] }
  ],
  "next_cursor": null
}
```

### Get a fan

`GET /fans/{id}` · `can_fan_read`

```bash
curl https://api.lanachat.ai/v1/fans/fan_921 \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

A resposta é o fan object. Um id desconhecido retorna `404`.

### Update a fan

`PATCH /fans/{id}` · `can_chat`

Envie apenas o que mudou: alias, idioma de resposta ou notas do fã. A resposta é o fã atualizado.

```bash
curl -X PATCH https://api.lanachat.ai/v1/fans/fan_921 \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"notes": "Likes beach sets, buys at night"}'
```

### List a fan's purchases

`GET /fans/{id}/sales` · `can_sales_read`

```bash
curl https://api.lanachat.ai/v1/fans/fan_921/sales \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

```json
{
  "data": [
    { "sale_id": "sale_8812", "fan_id": "fan_921", "creator_id": "cr_lea", "account_id": "acc_1001", "conversation_id": "conv_1001_88231", "stars": 300, "net_cents": 390, "sent_by": "ai", "kind": "offer" }
  ],
  "next_cursor": null
}
```

Uma lista paginada de sale objects. Para totais por dia, link ou origem, use [stats](https://lanachat.ai/guides/pt/api-tracking/).

### Import fan history

`POST /fans/import` · `can_fan_import`

Adiciona fãs antigos e suas mensagens ao seu histórico, por exemplo de outra ferramenta. Nunca envia mensagem para o fã e nunca confirma uma compra.

```bash
curl -X POST https://api.lanachat.ai/v1/fans/import \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d @fans-history.json
```

## Fan lists

### List fan lists

`GET /fan-lists` · `can_fan_read`

```bash
curl https://api.lanachat.ai/v1/fan-lists \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

```json
{
  "data": [ { "id": "vip", "name": "VIP" } ],
  "next_cursor": null
}
```

### Create a list

`POST /fan-lists` · `can_chat`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `name` | string | Yes | Nome exibido na página Fans |

```bash
curl -X POST https://api.lanachat.ai/v1/fan-lists \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name": "Win back"}'
```

A resposta é a nova lista (`201`).

### Add or remove fans

`POST /fan-lists/{id}/members` e `DELETE /fan-lists/{id}/members` · `can_chat`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `fan_ids` | array of strings | Yes | Fãs para adicionar ou remover |

```bash
curl -X POST https://api.lanachat.ai/v1/fan-lists/vip/members \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"fan_ids": ["fan_921"]}'
```

`DELETE` usa o mesmo corpo. Lista ou fã desconhecido retorna `404`.

## Conversations

### List conversations

`GET /conversations` · `can_fan_read`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `creator_id` | string | No | Apenas essa criadora |
| `account_id` | string | No | Apenas essa conta do Telegram |
| `state` | string | No | `ai`, `human`, `script` ou `off` |
| `unread` | boolean | No | `true`: só conversas com mensagens não lidas do fã |
| `limit`, `cursor` | number, string | No | [Paginação](https://lanachat.ai/guides/pt/api-overview/) |

```bash
curl "https://api.lanachat.ai/v1/conversations?creator_id=cr_lea&unread=true" \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

```json
{
  "data": [
    { "id": "conv_1001_88231", "fan_id": "fan_921", "creator_id": "cr_lea", "account_id": "acc_1001", "state": "ai", "status": { "tag": "active", "reason": null }, "unread": 2, "last_message_at": "2026-10-06T14:02:51Z", "spent": { "stars": 1450, "net_cents": 1885 }, "source_link_id": "lnk_3" }
  ],
  "next_cursor": null
}
```

### Get a conversation

`GET /conversations/{id}` · `can_fan_read`

```bash
curl https://api.lanachat.ai/v1/conversations/conv_1001_88231 \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

A resposta é o conversation object; `state` mostra quem está respondendo.

### Read messages

`GET /conversations/{id}/messages` · `can_fan_read`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `translate` | string | No | Código do idioma, por exemplo `en`: cada mensagem também recebe tradução |
| `limit`, `cursor` | number, string | No | [Paginação](https://lanachat.ai/guides/pt/api-overview/), mais recentes primeiro |

```bash
curl "https://api.lanachat.ai/v1/conversations/conv_1001_88231/messages?limit=2" \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

```json
{
  "data": [
    { "id": "msg_77120", "from": "creator", "sent_by": "ai", "text": "Made this one this morning…", "media": [ { "id": "med_5521", "locked": true, "stars": 300 } ], "at": "2026-10-06T14:02:51Z" },
    { "id": "msg_77119", "from": "fan", "text": "show me more 😍", "reactions": [], "at": "2026-10-06T14:02:10Z" }
  ],
  "next_cursor": "eyJpZCI6Im1zZ183NzExOCJ9"
}
```

O campo `sent_by` pode ser `ai`, `human` (com `member_id`) ou `script`.

### Send a message

`POST /conversations/{id}/messages` · `can_chat`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `text` | string | Yes, ou `media` | O texto, como a criadora |
| `media` | array | No | Mídia do Vault: `id` e `stars` para vender bloqueada por esse valor |
| `send_at` | string or null | No | Horário ISO 8601 para agendar, até 7 dias; `null` envia agora |

```bash
curl -X POST https://api.lanachat.ai/v1/conversations/conv_1001_88231/messages \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"text": "Only for you, tonight 🔥", "media": [{"id": "med_5522", "stars": 250}], "send_at": null}'
```

```json
{ "id": "msg_77121", "from": "creator", "sent_by": "human", "token_id": "tok_31", "status": "queued", "at": "2026-10-06T14:03:30Z" }
```

- Uma mensagem enviada pela API conta como enviada por uma pessoa (`sent_by: "human"`, com o token que enviou) e assume a conversa (`state: "human"`) até você devolver.
- O campo `status` passa por `queued`, `sent`, depois `read`; `failed` traz o motivo do Telegram (por exemplo flood wait).
- `send_at` agenda a mensagem (até 7 dias).

### React to a message

`POST /conversations/{id}/reactions` · `can_chat`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `message_id` | string | Yes | Mensagem do fã |
| `emoji` | string | Yes | A reação |
| `on` | boolean | Yes | `true` adiciona, `false` remove |

```bash
curl -X POST https://api.lanachat.ai/v1/conversations/conv_1001_88231/reactions \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"message_id": "msg_77119", "emoji": "❤️", "on": true}'
```

### Take over

`POST /conversations/{id}/takeover` · `can_chat`

```bash
curl -X POST https://api.lanachat.ai/v1/conversations/conv_1001_88231/takeover \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"
```

```json
{ "id": "conv_1001_88231", "state": "human", "taken_by": "tok_31", "taken_at": "2026-10-06T14:04:00Z" }
```

A IA para de responder esse fã até você devolver a conversa.

### Give back to the AI

`POST /conversations/{id}/release` · `can_chat`

```bash
curl -X POST https://api.lanachat.ai/v1/conversations/conv_1001_88231/release \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"
```

A resposta é a conversa com `state: "ai"`. Uma conversa em `off` por segurança não pode ser devolvida (`409`).

### Run a script

`POST /conversations/{id}/script` · `can_chat`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `script_id` | string | Yes | Um script da mesma criadora, veja [Scripts](https://lanachat.ai/guides/pt/api-scripts/) |

```bash
curl -X POST https://api.lanachat.ai/v1/conversations/conv_1001_88231/script \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"script_id": "scr_204"}'
```

Enquanto roda, o campo `state` da conversa fica `script`.

### Mark as read

`POST /conversations/{id}/read` · `can_chat`

```bash
curl -X POST https://api.lanachat.ai/v1/conversations/conv_1001_88231/read \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"
```

O campo `unread` da conversa volta para `0`.

## Artigos relacionados

- [API LanaChat: início rápido, autenticação e erros](https://lanachat.ai/guides/pt/api-overview/)
- [Live Convs: ler, responder e assumir](https://lanachat.ai/guides/pt/live-convs/)
- [Fans: listas, status e VIPs](https://lanachat.ai/guides/pt/fans/)
