How to make a paginated request

You can make paginated requests using query parameters. The parameters enable pagination and determine how many results should be in each page.

The following endpoints support pagination:

Parameters

paginate - boolean. Set as true to enable pagination. Default is false.

pageSize - integer. The number of results on each page. Default is 100 and max is 750.

Iterating through pages

Responses will contain links to the next and previous page of results (if applicable). You can use those links to iterate through the pages.

The following properties will be included in the response body of a paginated request:

nextPageUrl - string. The URL that can be used to get the next page of results (if there is a next page).

previousPageUrl - string. The URL that can be used to get the previous page of results (if there is a previous page).

Example

This example will use pagination for the Detailed Returns List.

Request

curl --request GET \
  --url 'https://api.loopreturns.com/api/{version}/warehouse/return/list?paginate=true&pageSize=50&from=2023-01-01%2000%3A00%3A00&to=2023-12-12%2000%3A00%3A00&filter=created_at&state=open' \
  --header 'X-Authorization: <api-key>'

Response

{
  "returns": [...],
  "nextPageUrl": "https://api.loopreturns.com/api/v1/warehouse/return/list?to=2022-07-28%2000%3A00%3A00&filter=created_at&pageSize=5&cursor=eyJjcmVhdGVkX2F0IjoiMjAyMi0wNi0yNyAxNjoyNTowMSIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
  "previousPageUrl": null
}

If there are no more results, nextPageUrl will be null. On the first page, previousPageUrl will be null.