Getting Started
Pagination

Pagination

List endpoints that may return many results are paginated. Use the page and per_page query parameters to navigate.

Request

curl "https://api.spectradiag.com/api/v1/products?page=2&per_page=50" \
  -H "Authorization: Bearer spk_live_xxx"
ParameterDefaultMaxNotes
page11-indexed
per_page25100 (most endpoints)Use larger values for exports

Response

Paginated responses include a pagination object:

{
  "success": true,
  "data": [ /* page items */ ],
  "pagination": {
    "total": 487,
    "page": 2,
    "per_page": 50,
    "total_pages": 10
  }
}

Iterating all pages

import requests
 
base = "https://api.spectradiag.com/api/v1"
headers = {"Authorization": "Bearer spk_live_xxx"}
 
page = 1
while True:
    r = requests.get(f"{base}/products", headers=headers, params={"page": page, "per_page": 100})
    body = r.json()
    for product in body["data"]:
        process(product)
    if page >= body["pagination"]["total_pages"]:
        break
    page += 1

Tips

  • Use a larger per_page when backfilling — fewer requests means fewer rate limit hits
  • Cache aggressively — products and categories don't change often
  • Use webhooks for near-real-time updates instead of repeated polling