Skip to content

Pagination

Collection endpoints paginate with Pagy and expose page metadata in response headers.

Append ?page=N to the URL — N is 1-indexed:

Terminal window
curl -H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
"https://hypemarket.ai/organizations/3/collabs.json?page=2"

Items per page is fixed at the Pagy default (20). The API does not currently accept a per_page parameter.

HeaderDescription
Current-PagePage number returned
Page-ItemsItems per page
Total-CountTotal items across all pages
Total-PagesTotal pages

A simple pattern for walking every page:

Terminal window
page=1
while :; do
resp=$(curl -sS -D /tmp/headers \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
"https://hypemarket.ai/organizations/3/collabs.json?page=$page")
echo "$resp"
total=$(grep -i '^total-pages:' /tmp/headers | awk '{print $2}' | tr -d '\r')
[ "$page" -ge "$total" ] && break
page=$((page + 1))
done

In Python:

import httpx
page, total = 1, 1
with httpx.Client(headers={"Authorization": f"Bearer {token}",
"Accept": "application/json"}) as c:
while page <= total:
r = c.get(f"https://hypemarket.ai/organizations/3/collabs.json",
params={"page": page})
r.raise_for_status()
yield from r.json()
total = int(r.headers["Total-Pages"])
page += 1