Pagination

In this guide, we will look at how to work with paginated responses when querying the Fystack API. By default, all responses limit results to 20. However, you can go as high as 100 by adding a limit parameter to your requests. If you are using one of the official Fystack API client libraries, you don't need to worry about pagination, as it's all being taken care of behind the scenes.

When an API response returns a list of objects, no matter the amount, pagination is supported. In paginated responses, objects are nested in a data attribute. You can use the offset and limit query parameters to browse pages.

Example using offset pagination

In this example, we request the first page of networks with a limit of 10 items. You can navigate through pages by adjusting the offset value. For example, to get the second page, you would use offset=10 when your limit is 10.

  • Name
    offset
    Type
    integer
    Description

    The number of items to skip before starting to collect the result set.

  • Name
    limit
    Type
    integer
    Description

    Limit the number of items returned per page.

Pagination using cURL

curl -G https://api.fystack.com/v1/networks \
  -H "Authorization: Bearer {token}" \
  -d offset=0 \
  -d limit=10

Paginated response

{
  "data": [
    {
      "id": "WAz8eIbvDR60rouK",
      // ...
    },
    {
      "id": "hSIhXBhNe8X1d8Et"
      // ...
    },
    {
      "id": "fbwYwpi9C2ybt6Yb"
      // ...
    }
    // ... 7 more items
  ]
}