The paginated envelope is a third envelope, with four fixed pagination keys
Two envelopes carry a result and a refusal. A paginated result is a third, and its pagination block belongs to the envelope rather than to the rows it sits beside.
The rule
- Alongside
{success, data}and{success, error}, a response paginated by offset MUST be{success, data, pagination}. dataMUST be an array holding one element per row of the page.paginationMUST carrytotal,limit,offsetandhas_more, and nothing else: its members are a closed list, because one block is shared by every paginated endpoint, and a member one endpoint adds would make it that endpoint's own block.has_moreMUST be page arithmetic,(offset + limit) < total, and not a second query.- It MUST be spelled
has_morein every response paginated by offset, whatever the spelling convention of that endpoint's rows. - It belongs to the shared envelope, and an implementation MUST NOT rename it to match the rows beside it.
- An endpoint paginated by offset MUST NOT build a pagination block of its own.
- A cursor-paged endpoint, such as the message poll (PLAY-3), is not paginated by offset.
What it means
A result and a refusal are the two envelopes every endpoint already answers in.
A paginated result is a third, and it is a shape of its own, not the result
envelope with a block appended by whichever endpoint happens to return one: the
same four keys on every paginated endpoint, and only those four. data is the
page itself, an array with one element per row, never an object that wraps the rows
under a name of the endpoint's choosing: a client reads every paginated answer's
rows from the same place. Lists in this
specification are open unless a rule closes them; this one is closed, because a
key that one endpoint adds turns the shared block into that endpoint's own, and
a client could no longer read every paginated answer the same way.
has_more is arithmetic the endpoint itself can do — whether the offset and
limit it just reported would still leave rows unseen — not a second query
run to find out. And it keeps its snake_case spelling regardless of the
casing convention the rows beside it use: the block belongs to the shared
envelope, not to the endpoint it happens to sit in, so no endpoint renames
it to match its own rows or builds a pagination block of its own.
Example
Two workflows, unfiltered: three keys, and the pagination block reports the whole set (rows elided).
GET /api/flowdrop/workflows
{"success": true, "data": [ … ], "pagination": {"total": 2, "limit": 50, "offset": 0, "has_more": false}}The same four keys sit beside rows spelled the other way.
GET /api/flowdrop/workflows/{workflow_id}/playground/sessions
{"success": true, "data": [ … ], "pagination": {"total": 1, "limit": 50, "offset": 0, "has_more": false}}has_more is spelled the same both times: once beside rows spelled the same
way as the pagination block, once beside rows that are not.