Pagination and lookups
Pagination
Add paginate: to a list operation (or a lookup, or a poll trigger). The runtime then fetches
pages until a stop condition is met, collects the elements from each page, and handles the
return_all / limit parameter pair.
params:
- { name: return_all, type: boolean, default: false }
- { name: limit, type: number, default: 50 }
paginate:
strategy: cursor
items: "$.results"
# strategy-specific keys below
max_pages: 100
max_items: 50000
With return_all: false, fetching stops as soon as limit elements are collected, and the
output is truncated to limit.
Strategies
| Strategy | Keys | Typical API |
|---|---|---|
cursor | cursor_from (JSONPath in the body, or header:<name>), cursor_param, cursor_in (query or body) | next_cursor, response_metadata.next_cursor, after |
token_in_body | Same as cursor, with the token in the request body | pageToken in a POST search body |
next_url | next_url_from (JSONPath to an absolute URL) | "next": "https://api.example.com/items?page=3" |
link_header | none | Link: <...>; rel="next" (RFC 8288) |
offset_limit | offset_param, limit_param, page_size, start (default 0) | ?offset=200&limit=100 |
page_number | page_param, page_size_param, page_size, start (default 1) | ?page=3&per_page=100 |
Templates in the request can use page.index, page.number, page.offset and page.cursor
when the API needs them somewhere unusual:
request:
method: GET
path: /items
query: { page: "{{ page.number }}", per_page: 100 }
paginate:
strategy: page_number
start: 1
items: "$.items"
has_more: "{{ response.body.has_more }}"
Stop conditions
Pagination stops at the first of:
- the cursor or next URL is missing or empty,
- a page has no elements,
has_moreis given and evaluates to false,- a page is shorter than
page_size(whenpage_sizeis set), max_pages(default 100; hard cap 10,000) ormax_itemsis reached,limitis reached whenreturn_allis false.
Lookups
Lookups fill dropdowns (options / multi_options parameters with lookup:) and the list mode
of resource locators. The editor calls
POST /api/v1/connectors/{id}/lookups/{lookup} with the selected credential, the current
parameter values, a search string and a cursor.
lookups:
channels:
request:
method: GET
path: /conversations.list
query: { limit: 200, types: "public_channel,private_channel", exclude_archived: true }
paginate: { strategy: cursor, cursor_from: "$.response_metadata.next_cursor", cursor_param: cursor }
items: "$.channels"
label: "#{{ item.name }}"
value: "{{ item.id }}"
description: "{{ item.purpose.value }}"
url: "https://app.slack.com/client/{{ item.context_team_id }}/{{ item.id }}"
search: client
| Key | Description |
|---|---|
request, paginate | As for operations. Lookups go through the same auth, rate limits and egress policy. |
items | JSONPath to the array of entries. |
label, value | Templates over item. |
description, url | Optional templates shown in the list. |
search | client filters the fetched entries by label; server sends the search text as search_param. |
search_param | Query parameter for server-side search. |
depends_on | Parameters this lookup reads; the editor refreshes it when they change and disables it until they are set. |
Results are cached for 60 seconds per credential, lookup and parameter values.
Dependent lookups
lookups:
spreadsheets:
request:
method: GET
url: https://www.googleapis.com/drive/v3/files
query: { q: "mimeType='application/vnd.google-apps.spreadsheet' and trashed=false", pageSize: 100 }
paginate: { strategy: cursor, cursor_from: "$.nextPageToken", cursor_param: pageToken }
items: "$.files"
label: "{{ item.name }}"
value: "{{ item.id }}"
search: server
search_param: q
sheets:
depends_on: [spreadsheet]
request: { method: GET, path: "/spreadsheets/{{ params.spreadsheet | urlencode }}", query: { fields: "sheets.properties" } }
items: "$.sheets[*].properties"
label: "{{ item.title }}"
value: "{{ item.title }}"
Resource locators
A resource_locator parameter has three modes in the editor:
| Mode | Value sent to the connector |
|---|---|
| From list | The value of the chosen lookup entry |
| By ID | The typed ID |
| By URL | The id group extracted by the parameter’s url_patterns |
params:
- { name: spreadsheet, type: resource_locator, lookup: spreadsheets, required: true }
url_patterns:
spreadsheet: "docs\\.google\\.com/spreadsheets/d/(?<id>[^/]+)"
Imported workflows carry resource locator values as objects with a mode, a value and a cached
display name. The importer unwraps them (resolving URL mode through url_patterns) and keeps the
cached name for display, so the connector always receives a plain ID.