# list_messages

Source: https://modulify.ai/docs/api/chat/list-messages

Reads the conversation between the site owner and the agent that builds the site.

- Title: Read site chat history
- Scope: `chat:read`
- Access: Read only
- Endpoint: `POST /v1/list_messages`

One call returns the 10 newest messages, ordered oldest first inside that page, alongside `hasMore` and `oldestCursor`. While `hasMore` is true, send `oldestCursor` back as `cursor` to get the 10 before those, and repeat until it is false. A cursor in any other shape is refused with `That page cursor is not valid. Ask for the first page instead!`

Messages still queued to run are left out, and `list_queued_messages` reads those. Use it to see what has already been asked and built before sending a new message. See [Site chat](https://modulify.ai/docs/build/site-chat).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/list_messages`, sending the inputs below as a JSON object. The token needs the `chat:read` scope.

It only reads and changes nothing, so retrying it is safe.

```bash
curl -X POST https://api.modulify.ai/v1/list_messages \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID"}'
```

Over MCP, the same method is the [list_messages tool](https://modulify.ai/docs/mcp/chat/list-messages).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `cursor` | object | No | The `oldestCursor` object from the previous response, with the fields `Created_At` and `Id`. Leave it out to read the newest page. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.