Skip to main content

Pagination

Our GraphQL API loosely follows the GraphQL Cursor Connections Specification made popular by Relay. When results need to be paginated, the query or field will accept first: Int and after: String where first is an optional number of results to return and after is an optional endCursor from a previous page. We return a Result type with two sibling fields: nodes (the list of results) and pageInfo. Learn more about the PageInfo type here.

At this time, we only support forward paging.

A page can contain fewer nodes than first, or none, while pageInfo.hasNextPage is still true. Keep requesting pages with after set to the previous pageInfo.endCursor until hasNextPage is false. Do not stop at the first short or empty page.

Example Paginated Query
{
benefitTemplates(first: 10, after: "34w5yh456we56u") {
... on BenefitTemplatesResults {
nodes {
id
name
type
}
pageInfo {
endCursor
hasNextPage
}
}
}
}