Fetch paginated data from Airtable's API
This guide explains how to use a Loop block and a Variables block to iterate across paginated data in a REST API. This example uses Airtable’s API, so steps may need to be adjusted to match the data structure for other APIs.
Before Getting Started
- Be sure to set up the Airtable Integration in your account.
Motivation for using a loop block
Airtable's List Records endpoint returns paginated data, 100 records per page. To fetch the next page, an offset parameter is provided which can be included to get the next page of records. Thus, in order to get more than 100 records from Airtable's API, you'll need to iterate across the API until all records are pulled using a Loop block and passing in the offset parameter from each previous call. Follow the guide below for step-by-step instructions.
List Records in a loop
- Create a new backend API named
fetchAirtableRecordswith a Variables block - Add 3 variables:
offsetAPIwith a value oftrue,nextPagewith a value ofnull, andoutputRecordswith a value of[]

- Add a Loop block that runs while
offsetAPI.valueistrue

- Inside the Loop block, add a step that uses your Airtable integration
- Select
List Recordsfrom the Action menu - Add your
baseIdandtableIdOrNameto the URL path - Add a query parameter with a key
offsetand value{{nextPage.value}}
- Select

- Click into the 3 dots menu on the
Variables1block and clickCopy block, then click on the Airtable block's 3 dots menu and clickPaste block below-
Update the 3 variables:
offsetAPIwith a value ofStep1.output.offset ? true : falsenextPagewith a value ofStep1.output.offsetoutputRecordswith a value of
[...outputRecords.value, ...Step1.output.records.map((record) => { const { id, fields } = record; return { id, ...fields }; })] -
offsetAPInow checks if the result of theList Recordscall contains anoffsetparameter and returnstrueorfalseaccordingly. This allows the while loop to continue until theoffsetparameter stops being returned, indicating that there are no more pages -
nextPagenow updates to be theoffsetparameter to pass into the subsequentList Recordscalls via the query parameter -
outputRecordsflattens and appends the data returned by the API structuring the data to be visualized using the Table component
-

- Outside the Loop block, create a Return block that returns
outputRecords.value

- Drag a Table component to the canvas and update the
Table Datato{{fetchAirtableRecords.response}} - Run the API and watch the Table component visualize your Airtable data!
Update Airtable records
- Create a backend API called
updateRecordswith an Airtable step- Select
Update multiple recordsfrom the Action menu - Add your
baseIdandtableIdOrNameto the URL path
- Select
- Update the JSON body to the following:
{
"records": {{Table1.editedRows.updatedRows.map((o) => {
const { id, ...fields } = o; // Destructure and remove id from fields
return {
fields,
id, // Include id as a separate unique identifier
};
})}}
}
- This restructures the data that was flattened in Step 5 above and uses
idas an identifier for the table
- In the Table component, update columns to editable that will be updated in Airtable
- In the Table's
onSaveChangesevent handler, run theupdateRecordsAPI and then run thefetchAirtableRecordsAPI

- Now, you can edit the columns that were set to editable, click the
Save Changebutton and the underlying Airtable base will be updated and the data will be re-fetched