Pagination

Pagination

To enchance API performance, several collection endpoints support pagination. To use this feature add a page and, optionally, a per parameter to the URL's query string. For example, the following url...

https://api.gusto.com/v1/companies/abc123/employees?page=2&per=5

...will return the second page of five employees of the company identified by the UUID abc123. If the per parameter is not provided, the API will return 25 records per page by default, unless otherwise specified.

Information on whether a given endpoint supports pagination parameters can be found on its respective page in the documentation.

Paginated responses

If pagination parameters are provided in the request, some metadata about the paginated collection will be returned in the response's headers.

X-Page: 3
X-Total-Count: 542
X-Total-Pages: 22
X-Per-Page: 25

Here's a summary of the meaning of each of these headers:

HeaderDescriptionExample
X-PageThe current page being returned3
X-Total-CountThe total number of records in the full collection542
X-Total-PagesTotal number of pages for this collection22
X-Per-PageNumer of records currently being returned per page25

Did this page help you?