API and developers

Pagination

Navigate through large result sets with page-based pagination

All list endpoints return paginated results. Use the page and limit query parameters to control which slice of data you receive.

Query Parameters

Parameter Type Default Description
page integer 1 Page number (1-indexed)
limit integer 25 Items per page (max 100)

Response Structure

Every paginated response includes a pagination object:

{
  "data": [...],
  "pagination": {
    "page": 1,
    "limit": 25,
    "total_pages": 4,
    "total_items": 100,
    "has_more": true
  }
}
Field Description
page Current page number
limit Items per page (as requested)
total_pages Total number of pages available
total_items Total number of items across all pages
has_more true if there are more pages after the current one

Iterating Through All Pages

Use the has_more field to know when to stop:

import httpx

BASE_URL = "https://api.ya.onl/v1/orders"
HEADERS = {"X-API-Key": "yv_live_v1_your_api_key"}

all_orders = []
page = 1

while True:
    response = httpx.get(BASE_URL, params={"page": page, "limit": 100}, headers=HEADERS)
    body = response.json()
    all_orders.extend(body["data"])

    if not body["pagination"]["has_more"]:
        break
    page += 1

print(f"Fetched {len(all_orders)} orders")

Limits

  • The maximum value for limit is 100. Requesting more than 100 returns a 400 Bad Request error.
  • Page numbers start at 1. Requesting page 0 or a negative number returns a validation error.
Need help?