---
title: Pagination
description: Offset-based pagination patterns
url: https://docs.intuition.systems/docs/v1/graphql-api/queries/advanced/pagination
markdown_url: https://docs.intuition.systems/docs/v1/graphql-api/queries/advanced/pagination.md
version: V1
llms_index: https://docs.intuition.systems/docs/v1/llms.txt
---

Implement efficient offset-based pagination with total counts.

## Pagination - Query Structure

```graphql
query GetAtomsPage($limit: Int!, $offset: Int!) {
  total: atoms_aggregate {
    aggregate {
      count
    }
  }
  atoms(
    limit: $limit
    offset: $offset
    order_by: { created_at: desc }
  ) {
    term_id
    label
    created_at
  }
}
```

## Variables

```json
{
  "limit": 20,
  "offset": 40
}
```

This fetches page 3 (items 41-60) when using 20 items per page.

## Best Practices

1. **Always include order_by** for consistent pagination
2. **Fetch total count** using aggregates
3. **Use reasonable limits** (10-100 items per page)
4. **Calculate offset** as `(page - 1) * limit`
