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

# Messaging & chats

> Read conversations, send messages, manage chats.

Messaging spans two resources: `chats` (the conversation list) and `messages`
(the contents of a thread).

<Tabs>
  <Tab title="SDK">
    ```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
    // List recent chats
    const chats = await of.chats.list({ limit: 20, order: "recent" });
    const first = chats.list[0];

    // Read a thread
    const msgs = await of.messages.list(first.withUser.id, { limit: 30 });

    // Send a message
    await of.messages.send(first.withUser.id, { text: "Hi!" });

    // Send a paid (PPV) message
    await of.messages.send(first.withUser.id, {
      text: "Unlock 👀",
      mediaFiles: [/* vault media ids */],
      price: 15,
      lockedText: false,
    });
    ```
  </Tab>

  <Tab title="Hosted API">
    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    # List chats
    curl "https://api.onlyfanskit.dev/v1/accounts/$ID/chats/list?limit=20&order=recent" \
      -H "Authorization: Bearer $OFK_KEY"

    # Send a message
    curl -X POST https://api.onlyfanskit.dev/v1/accounts/$ID/messages/send \
      -H "Authorization: Bearer $OFK_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "args": [123456, { "text": "Hi!" }] }'
    ```
  </Tab>
</Tabs>

## Common operations

| Want to                  | Call                                                   |
| ------------------------ | ------------------------------------------------------ |
| List conversations       | `chats.list({ limit, order })`                         |
| Read a thread            | `messages.list(userId, { limit })`                     |
| Send a message           | `messages.send(userId, { text, mediaFiles?, price? })` |
| Search within a chat     | `chats.searchMessages(userId, query)`                  |
| Mark read                | `messages.markRead(userId)` / `chats.markRead(userId)` |
| Delete a message         | `messages.delete(userId, messageId)`                   |
| React (like / pin)       | `messages.like(...)`, `messages.pin(...)`              |
| Unread / priority counts | `chats.priorityCounts()`                               |

For sending to many fans at once, see [Mass messaging](/guides/mass-messaging).

<Note>
  Message ids are numeric, and user ids are the fan's OnlyFans id. The full
  parameter shapes are documented inline in the SDK — point your editor at the
  `messages` and `chats` resources for JSDoc on each method.
</Note>
