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

# Pagination and sorting

> Page through list queries and change their order.

## Pagination

Every list query (for example `grants` or `disclosures`) accepts `page` and `limit` arguments and returns a `collection` plus `metadata`.

```graphql
query GrantsPage {
  grants(page: 2, limit: 50) {
    collection { id grantNumber }
    metadata { currentPage totalPages totalCount hasNextPage nextPage }
  }
}
```

* `page` starts at 1. Omitting it, or passing 0, returns the first page.
* `limit` defaults to 20. The maximum is 500, and larger values return 500 records.

To read every record, request `page: 1`, then keep requesting `metadata.nextPage` until `hasNextPage` is `false`.

## Sorting

List queries accept `sortField` and `sortDirection`.

```graphql
query DisclosuresByNumber {
  disclosures(sortField: "disclosure_number", sortDirection: ASC) {
    collection { id disclosureNumber title }
  }
}
```

* `sortField` takes a field name in snake\_case. Each query supports its own set of fields, listed on the `sortField` argument in the [API Reference](/api-reference). Any other value returns an error with `extensions.status` 400 and the list of allowed fields.
* `sortDirection` is `ASC` or `DESC`.
* Most queries default to `created_at`, newest first. `contacts` defaults to `full_name` A–Z, and `organizations` and `products` default to `name` A–Z.