![]() |
VOOZH | about |
We use cookies to improve your experience on our site. By using our site, you are agreeing to the collection and use of data as described in our Privacy Policy.
Cookie Settings×Table of contents
To help you fetch data from a 3rd-party resource quickly and without overwhelming your server, you’ll need to leverage API pagination.
And while there are many pagination methods to consider, offset pagination, or offset-based pagination, is likely at the top of your list.
We’ll break down how this method works so that you can decide whether it’s the right fit for any of your integration scenarios.
It’s an approach to pagination that, for a given request, uses an offset to determine the starting point of data to fetch and a limit to cap the volume of data that's returned.
To prevent any confusion, we’ll distinguish offset pagination from other methods.
Cursor pagination lets you define the starting point of each request via a unique identifier (e.g., a timestamp), while offset pagination simply skips a predefined set of items with each request.
Keyset pagination uses a key to determine the starting point of a request while offset pagination just skips a predetermined set of data.
Similar to the methods above, token-based pagination uses a token in a given request to signify the starting point for fetching data; offset pagination doesn’t use a token—or any unique identifier—to fetch data across requests.
{{this-blog-only-cta}}
To help bring our definition to life, let’s walk through a few examples of offset pagination.
Say you want to get a list of employees from an HRIS solution and each page includes 30 employees.
Your first request can be structured as follows:
<code class="blog_inline-code">GET /v1/employees/?offset=0&limit=30</code>
Say you want to fetch reviews from a specific product (e.g., product ID=12345) and from a certain site. Let’s also assume that the site shows 10 reviews per page and you only want to get reviews that are on the 3rd page.
To retrieve these reviews, you can make the following request:
<code class="blog_inline-code">GET /v1/products/12345/reviews?offset=20&limit=10</code>
Related: Everything you need to know about REST API pagination
Imagine that you want to retrieve invoices from your ERP system. You also only want to retrieve invoices from a certain vendor (e.g., vendor ID=12345) and you decide to only retrieve 5 invoices at a time.
You can structure your first request to something as follows:
<code class="blog_inline-code">GET /v1/invoices/12345/?offset=0&limit=5</code>
Now that you know how offset pagination works and how it differs from other methods, you may be wondering what its benefits and drawbacks are.
We’ve broken them down below.
Related: Tips for implementing API pagination effectively
Merge, the leading unified API solution, lets you connect your product with hundreds of 3rd-party SaaS applications through the platform’s unified API.
This means you only have to consider how Merge’s Unified API handles pagination (among other items, like rate limits and authentication), which helps you scale your integration builds more quickly and maintain them more easily.
You can learn more about Merge’s Unified API, among the platform’s other features, by scheduling a demo with one of our integration experts.
In case you have any more questions on offset pagination or API pagination more broadly, we’ve addressed several more commonly-asked questions below.
It refers to any pagination method that lets you fetch a subset of data with each request.
And while the methods differ, they serve the same purpose: to help you retrieve data from a large data set in a way that won’t overwhelm the server and that'll allow you to receive responses relatively quickly.
The “best” pagination method largely depends on the type of data you’re pulling from.
For example, if the data set changes frequently, the best method can be one that uses a unique identifier, like cursor-based pagination. But if the data set changes infrequently, offset pagination can be the best option since it’s relatively easy to implement and would fetch data reliably.
That said, in some cases, you won’t have the ability to choose a method, so your “best” pagination option would be whatever method the API provider allows.
Here are just a few to keep in mind:
Simply build to Merge's Unified API to add hundreds of API integrations to your product.