# Pagination

All top-level API resources have support for bulk fetches via "list" API methods. For example, you can list `Actions`, `Partners`, and `Contracts`, among others. As these requests typically generate large result sets, these results are paginated and share a common structure detailing how the pages are structured. By default, requests return page 1 (the first page) and 1,000 results per page (though this may differ by resource). You can override these defaults by using the parameters below:

### Request parameters

| Name       | Description                                                                                                               |
| ---------- | ------------------------------------------------------------------------------------------------------------------------- |
| `Page`     | The page you are requesting be returned. Page choice starts at 1. Page `1` will be returned if no `Page` is specified.    |
| `PageSize` | Specify how many objects should be returned on each page. If not specified, the resource default amount will be returned. |

To make the pages easy to traverse, impact.com list APIs also preconfigure URIs that point to other pages of interest within the result set. See the full set of pagination response parameters below.

### Response attributes

| Name                | Description                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------ |
| `@page`             | Current page number. Pages start at 1.                                                           |
| `@numpages`         | Total number of pages.                                                                           |
| `@pagesize`         | How many entities are in each page.                                                              |
| `@total`            | Total number of entities in the list.                                                            |
| `@start`            | Position in the overall list of the first item in this page. Zero indexed (first position is 0). |
| `@end`              | Position in the overall list of the last item in this page. Zero indexed (first position is 0).  |
| `@uri`              | URI of the current page.                                                                         |
| `@firstpageruri`    | URI for the first page of this result set.                                                       |
| `@nextpageuri`      | URI for the next page of this result set.                                                        |
| `@previouspageruri` | URI for the previous page of this result set.                                                    |
| `@lastpageruri`     | URI for the last page of this result set.                                                        |

#### Example pagination request

{% tabs %}
{% tab title="cURL" %}

```bash
curl 'https://api.impact.com/Mediapartners/<AccountSID>/Actions' \
  -X GET \
  -u '<AccountSID>:<AuthToken>' \
  -H 'Accept: application/json' \
  -d 'CampaignId=1017' \
  -d 'PageSize=100' \
  -d 'Page=2' \
  -G
```

{% endtab %}
{% endtabs %}

#### Example pagination response

{% tabs %}
{% tab title="JSON" %}

```json
{
  "@page": "2",
  "@numpages": "2",
  "@pagesize": "100",
  "@total": "200",
  "@start": "100",
  "@end": "200",
  "@uri": "/Mediapartners/...",
  "@firstpageuri": "/Mediapartners/...",
  "@previouspageuri": "/Mediapartners/...",
  "@nextpageuri": "/Mediapartners/...",
  "@lastpageuri": "/Mediapartners/...",
  "Actions": [
    {
      ...
    },
    {
      ...
    }
  ]
}
```

{% endtab %}
{% endtabs %}

### Pagination limits

When using pagination, be aware of the following limits that apply to specific API endpoints.

#### For retrieving reports

Requests made to the /Reports API endpoint always return a page size of 20,000 results, regardless of the PageSize parameter specified. For clarity in your integrations, we recommend either of the following:

* Specify a `PageSize` of 20,000.
* Remove the `PageSize` parameter from the request.

#### For listing catalog items

Requests made to the following endpoint cannot page beyond a total of 20,000 results.

* `/Mediapartners/ACCOUNT_SID/Catalogs/CATALOG_ID/Items`

Any API call attempting to access a page beyond this limit (for example, requesting page 21 or a result set where `PageSize` is 1,000) will result in a `400 Bad Request`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://integrations.impact.com/partner-api-reference/readme/pagination.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
