In this guide, we will look at how to work with paginated responses when querying the Underdog API.

By default, all responses limit results to ten. However, you can go as high as 100 by adding a limit parameter to your requests.

When an API response returns a list of objects, no matter the amount, pagination is supported. In paginated responses, objects are nested in a results attribute and include four attributes to determine whether you have reach the end of the last page.

  • limit

  • page

  • totalPages

  • totalResults

You can use the limit and page query parameters to browse pages.

Example using cursors

In this example, we request the first page with at most one result. As a result, we get a list of one Collection and can tell by the totalResults and totalPages attributes that we have one more page of results.

limit integer

Limit the number of items returned.

page integer

The page number to return.

Manual pagination using cURL
curl "" \
        -H "Authorization: Bearer {token}"
Paginated response
    "page": 1,
    "limit": 1,
    "totalPages": 1,
    "totalResults": 2

Last updated