Skip to main content

Pagination

All list endpoints in the RxScale APIs support pagination through query parameters.

Query Parameters

ParameterTypeDefaultDescription
pageinteger0Page number (zero-indexed)
limitinteger50Number of items per page
Pages are zero-indexed. The first page is page=0, not page=1.

Response Format

Paginated endpoints return:
{
  "data": [...],
  "totalRegistries": 150,
  "totalPages": 3
}
  • data — Array of items for the current page
  • totalRegistries — Total number of items across all pages
  • totalPages — Total number of pages (calculated as ceil(totalRegistries / limit))

Limits

APIDefault LimitMaximum Limit
External Pharmacy API50200
Management API50200
Public API (Products)50150
Requesting a limit above the maximum will be capped to the maximum.

Example

Fetching the second page of 25 products:
curl -X GET "https://api.rxscale.com/v1/management/products?page=1&limit=25" \
  -H "X-API-Key: your-api-key"
Response:
{
  "data": [
    {"uid": "prod_abc", "name": "Product 26"},
    {"uid": "prod_def", "name": "Product 27"}
  ],
  "totalRegistries": 75,
  "totalPages": 3
}

Iterating Through All Pages

import requests

page = 0
all_items = []

while True:
    response = requests.get(
        "https://api.rxscale.com/v1/management/products",
        headers={"X-API-Key": "your-api-key"},
        params={"page": page, "limit": 50}
    )
    data = response.json()
    all_items.extend(data["data"])

    if page >= data["totalPages"] - 1:
        break
    page += 1
Use the smallest limit that makes sense for your use case. Smaller pages mean faster responses and less memory usage.