Skip to content

Paging is clamped silently, and the clamped values are what is reported

The rule

Normative: this is the rule
  1. A paginated endpoint MUST use a limit of 50 where the request carries none.
  2. It MUST cap limit at 100.
  3. It MUST raise a limit below 1 to 1.
  4. It MUST floor offset at 0.
  5. A limit that is not an integer MUST be corrected to the default of 50, and an offset that is not an integer MUST be corrected to 0.
  6. Out-of-range or malformed paging MUST be corrected and MUST NOT be refused: there is no 400 for it, and the conventions' 400 for a malformed query parameter does not apply to limit or offset.
  7. The pagination block MUST report the values used, defaulted or corrected, so a caller that asked for 1000 and was served 100 is told 100 and its has_more arithmetic holds.
  8. total MUST be counted before pagination and under every filter the result carries, so a filtered page's total describes the filtered set and not the whole collection.

What it means

Out-of-range paging is corrected, not refused — there is no 400 for asking for too much or for a negative offset. But the correction is not silent in the sense of invisible: the values reported back are the ones actually used, so a caller who asked for far more rows than the cap allows is told the capped number, and its own arithmetic on has_more still holds.

The correction goes to the nearest value in range at both ends. A limit above 100 becomes 100; a limit of 0 or below becomes 1. The lower bound matters as much as the cap: with a limit of 0 a page holds no rows, offset + limit never grows, and has_more would stay true for a client that pages until it turns false. A request that names no limit gets 50, and is told so. A limit that is not an integer at all, such as limit=ten or limit=2.5, is treated the same way and gets 50; an offset that is not an integer gets 0. Paging is the one place a malformed query parameter is corrected rather than refused, so a client's bad paging value costs it a page, never the request.

total is counted before pagination is applied, and under whatever filter the request carries. A filtered page's total describes the filtered set, not the whole collection — a search that matches nothing is an empty page with a total of zero, not the size of the unfiltered table.

Example

Asking for far more than the cap still gets a coherent, corrected answer.

A limit far above the cap200 — clamped
GET /api/flowdrop/workflows?limit=1000

{"pagination": {"total": 3, "limit": 100, "offset": 0, "has_more": false}}

A limit of zero is raised to one, so paging always moves forward.

A limit of zero200 — clamped
GET /api/flowdrop/workflows?limit=0

{"pagination": {"total": 3, "limit": 1, "offset": 0, "has_more": true}}

A filter that matches nothing still gets a well-formed, empty page.

A search term matching no row200 — counted
GET /api/flowdrop/workflows?search=nothing+here

{"pagination": {"total": 0, "limit": 50, "offset": 0, "has_more": false}}

total is the filtered count in both cases, never the size of the whole collection behind it.

Why

A default of 50. The default is what a client gets when it says nothing, so it has to be within the cap and large enough that a typical list screen fills from one page. Half the cap does both, and leaves a client that wants the most rows a reason to ask for them explicitly.

Why

Recorded under OPEN-25, OPEN-54.

Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0 · API-6 · changed in spec 1.1