Skip to content
Back to Steward

Pagination

List endpoints return cursor-paginated results. Walk through pages by passing each response’s nextCursor back as the cursor query parameter on the next request.

Every paginated endpoint returns the same shape:

{
"items": [...],
"nextCursor": "ZGVzY3x1cGRhdGVkQXR8MjAyNi0wNS0xM1QxNjowOToxMi4wMDBafDUwN2Yx..."
}
FieldTypeDescription
itemsarrayResults for the current page.
nextCursorstring | nullOpaque token to fetch the next page. null when there are no more results.
ParameterTypeDefaultDescription
cursorstring(none)Opaque token from a previous response’s nextCursor. Omit on the first request.
limitinteger50Results per page, 1–100.
orderstringdescSort direction: asc (oldest first) or desc (newest first).
orderBystringupdatedAtSort field. Only on /applications — see Sort Field below. Other endpoints fix the sort field.
#!/bin/bash
URL="https://api.getsteward.ai/api/v1/applications?limit=50"
AUTH="Authorization: Bearer stw_live_your_api_key_here"
while [ -n "$URL" ]; do
RESPONSE=$(curl -sS "$URL" -H "$AUTH")
echo "$RESPONSE" | jq '.items[]'
CURSOR=$(echo "$RESPONSE" | jq -r '.nextCursor // empty')
if [ -z "$CURSOR" ]; then
URL=""
else
URL="https://api.getsteward.ai/api/v1/applications?limit=50&cursor=${CURSOR}"
fi
done

In JavaScript:

async function fetchAll(endpoint) {
const items = []
let cursor
do {
const url = new URL(`https://api.getsteward.ai/api/v1/${endpoint}`)
url.searchParams.set('limit', '50')
if (cursor) url.searchParams.set('cursor', cursor)
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.STEWARD_API_KEY}` }
})
const page = await response.json()
items.push(...page.items)
cursor = page.nextCursor
} while (cursor)
return items
}

/applications accepts an orderBy parameter:

ValueSorts byUse when
updatedAtMost recent activity (default)You want the freshest data first — most apps recently touched on top.
createdAtWhen the application was createdYou want a stable insertion-order view that doesn’t shift as apps update.
Terminal window
curl "https://api.getsteward.ai/api/v1/applications?orderBy=createdAt&order=desc" \
-H "Authorization: Bearer stw_live_..."

The other endpoints (/notes, /tasks, /documents, /audit-logs) always sort by createdAt.

Cursors are tied to the sort direction and sort field they were issued under. If you change order or orderBy mid-pagination, the cursor is rejected. Reset by omitting the cursor and starting over.

GET /applications?order=desc → nextCursor: A
GET /applications?cursor=A&order=desc ✓ ok
GET /applications?cursor=A&order=asc ✗ 400 — direction does not match
GET /applications?cursor=A&orderBy=createdAt ✗ 400 — sort field does not match

Possible 400 responses when using cursors:

MessageCause
Invalid pagination cursorToken is malformed or wasn’t issued by this API.
Pagination cursor direction does not match sort orderThe order you passed differs from the one the cursor was issued with.
Pagination cursor sort field does not match requested orderByThe orderBy you passed differs from the one the cursor was issued with.

To switch sort direction or field mid-traversal, drop the cursor parameter and start from page 1.

EndpointPaginatedSort field
GET /applicationscreatedAt/updatedAt
GET /notescreatedAt
GET /taskscreatedAt
GET /documentscreatedAt
GET /audit-logscreatedAt
GET /webhooksno — bare array
GET /webhooks/{id}/deliveriesno — bare array
GET /screening/hitsno — categorized

The unpaginated endpoints are naturally bounded (a handful of webhooks per account; screening hits are grouped by hit type rather than listed flat).