Handling paginated API results in business integrations

Check that an integration retrieves all relevant pages of supplier data and can recover from interruptions.

Discuss integrations and automation

Understand the supplier format

Some APIs return results in pages rather than one response. Read the supplier’s documentation to see how to request the next page and how the end of the result set is indicated. GitHub documents one approach using links; other suppliers may use different methods.

Plan for changing data

Records can be added or changed while a long retrieval is running. Ask the supplier how its pagination behaves and whether a stable sort, cursor or change timestamp is available. Do not assume that simply increasing a page number prevents missed or repeated records.

Handle interruptions

Record enough progress to resume or safely repeat the retrieval without silently creating duplicates. For example, if a customer import stops after several pages, the team needs to identify which records arrived and how the remaining work will be recovered.

Reconcile the result

Test with more records than fit on one page, including an empty final page if the API uses one. Compare received references and counts with an independently obtainable source where possible, and investigate mismatches before relying on the imported data. For example, a returned total of 500 customers is not sufficient by itself: compare identifiers as well, because a missing record and a duplicate can leave the count unchanged.

Explore the service

Start a conversation

Let’s make it
work better.

Tell us about your people, systems or premises. We’ll discuss what you need and agree a practical next step.

This opens a draft in your email application. Review your enquiry and send it when you’re ready.