Skip to content
Docs

Offset Based

The Offset Based pager walks a paginated API by offset and limit. It runs the sub-graph wired to its iteration handle once per page, advancing the offset each round, until the end condition is met. 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 Offset Based node's settings form, with the fields described below
The Offset 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).
Start offset (startOffset)integer ✦ (optional) 0 The record offset the first page starts at — normally 0; nextOffset computes the rest.
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.
Next offset (nextOffset)integer ✦ (optional) — The record offset for the page that is about to run.
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.
$page->startData["nextOffset"] The record offset for the page currently running.

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

Fetch every record from an API that accepts ?offset=0&limit=50:

  1. Configure the pager:

    startSize: 50
    startOffset: 0
    endCondition: $page->index == 100 || count($page->prevOutput->data) == 0
  2. Wire a Transformer to the iteration handle to build the request parameters:

    @json
    {
    "offset": "$.page.startData.nextOffset",
    "limit": "$.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.

  • 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.