Skip to content
Docs

Page Based

The Page Based pager walks a paginated API by page number. It runs the sub-graph wired to its iteration handle once per page, advancing the page number each round, until the end condition is met. Use it for APIs that accept page=1, page=2, and so on; for offset + limit APIs, use Offset Based. You find it on the node picker’s Pagers shelf.

The node has three handles: input accepts the upstream node’s output, iteration holds the sub-graph that runs once per page, and output activates after the last page, emitting the result chosen by outputMode.

The Page Based node's settings form, with the fields described below
The Page Based node's settings form, with the fields described below
FieldTypeDefaultDescription
Start page (startPage)integer ✦ (optional) 0 The page number the first page requests — set it to whatever the API calls its first page (0 or 1).
Start size (startSize)integer ✦ (optional) 10 How many records to request per page (the page size or limit).
Next page (nextPage)integer ✦ (optional) — The page number for the page that is about to run. Despite the name it is evaluated for every page, including the first — at page index 0 it is the start page.
Next size (nextSize)integer ✦ (optional) — The page size for the page that is about to run — normally just the start size.
End condition (endCondition)boolean ✦ (optional) — When this is true, no further page is queued — the page that produced it has already run. The default stops once the page index reaches 10.
Output mode (outputMode)one of combine, summary ✦ (optional) summary What this node outputs once every page has run: “combine” emits each page’s output in page order; “summary” emits only {“count”: n}.
Next page property (nextPageProperty)string ✦ (optional) — Reserved. The engine does not currently read this field — leave it empty.
Next size property (nextSizeProperty)string ✦ (optional) — Reserved. The engine does not currently read this field — leave it empty.

Fields marked ✦ accept expressions.

Try this node — run it once against your own workspace, with your credentials, without building a flow first.

Before each page runs, the pager evaluates the next* fields and freezes the results into that page’s start data. They see only $page->index and the pager’s own start configuration, never the previous page’s response. endCondition is the one field that reads $page->prevOutput, the output of the page that just finished. Write the integer and boolean fields bare, without {{ }} braces; echo braces produce a string, which those fields reject.

outputMode decides what the output handle emits once every page has run:

Mode Emits
summary {"count": n}, the number of pages that ran. This is the default.
combine Every page’s output, in page order, as one JSON array.

With the default, a node wired to the output handle sees the count and not the records. Set combine when something after the pager must read them; keep summary when the body already did the work, since the combined aggregate is stored in the run log.

The node wired to the output handle receives the result as $prev. Any node further down reads the same result by the pager’s name, for example $workflow->node('Fetch all orders').

Inside the iteration sub-graph, expressions read the current page through $page:

Path Description
$page->index Zero-based page counter.
$page->startData["nextPage"] The page number for the page currently running.
$page->startData["nextSize"] The page size for the page currently running.

Inside a @json block the same values are reached as JSONPath strings: "$.page.startData.nextPage" is the @json spelling of the page number. See Connectors for the full $page reference.

Fetch every page from a GitHub-style API that accepts ?page=1&per_page=30:

  1. Configure the pager:

    startPage: 1
    startSize: 30
    endCondition: $page->index == 100 || count($page->prevOutput->items) == 0

    That stops when the items array in the response is empty, with a 100-page bound so a misbehaving API cannot page forever.

  2. Wire a Transformer to the iteration handle to build the request parameters:

    @json
    {
    "page": "$.page.startData.nextPage",
    "per_page": "$.page.startData.nextSize"
    }
    @endjson
  3. Connect the Transformer to a REST Request or OpenAPI Operation that calls the API with those parameters, and wire the response into whatever processes it.

Each page is a separate activity in the run view, so you can see exactly where pagination stopped.

A run report for Import carrier invoices: the Every page of invoices Page Based step with a count of 3, and its three pages nested under it, each with its Fetch a page call, the third returning an empty list
A run report for Import carrier invoices: the Every page of invoices Page Based step with a count of 3, and its three pages nested under it, each with its Fetch a page call, the third returning an empty list
  • Cursor pagination is not supported. The next* values are frozen before a page runs, so the pager cannot take a next_cursor out of one response and feed it to the next request. The nextPageProperty and nextSizeProperty fields look like they do this, but nothing reads them; they are reserved and safe to leave empty.
  • An endCondition that never becomes true pages forever. Keep a page-index bound such as $page->index == 100 in the condition even when you also test the response.