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

# Pagination

> Learn how to handle paginated responses in the NeetoPlaydash API.

## Pagination Parameters

You can control pagination using the following query parameters:

<ParamField query="page_number" type="integer">
  The page of results you want to retrieve (starting from 1).
</ParamField>

<ParamField query="page_size" type="integer">
  The number of items to return per page.
</ParamField>

## Example Usage

Here's how to retrieve paginated results using cURL:

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url "https://{your-subdomain}.neetoplaydash.com/api/external/v1/projects?page_number=2&page_size=25" \
    --header 'X-Api-Key: your-api-key'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://{your-subdomain}.neetoplaydash.com/api/external/v1/projects?page_number=2&page_size=25",
    {
      method: "GET",
      headers: {
        "X-Api-Key": "your-api-key",
        "Content-Type": "application/json",
      },
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  url = "https://{your-subdomain}.neetoplaydash.com/api/external/v1/projects"
  params = {
      "page_number": 2,
      "page_size": 25
  }
  headers = {
      "X-Api-Key": "your-api-key",
      "Content-Type": "application/json"
  }

  response = requests.get(url, params=params, headers=headers)
  data = response.json()
  print(data)
  ```
</CodeGroup>

This retrieves the second page of projects, with 25 results per page.

## Response Structure

Paginated responses include metadata about the pagination in JSON format:

```json Response Example theme={null}
{
  "projects": [
    // ... array of project objects
  ],
  "pagination": {
    "total_records": 150,
    "current_page_number": 2,
    "total_pages": 6,
    "page_size": 25
  }
}
```

<ResponseField name="pagination.total_records" type="integer">
  The total number of items across all pages.
</ResponseField>

<ResponseField name="pagination.current_page_number" type="integer">
  The current page number (if pagination was used).
</ResponseField>

<ResponseField name="pagination.total_pages" type="integer">
  The total number of pages available (if pagination was used).
</ResponseField>

<ResponseField name="pagination.page_size" type="integer">
  The number of items per page.
</ResponseField>

## Default Behavior

<Note>
  If pagination parameters are not provided, default values will be applied:

  * **page\_number**: 1 (first page)
  * **page\_size**: varies by endpoint. Each endpoint's reference page documents its default and maximum page size.
</Note>

## Best Practices

1. **Start with reasonable page sizes**: Use page sizes between 10-100 items for optimal performance.
2. **Handle empty results**: Always check if the returned array is empty to detect the end of data.
3. **Use total\_records**: Use the `pagination.total_records` field to calculate the total number of pages needed.
4. **Implement error handling**: Handle cases where the requested page doesn't exist.
