Your Customers' Nightly Sync Is Missing Records, and Your Pagination Docs Can't Tell Them Why

Clinton De Young API Documentation

A customer runs a nightly job that copies every invoice from your API into their data warehouse. Their finance team reconciles it against bank deposits at the end of each month. This month, eleven invoices are missing. Their engineer reruns the job and gets every record. They rerun it the next night and four different invoices are missing. They open a ticket titled "List endpoint randomly drops records," and it lands in your support queue as a suspected bug.

It probably isn't a bug. Their job paged through the list with offset while new invoices were being created, so records shifted between pages and some were never returned. Or it stopped when a page came back with fewer items than the page size, which turned out not to mean "last page." Or it assumed the list was sorted oldest-first. Your API behaved exactly as built. Your documentation never told them how it behaves.

Pagination is usually documented as a pair of parameters in the reference. For any customer who syncs, exports, reconciles, or backfills data, it's actually a contract about completeness, and when that contract is unwritten, their data quietly goes wrong.

Why pagination fails silently

Most integration bugs announce themselves. A bad request returns a 400. A missing scope returns a 403. A pagination mistake returns 200 OK and a perfectly valid page of results. Nothing in the response says that a record was skipped or returned twice.

That's what makes it expensive. The customer doesn't find out during development, when the test account has forty records. They find out weeks later, in production, from an auditor, a finance team, or an angry end user whose record "disappeared." By then they've lost trust in your data, and the fix often includes a full re-export and a manual reconciliation on their side.

The questions your pagination docs have to answer

Good pagination documentation answers these questions, and it answers them once, in one place, linked from every list endpoint:

  1. Which style does each endpoint use? Offset and page number, cursor, or a time-based since parameter. If different endpoints use different styles, say so on each endpoint.
  2. What is the sort order, and is it stable? Newest first or oldest first, and what breaks ties when two records share a timestamp. Without a stable order, no pagination scheme is reliable.
  3. What happens when data changes mid-iteration? If a record is created, updated, or deleted while a client is paging, can it be skipped or returned twice? Say which.
  4. How does a client know it has reached the end? A has_more flag, a missing next cursor, an absent next link. Say explicitly that a short page does not mean the end, if that's true for your API.
  5. What are the page-size limits, and what happens when they're exceeded? An error, or a silent reduction to the maximum.
  6. Do cursors expire? If a client stores a cursor and resumes tomorrow, will it work? If not, what error comes back?
  7. How should a client do incremental sync? If the honest answer is "page through everything every night," document that, and document the better option if you have one.

What the clear examples look like

Two widely used APIs show the level of precision I mean.

Stripe's API reference states that its list methods use cursor-based pagination: starting_after and ending_before each take an existing object ID, results come back in reverse chronological order, and has_more tells the client whether more elements exist after the current set. It documents the default page size of 10 and the allowed range of 1 to 100, and it notes that its client libraries provide auto-pagination helpers. A developer reading that page knows the cursor, the order, and the stopping condition before writing a line of code.

GitHub's REST API documentation tells clients to use the URLs in the link response header to fetch additional pages, notes that some links may be missing (there's no prev link on the first page), and states that for most endpoints the maximum per_page is 100. It also says something easy to miss: if you request more than the maximum, GitHub does not return an error; it uses the maximum instead. That single sentence prevents a whole class of "why am I only getting 100 records?" tickets.

Neither page is long. Both answer the question a sync job depends on: how do I know I got everything?

Document the end-to-end loop, not the parameters

A parameter table tells a developer what each field means. It doesn't tell them how to combine those fields into a loop that is correct. Add one short, complete example that does:

cursor = None
while True:
    page = client.invoices.list(limit=100, starting_after=cursor)
    for invoice in page.data:
        save(invoice)
    if not page.has_more:
        break
    cursor = page.data[-1].id

Then, beneath it, state what the loop guarantees and what it doesn't: whether records created during the run will appear, whether a record updated during the run can appear twice, and whether save should therefore be an upsert keyed on ID. Those three sentences are the difference between a sync that's correct and one that's correct most nights.

If your SDKs offer auto-pagination, document it first, because it's the path most customers should take. But document the raw loop as well. Customers using a language you don't ship an SDK for, or a low-code integration tool, will build it themselves.

Long iterations also run into your rate limits, and a backfill of a large account is exactly the job that hits them. Link the two topics together. I covered what rate-limit docs need to say in Your Customers Find Your Rate Limits the Day Their Traffic Spikes.

Audit your pagination docs this week

You can measure the gap without outside help:

  • Pick your three most-exported resources and try to answer the seven questions above from the public docs alone. Count how many you can't.
  • Write the sync loop yourself from the docs, then run it against a test account while another script creates and deletes records. Compare the result to a direct database count.
  • Search support tickets for "missing records," "duplicate," "only returns 100," "pagination," and "export incomplete."
  • Check consistency across endpoints. If some use page, some use offset, and some use cursors, make sure every endpoint's reference says which.
  • Ask your engineers whether the sort order on each list endpoint is guaranteed or merely current behavior. If nobody knows, customers can't either.

Why this takes an engineer

Documenting pagination correctly means reading the query that backs each list endpoint, understanding how the sort and the cursor interact with concurrent writes, and testing the edge cases rather than describing the happy path. It's reading code first and writing second, and that's the work I've done for decades.

If your customers keep reporting missing or duplicate records from your API, I can help. I'll test how each list endpoint behaves under real conditions, document the guarantees it actually provides, and write the sync guidance that lets customers trust their data. You can reach me through the contact page.