> ## Documentation Index
> Fetch the complete documentation index at: https://developer.sandbox.co.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Learn how to retrieve paginated data using page_size and last_evaluated_key.

List endpoints may return paginated results. When a response includes `last_evaluated_key`, more items are available. Include this value in subsequent requests to fetch the next page.

<Note>
  Pagination is forward-only. You cannot navigate to previous pages.
</Note>

## How pagination works

<Steps>
  <Step title="Send initial request">
    Send a request with `page_size` to specify how many items you want per page.
  </Step>

  <Step title="Receive first page">
    The response includes `items` and `last_evaluated_key` if more pages exist.
  </Step>

  <Step title="Request next page">
    Include the `last_evaluated_key` from the previous response in your next request.
  </Step>

  <Step title="Repeat until complete">
    Continue until the response doesn't include `last_evaluated_key`, indicating you've reached the last page.
  </Step>
</Steps>

```mermaid theme={null}
sequenceDiagram
    participant Client
    participant Server
    
    Client->>Server: Request with page_size
    Server->>Client: items + last_evaluated_key
    
    Client->>Server: Request with last_evaluated_key
    Server->>Client: items + last_evaluated_key
    
    Client->>Server: Request with last_evaluated_key
    Server->>Client: items (no last_evaluated_key)
    
    Note over Client: End of results
```

## Request parameters

<ParamField body="page_size" type="integer">
  Maximum items to return per page (up to 50)
</ParamField>

<ParamField body="last_evaluated_key" type="string">
  Cursor from previous response to fetch the next page
</ParamField>

## Response fields

<ParamField path="items" type="array">
  Results for the current page
</ParamField>

<ParamField path="last_evaluated_key" type="string">
  Present only when more pages exist. Include in your next request to continue.
</ParamField>

## Example

### First request

```json theme={null}
{
  "@entity": "in.co.sandbox.tds.reports.jobs.search",
  "tan": "AHMQ00112A",
  "quarter": "Q1",
  "form": "24Q",
  "financial_year": "FY 2024-25",
  "from_date": 1765530000000,
  "to_date": 1765536568538,
  "page_size": 10
}
```

### First response

```json theme={null}
{
  "code": 200,
  "timestamp": 1715757773000,
  "transaction_id": "109469b2-0748-4135-a569-e86fc9e45756",
  "data": {
    "@entity": "in.co.sandbox.tds.reports.paginated_list",
    "items": [
      { /* job item */ },
      { /* job item */ }
    ],
    "last_evaluated_key": "ZDVkMzAyZmUtMWFjYS00YjkxLTgyMWUtMTQxYmM4ZGE1NmNmIA=="
  }
}
```

### Next request

Include the `last_evaluated_key` from the previous response:

```json theme={null}
{
  "@entity": "in.co.sandbox.tds.reports.jobs.search",
  "tan": "AHMQ00112A",
  "quarter": "Q1",
  "form": "24Q",
  "financial_year": "FY 2024-25",
  "from_date": 1765530000000,
  "to_date": 1765536568538,
  "page_size": 10,
  "last_evaluated_key": "ZDVkMzAyZmUtMWFjYS00YjkxLTgyMWUtMTQxYmM4ZGE1NmNmIA=="
}
```
