Pagination
Smart EPD v2 list endpoints use cursor-based pagination. Cursors avoid the page-drift problems of offset/page numbers when rows are appended while you iterate. One caveat applies to rows sharing an identical creation timestamp — see Ordering.
Request parameters
| Query param | Type | Default | Notes |
|---|---|---|---|
limit | int | 25 | Page size. Clamped server-side to 1–100 — values outside the range are pulled to the nearest bound rather than rejected. |
cursor | string | (none) | Opaque cursor from a previous response's next_cursor. Omit it (or send empty) to fetch the first page. Treat the value as a black box — don't construct or parse it. |
Response shape
Every paginated endpoint returns the same envelope:
{
"data": [ /* the page of items */ ],
"next_cursor": "MjAyNi0wNS0yOFQxMjowMDowMFo=",
"has_more": true
}
| Key | Type | Meaning |
|---|---|---|
data | array | The current page of items. |
next_cursor | string | null | Pass this as cursor on the next request to get the following page. null on the last page. |
has_more | bool | true if at least one more page exists. When false, next_cursor is null and you've reached the end. |
Iterating to the end
Loop until has_more is false (equivalently, until next_cursor is null):
cursor=""
while : ; do
page=$(curl -s -H "Authorization: Bearer $TOKEN" \
"https://sandbox.smartepd.xyz/api/v2/projects/$PROJECT_ID/epds/?limit=50&cursor=$cursor")
echo "$page" | jq -c '.data[]' # ... process this page ...
[ "$(echo "$page" | jq -r '.has_more')" = "true" ] || break
cursor=$(echo "$page" | jq -r '.next_cursor')
done
Ordering
Results are returned by creation time, oldest first. The cursor encodes the last item's created_at, and the next page fetches rows strictly after it (created_at__gt).
The cursor advances on created_at alone (there is no unique tiebreaker today), so rows that share the exact same created_at tick can straddle a page boundary and be skipped — most likely with bulk- or seed-created data written in the same instant. For exact, gapless iteration over such data, request a generous limit (up to 100) and/or de-duplicate by id on the client. Don't rely on any ordering other than created_at ascending unless an endpoint documents one.
The public EPD library is one that does: it lists newest first by date of issue, and its cursor is gapless.
Related
- Errors — the error envelope shared by every endpoint.
- EPD Schema (API) — a worked example that consumes a paginated endpoint.
- API Quickstart — end-to-end walkthrough including listing resources.