API Pagination

Overview

Some endpoints return a list of resources. You can use limit and page query parameters to fetch different pages of results.


Limit Param

You can fetch different pages of results by including a limit query parameter in your request.

https://api.ittybit.com/files?limit=5

The default limit is 20.

The minimum limit is 1 and the maximum limit is 100.


Page Param

You can fetch different pages of results by including a page query parameter in your request.

https://api.ittybit.com/files?page=2

The default page is 1.

If you set the page to a number that doesn't exist, you will receive an empty list.


Query Params

You can combine the limit and page query params to fetch different pages of results.

https://api.ittybit.com/files?limit=5&page=2


Paginated Responses

response.json
{
  "meta":{
    "request_id": "req_abcdefghij1234567890",
    "kind": "list",
    "limit": 20,
    "total": 100,
    "page": 2,
    "pages": 5
  },
  "data": [
    // { ... file object },
    // { ... file object },
    // ... etc
  ],
  "links": {
    "self": "https://api.ittybit.com/files?page=2",
    "first": "https://api.ittybit.com/files?page=1",
    "prev": "https://api.ittybit.com/files?page=1",
    "next": "https://api.ittybit.com/files?page=3",
    "last": "https://api.ittybit.com/files?page=5",
  }
}

Meta

In these cases, the meta prop will include the additional props:

  • limit integer

    The maximum number of resources returned per page

  • total integer

    The total number of resources available

  • page integer

    The current page

  • pages integer

    The total number of pages available


The links prop will include:

  • self string

    The URL to refetch the current page

  • first string

    The URL to fetch the first page

  • next string | null

    The URL to fetch the next page

  • prev string | null

    The URL to fetch the previous page

  • last string

    The URL to fetch the last page

On this page