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

# Pagination and sorting

> Lists come a page at a time, with the total.

The invoice, deposit and card payment lists answer a page at a time. Ask with query parameters:

| Parameter | Means | Default |
| - | - | - |
| `page` | Which page, from 1. | `1` |
| `pageSize` | Items per page, up to 100. | `25` |
| `sort` | What to sort by. Each list's values are in the API reference. | The list's own, usually newest first |
| `dir` | `asc` or `desc`. | `desc` for the default sort |

```bash theme={null}
curl "https://api.paymentsmojo.com/deposits?page=2&pageSize=50&sort=date&dir=desc" -H "Authorization: Bearer eyJ…"
```

Every page comes in the same envelope:

```json theme={null}
{
  "items": [ … ],
  "page": 2,
  "pageSize": 50,
  "total": 137,
  "sort": "date",
  "dir": "desc"
}
```

* `total` counts every item that matches, across all pages. There are `ceil(total / pageSize)` pages.
* Read until a page comes back with fewer than `pageSize` items.
* Values out of range fall back to the defaults: `pageSize=500` gives 100, and an unknown `sort` gives the default.
* Ties are broken the same way every time, so pages never repeat or skip an item. Items created while you're paging
  can still shift later pages: for a complete pass, sort oldest first or page by date.

Shorter lists, such as locations and MIDs, come back whole as a JSON array.


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