I’m having trouble with the Airtable API not giving me all the records from my table. When I fetch data through the API, I only get 2202 records, but the actual table shows 2271 records in the web interface. The CSV export also confirms there should be 2271 records.
Here’s my code:
const database = airtable.base(config.baseId);
database("MenuItems")
.select({})
.eachPage(
function processPage(recordList, getNextPage) {
allRecords.push(...recordList);
getNextPage();
},
function complete(error) {
if (error) {
console.error(error);
return;
}
console.log("Total records:", allRecords.length);
}
);
I’ve tried removing any view filters to make sure it’s not a display issue. I can see which specific records are missing when I compare the lists, but I can’t figure out why the API is skipping them. These missing records don’t seem to have anything unusual about them.
Has anyone encountered this problem before? What could cause the API to return incomplete results?
This discrepancy usually points to API pagination limits or record filtering at the API level. The Airtable API has a default page size of 100 records and won’t necessarily retrieve records in the same order as your interface view. Try adding explicit sorting parameters to your select query to ensure consistent ordering between API calls and interface display.
Another common cause is records with null values in primary fields or linked record fields that have broken references. The API sometimes excludes these while the interface still counts them. I’d recommend adding error handling within your processPage function to catch any records that might be causing silent failures during retrieval.
Also verify your API key has full access permissions to the base. Sometimes workspace-level restrictions can cause partial data access through the API while still allowing full interface viewing. Running the same query with different API keys can help identify permission-based filtering issues.
I ran into something similar and it turned out to be a timeout issue during the API calls. The eachPage function can silently fail on certain pages if there’s network instability or if some records take too long to process, but it continues to the next page without throwing an error.
Try adding some debugging to track which page numbers you’re actually receiving. I discovered my API was skipping entire pages intermittently. Adding retry logic and tracking the page count helped identify where the gaps were occurring.
Another thing to check is whether you have any webhook automations or scripts running on the base that might be modifying records during your API call. I’ve seen cases where concurrent modifications can cause the pagination to skip records that get moved around while the API is iterating through pages.
The fact that your missing records seem random suggests it’s probably a timing or concurrency issue rather than data corruption.
Been there, this exact thing bit me on a project last year. The most likely culprit is deleted records that are still counting in your interface total.
Airtable keeps deleted records in a kind of limbo state for a while. They show up in your record count on the web interface and CSV exports, but the API won’t return them because they’re technically deleted.
Here’s what I’d check first:
Look at your table’s revision history to see if there were recent deletions.
Try filtering your view to only show records created or modified after a certain date.
Check if any of those missing records have empty key fields.
Also, make sure you’re not hitting any base limits. Some Airtable plans have restrictions on API calls that could cause truncation.
If that doesn’t solve it, try adding some logging to see exactly which records you’re getting vs missing. Sometimes there’s a pattern in the data that reveals the issue.
In my case, it turned out someone had bulk deleted records but they were still showing in our cached view count. Pain to debug but easy fix once we figured it out.
check if you have any formula fields or lookups that might be causing issues. sometimes airtable api skips records where computed fields fail to calculate properly. also worth double-checking your base permissions - api might not have access to all records even if you can see them in the interface.