Pagination

Every collection endpoint uses bounded limit and offset query fields and returns a resource-specific array plus the same pagination metadata.

Query fields

Field Default Limits
limit 50 Integer from 1 through 100.
offset 0 Integer greater than or equal to 0.

Response

Responses retain the resource name (sites, buckets, files, and so on) and include pagination metadata. nextOffset is a usable value only while hasMore is true; it is otherwise null.

{
  "sites": [],
  "pagination": {
    "hasMore": false,
    "nextOffset": null
  }
}

An empty result is 200 OK with an empty array, not null or 404.

Walk every page

Use pagination.nextOffset until pagination.hasMore is false.

offset=0
limit=50

while :; do
  response="$(curl -sS \
    "https://api.interfold.dev/v0/sites?accountId=$INTERFOLD_ACCOUNT_ID&limit=$limit&offset=$offset" \
    -H "Authorization: Bearer $INTERFOLD_API_KEY")"

  # Process response.sites here.
  if [ "$(printf '%s' "$response" | jq -r '.pagination.hasMore')" != "true" ]; then
    break
  fi

  offset="$(printf '%s' "$response" | jq -r '.pagination.nextOffset')"
done

Do not infer another page from sites.length === limit; that fails when the total happens to be an exact multiple of the page size.

On this page