Pagination
How the after argument and the pageInfo object of the Prescient GraphQL API split a large result into pages of 5,000 rows.
The modeledMetrics and reportedMetrics queries return their rows in pages. One page has 5,000 rows at most, and you cannot change the page size. The channelNames and models queries return the full list in one response.
How do you get the next page?
Section titled “How do you get the next page?”Each paged response has a PageInfo object with two fields.
hasNextPagetells you if there is one more page.endCursoris the value that you send as theafterargument to get that page.
Send the first request with no after argument. While hasNextPage is true, send the same query again with after set to the endCursor of the last response.
query ReportedMetrics($after: BigInt) { reportedMetrics(startDate: "2026-01-01", endDate: "2026-01-31", after: $after) { data { reportedDate campaignId spend } pageInfo { endCursor hasNextPage } }}{ "after": "5000"}The cursor in this example is an example. Use the value from your response.
What are the rules for a cursor?
Section titled “What are the rules for a cursor?”- Send the cursor as you received it. Do not build a cursor and do not change one.
- Send the cursor as a string. A cursor can be a number that is too large for a JavaScript number, and a JSON parser can change such a number.
- Keep each other argument the same from page to page. A cursor is for one query with one set of arguments.
- Use a cursor only with the query that returned it. A
modeledMetricscursor does not work withreportedMetrics.
When do you stop?
Section titled “When do you stop?”Stop when hasNextPage is false.
- When a page has no rows,
endCursorisnull. - For
reportedMetrics,hasNextPageistrueeach time a page is full. If the number of rows is an exact multiple of 5,000, the last request returns no rows andhasNextPageisfalse. Your code must accept an empty page.
In which order do the rows come?
Section titled “In which order do the rows come?”The schema does not define the order of the rows, so do not rely on it. channelNames and models also have no defined order. Sort the rows in your own code if you need an order.