Pagination

All list endpoints in the ibakepro API use cursor-based pagination. This guide explains how to navigate through large result sets efficiently.

By default, list endpoints return up to 50 results. You can adjust this with the limit parameter (maximum 100). When there are more results available, the response includes pagination cursors to fetch additional pages.

Pagination response format

All paginated responses follow this structure:

Paginated response

{
  "success": true,
  "data": [
    { "id": "ord_abc123", ... },
    { "id": "ord_def456", ... }
  ],
  "pagination": {
    "limit": 50,
    "has_more": true,
    "next_cursor": "eyJpZCI6Im9yZF9kZWY0NTYifQ",
    "prev_cursor": null
  }
}

Pagination parameters

  • Name
    limit
    Type
    integer
    Description

    Number of results to return per page. Default: 50, Maximum: 100.

  • Name
    cursor
    Type
    string
    Description

    Pagination cursor from a previous response. Use next_cursor to get the next page.

Fetching the next page

When has_more is true, use the next_cursor value to fetch the next page of results.

Request

GET
/api/v1/orders
curl -G https://api.ibakepro.com/api/v1/orders \
  -H "Authorization: Bearer {api_key}" \
  -d cursor="eyJpZCI6Im9yZF9kZWY0NTYifQ" \
  -d limit=50

Iterating through all results

Here's how to fetch all results by following the pagination cursors:

async function fetchAllOrders(apiKey) {
  const orders = []
  let cursor = null

  do {
    const params = new URLSearchParams({ limit: 100 })
    if (cursor) params.set('cursor', cursor)

    const response = await fetch(
      `https://api.ibakepro.com/api/v1/orders?${params}`,
      { headers: { 'Authorization': `Bearer ${apiKey}` } }
    )

    const result = await response.json()
    orders.push(...result.data)

    cursor = result.pagination.has_more ? result.pagination.next_cursor : null
  } while (cursor)

  return orders
}

Best practices

  • Use reasonable limits - Fetching 100 items at a time is more efficient than 10
  • Don't store cursors long-term - Cursors may expire; fetch fresh data when needed
  • Handle empty results - An empty data array with has_more: false means no more results
  • Respect rate limits - Add delays between requests when paginating through large datasets

Was this page helpful?