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

> ## Agent Instructions
> Melso product MCP: https://melso.ai/api/mcp (OAuth; one company per grant). REST: https://melso.ai. Documentation-search MCP: https://docs.melso.ai/mcp. The docs search server does not act on customer accounts.
>
> Use the live tool schema and respect company membership. Ask the person to authorize the exact fiscal document version in the signed-in app. A professional prepares and files included returns after authorization; AI does not file alone. A prepared file or approval receipt is not evidence of filing. Never claim completion from an accepted Task or Run. Keep credentials out of chat and logs. Agents features are internal or by private invitation.

# Pagination

> Use the pagination contract returned by each collection.

<Info>Melso Agents is available only internally or by private invitation. Agents-specific features require existing access. For the autónomo fiscal service, see [Get started](/essentials/quickstart).</Info>

Melso has no universal list envelope. Read the endpoint’s response type before iterating.

## Tasks: limit and offset

`GET /api/tasks` accepts `limit` (default and maximum 100) and `offset`, and returns `tasks` with `total`. Set `MELSO_URL` and `MELSO_API_KEY` as in the [quickstart](/api-reference/quickstart).

```bash theme={null}
curl --fail-with-body "$MELSO_URL/api/tasks?limit=20&offset=0" \
  -H "Authorization: Bearer $MELSO_API_KEY"
```

Increase `offset` by the number of rows received. Stop at an empty page or when you have read `total`. New writes can change the result between requests; deduplicate by Task ID when you need a stable local view.

## Conversation messages: a two-field cursor

`GET /api/tasks/{id}/messages/page` returns `messages`, `limit`, `has_more`, and `next_cursor`. The first page contains the newest messages. When `has_more` is true, pass the returned cursor’s `created_at` and `id` as `before_created_at` and `before_id`, respectively.

Set `TASK_ID` to your Task UUID, and the two cursor values to `next_cursor.created_at` and `next_cursor.id` from the previous response:

```bash theme={null}
export TASK_ID='YOUR_TASK_UUID'
export BEFORE_CREATED_AT='CREATED_AT_FROM_NEXT_CURSOR'
export BEFORE_ID='ID_FROM_NEXT_CURSOR'
curl --fail-with-body --get "$MELSO_URL/api/tasks/$TASK_ID/messages/page" \
  -H "Authorization: Bearer $MELSO_API_KEY" \
  --data-urlencode "limit=50" \
  --data-urlencode "before_created_at=$BEFORE_CREATED_AT" \
  --data-urlencode "before_id=$BEFORE_ID"
```

Set the two cursor variables from `next_cursor`; do not construct a timestamp from the last message alone. [Messages and interactions](/concepts/messages-interactions) describes ordering and compatibility routes.

Other collections may return a bare array or a resource-specific envelope. An array does not imply offset support.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.