Skip to main content
Skip to content

Pagination

Cursors, the default and maximum page size, and what an invalid cursor does.

Listing endpoints are cursor-paginated. You ask for a page size, read nextCursor off the response, and pass it back on the next request until hasMore is false.

ParameterDefaultMaximumNotes
limit50100A value above the maximum is clamped rather than rejected. A value below 1, or one that is not a whole number, falls back to the default.
cursor——Opaque. Pass back exactly what you were given.
Walking every page
cursor=""
while : ; do
  page=$(curl -s -H "Authorization: Bearer $HAWI_KEY" \
    "https://hawiagents.com/api/v1/workspaces/$WS/files?limit=100${cursor:+&cursor=$cursor}")
  echo "$page" | jq -r '.files[].name'
  [ "$(echo "$page" | jq -r '.hasMore')" = "true" ] || break
  cursor=$(echo "$page" | jq -r '.nextCursor')
done

Pages are a snapshot of nothing

There is no transaction spanning your pagination. A file uploaded while you are on page three can appear on a later page, and one deleted can vanish from a page you were about to request. For a listing that changes slowly this is invisible; for anything you intend to reconcile against, record the time you started and treat the result as approximate.