Pagination

Handling large datasets efficiently.

How Pagination Works#

All list endpoints return paginated results. By default, we return 50 items per page with a maximum of 100.

1
2
3
...
25
of 1,250 total items

Parameters#

ParameterTypeDescription
pagenumberPage number to retrieve (default: 1)
limitnumberItems per page (default: 50, max: 100)

Response Metadata#

Every paginated response includes a meta object:

Response Structure
{
  "data": [...],
  "meta": {
    "total": 1250,      // Total items
    "page": 1,          // Current page
    "per_page": 50,     // Items per page
    "total_pages": 25   // Total pages
  }
}

Iterating All Pages#

Here's how to fetch all items across multiple pages:

fetchAllItems.js
async function fetchAllItems(projectSlug, apiKey) {
  let allItems = [];
  let page = 1;
  let hasMore = true;

  while (hasMore) {
    const response = await fetch(
      `https://dataclean.to/v1/${projectSlug}/items?page=${page}&limit=100`,
      { headers: { 'X-API-Key': apiKey } }
    );
    const data = await response.json();

    allItems = allItems.concat(data.data);
    hasMore = page < data.meta.total_pages;
    page++;
  }

  return allItems;
}
Rate Limits
Be mindful of rate limits when iterating through many pages. Add delays between requests if you're processing large datasets.

Rate Limits by Plan#

PlanRequests/MonthRequests/Minute
Free1,00010
Starter50,00060
Pro500,000300
Agency5,000,0001,000
Optimizing Requests
Use limit=100 when fetching all data to minimize the number of API calls needed.