Pagination, sorting and updates

Cursor pagination on every list, sort fields, and partial updates.

Lists

Every list operation takes the same query parameters:

ParameterRule
limit1 to 200, default 50
cursorThe next_cursor from the previous page. Opaque: do not build or change it.
sortA field name, with a leading - for descending. The id breaks ties.

and answers with a page object:

{ "items": [ ... ], "next_cursor": "eyJr...", "total": 128 }

next_cursor is null on the last page. total appears only when it is cheap to count. Cursors are signed and bound to the list and the sort; a changed or reused cursor is refused with 422.

curl "$SPARQ_API_URL/v1/admin/workspaces/$WORKSPACE_ID/projects?limit=20&sort=-created_at" \
  -H "Authorization: Bearer $SPARQ_KEY"

An unknown sort field is refused with 422. Each list operation in the API reference names the fields it accepts.

Partial updates

PATCH operations follow three rules:

  • an omitted field is unchanged;
  • null clears a field, where the field can be cleared;
  • an empty body, or a field the operation does not know, is refused.

On this page