Paginate Results

API v56.0 and later

GraphQL API returns the first 10 results of a query by default. Based on the GraphQL Cursor Connections Specification, the Connection object contains the returned object and the node (account, for example), totalCount, and resultPageCount objects. Additionally, the pageInfo object contains cursor information and if there are more results to return.

Within the RecordQuery type, each field is a Relay Record Connection type. Connections enable paging through the result set with ease. Connections are made up of four types:

  • Connection: The root object for the paged collection, which ties together the result set with the PageInfo type. The Connection type is specific to the type of resource being paged, for example when paging through Account objects the Connection type is AccountConnection.
  • Edge: Ties together the actual record result type, for example Account. Includes a cursor that points to the specific location in the result set and the Node type.
  • Node: The actual resource being paged.
  • PageInfo: Contains relative position information, which shows where in the entire result set the current page is located. The PageInfo type is the same for every Connection type.

Use pagination several ways.