Pular para o conteúdo principal

Paginating through any endpoint

Most endpoints that return lists support consistent pagination parameters and metadata. Use these controls to page through results without missing data or fetching more than you need.

Query parameters

  • limit – number of items to return in a single request. Defaults vary per endpoint.
  • page – zero-based index of the page to fetch.
  • order – when supported, choose ASC or DESC to control sort order.

These parameters behave exactly the same across endpoints such as /breeds, /breeds/{breed_id}/facts, /images/search, and more. Combine them with any other filters that an endpoint accepts.

Response headers

Every paginated response includes the following HTTP headers:

  • pagination-count – total number of items that match the filters you supplied.
  • pagination-page – the zero-based page index that was returned.
  • pagination-limit – the limit that was applied to the response.

Together, these headers let you calculate the total number of available pages and implement client-side pagination UI.

Example

The facts endpoint uses the same pagination structure:

curl --location 'https://api.thedogapi.com/v1/breeds/115/facts?limit=1&page=0&order=ASC&lang=it' \\
--header 'x-api-key: YOUR-API-KEY'

Relevant response headers:

pagination-count: 10
pagination-page: 0
pagination-limit: 1

Use limit and page together to page through the ten available German Shepherd facts.