> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api-docs.papertracc.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api-docs.papertracc.com/_mcp/server.

# Overview

List endpoints — invoices, receipts, bills, credit notes, debit notes, expenses, and similar collections — use cursor-based pagination. There is no `page` parameter; you page through a collection by passing back a cursor from the previous response.

## Request parameters

| Parameter | Description                                                                                                                                      |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `size`    | Number of records to return. Defaults to 20, capped at 50.                                                                                       |
| `last_id` | The `last_id` from the previous response. Omit it (or leave it empty) to fetch the first page.                                                   |
| `keyset`  | The `keyset` from the previous response. Always send it together with `last_id` — both come from the same page and are meaningless on their own. |

`last_id` and `keyset` are opaque tokens. Don't parse them or construct them yourself — treat them as values to copy from one response into the next request.

## Fetching the first page

Omit `last_id` and `keyset` entirely:

```bash
curl "https://api.papertracc.com/invoices?size=20" \
  -H "Authorization: Bearer $API_KEY" \
  -H "identity: $WORKSPACE_IDENTITY"
```

## Response shape

```json
{
  "status": true,
  "message": "Successfully fetched invoices lists",
  "data": [
    { "id": "004c2905-c598-4d12-8600-cf46d8cbaecd", "invoice_reference": "INV-0165", "...": "..." }
  ],
  "keyset": "MjAyNi0wOS0yM1QxMTowNTowNS43NDM1NDda",
  "last_id": "004c2905-c598-4d12-8600-cf46d8cbaecd"
}
```

## Fetching subsequent pages

Pass the `last_id` and `keyset` you got back straight through as query parameters:

```bash
curl "https://api.papertracc.com/invoices?size=20&last_id=004c2905-c598-4d12-8600-cf46d8cbaecd&keyset=MjAyNi0wOS0yM1QxMTowNTowNS43NDM1NDda" \
  -H "Authorization: Bearer $API_KEY" \
  -H "identity: $WORKSPACE_IDENTITY"
```

Keep requesting the next page with the `last_id`/`keyset` pair from each response. You've reached the end of the collection when a response comes back with `last_id: null` — stop there rather than counting pages.

These endpoints don't support offset or page-number pagination. A `page` (or `offset`) parameter is not read and is silently ignored — the response will just be the first page again. Always drive pagination off `last_id`/`keyset`, never a page count.

## Sorting

Paginated collections are always returned newest first (`created_at` descending). A `sort_by`/`sort_order` parameter isn't honored on these endpoints: the cursor is anchored to `created_at`, so sorting by a different column would desync the cursor from the sort order and produce skipped or repeated rows across pages.