Guides · Reports

Pagination, sorting and filtering contract for every list

Use one set of page and page size rules, one metadata shape, one sorting tie break and one validation rule on every record list. This page fills the page size, offset bounds and tie break items that other guides mark as unknown, and it changes no sign in, workspace, role or tenancy rule.

How to read this contract

Scope is every record list that uses the six fields on Reports and setup: public search, My records, staff queues, saved reports and drill down lists. Contacts and per record tabs keep their own list order and are named at the end of this page. Canonical precedence is the record and the town document for that record, then this contract, then summary pages.

  • Apply this contract in the app modules for new and existing list endpoints, additively, using the envelope on Unified API response contract. Do not remove a field a current reader reads in the same change.
  • Record the default and maximum page size below in setup notes with the town office before live use. Where a list already shows a page size, that shown size is the page_size for that list, must be within the limit below, and must be recorded list by list.
  • No fee amount, day count, code section or town rule is added by this page. A draft is never counted as submitted and never appears in public search.

Pagination parameters, limit and offset semantics

Clients send page and page_size only. Offset is derived on the server and is never a client parameter. A cursor is not used on these lists, because the address must show filters, page, page size and sort for a shareable link, the total is known, and the lists are not append only feeds.

Pagination parameters for every record list
Parameter, on screen nameMeaningDefaultLimit and validation
Page1 based page number in the list order. Page 1 is the first page with rows.1Positive integer in decimal, minimum 1. Page 0, a negative value, a decimal, spaces or non numeric text is invalid. See validation below.
Page sizeRows per page. Clients send page_size only. The word limit is internal offset math only and is never sent as a client alias.20Integer from 1 to 100 inclusive. A value of 0, a negative value or a value above 100 is invalid, never silently clamped.
OffsetNot a client parameter. The server derives offset as (page minus 1) multiplied by page_size and uses it only inside the query.Not shownDo not accept offset, limit or cursor as client aliases. An alias is an unknown query parameter and is rejected, so one slice has one name.
CursorNot used on these lists.Not shownDo not add a cursor parameter to a list that already shows page, page size and total. A cursor would hide the page and sort that a copied address must show.
  • Changing Text, Status, Record type, Date, Owner, Page size or Sort resets Page to 1 and keeps the other filters, the workspace and the total definition. Moving Page alone keeps every filter, the sort and the total.
  • The address shows page and page_size with the active filters and sort, so a copied address reopens the same filtered list, page, page size and sort in the same workspace. Public search never puts Owner, phone, email or payment details in the address.

Response metadata, total count and has more

Every successful list response returns the same metadata shape, beside data as a list, using the success envelope on Unified API response contract. The total counts distinct record numbers in the filtered set across all pages, not rows on one page. One record number counts once, even where a record has more than one parcel, contact or document.

List metadata returned on every successful list response
FieldRule
meta.totalCount of distinct record numbers in the filtered set across all pages. The same total on every page of that filtered set.
meta.pageThe page returned, echoed exactly as requested after validation, except where a filter, sort or page size change resets it to 1.
meta.page_sizeThe page size used for this response, echoed exactly as validated.
meta.page_countTotal divided by page_size, rounded up. Page count is 0 where total is 0.
meta.has_moreTrue only where page is less than page_count. False on the last page with rows, on a past last page, and on an empty result.
meta.request_id and meta.checked_atAs stated on Unified API response contract, with checked_at as an ISO UTC string on new fields.

Success list shape, Phase 1 plus the metadata above. Keep any existing total and page field names as aliases with the same values until readers are updated.

{ "ok": true, "data": [ { "record_number": "value from record" } ], "meta": { "total": 0, "page": 1, "page_size": 20, "page_count": 0, "has_more": false, "request_id": "value from server", "checked_at": "ISO UTC string from server" } }

Sorting and the final tie break

Filters narrow a list and never change its sort. Each list keeps the order named on that list or on its card, and every record list adds the same final tie break, so no record number repeats across adjacent pages and no record is skipped at a tie.

Sorting rule for every record list
ItemRule
Named sortThe sort named on the list or card, such as overdue first then due today on staff queues, decision date newest first on an approval drill down list, or days overdue largest first on an overdue drill down list.
Final tie breakRecord number ascending, after the named sort and after any sort field the card already names, for example due date on an overdue list. The tie break is part of the sort on every page, not a re sort per page.
Change of sortChanging Sort resets Page to 1, keeps every filter, the total and the workspace, and reorders the same filtered set. Changing any other filter or page size does not change the sort.
Check at a tieWhere two records share every named sort value, read adjacent pages together and confirm both record numbers appear once, in record number order.

Filtering validation, and when an empty result is not an error

Use the same six fields as Standardized query contract. Within Status and within Record type the rule is OR, across fields the rule is AND, blank means include all, and Workspace stays fixed. Validation separates a malformed request from a known combination that matches nothing.

Validation error or empty result, by case
CaseResponse
Page or page size malformed, out of range, or an unknown query parameter name400 in the Phase 1 error shape on Unified API response contract: ok false, error as one plain sentence string, one top level code VALIDATION_FAILED, no data, message names the field in plain words. No field is applied and no list is returned.
Status or Record type value that is not in the allowed set for the lane the list opened from, or a Date value that is not a valid date400 with VALIDATION_FAILED as above, naming the field. A planning value on a permit list is a lane error of this kind.
Known Status or Record type values, a valid Date range, and Text that together match no record, including Date from after Date toEmpty result with total 0, not an error. See the empty shapes below. Do not read total 0 as a missing, deleted or other workspace record.
Clear one filter, or clear allClear one removes only that filter and returns to page 1. Clear all removes Text, Status, Record type, Date and Owner where shown, returns to page 1 in the same workspace, and keeps the sort. Neither deletes a record nor clears a saved report.

Empty result shape, two cases that must not be mixed

Both cases return ok true, data as an empty list, and the full metadata above. They differ in total, page and page_count, so a reader can tell a filtered empty list from a past last page.

Empty result shapes for record lists
CaseTotalPage and page countData and has_more
Filtered empty list, total 0, reached by a filter, sort or page size change or by clear all0Page 1, page_count 0Empty list, has_more false
Past last page, total above 0, reached only by moving Page directly beyond the last page with rowsUnchanged total for the filtered setPage as requested, page_count as total divided by page size rounded upEmpty list, has_more false
Total 0 with an explicit page above 10Page as requested, page_count 0Empty list, has_more false
  • A filter or sort change never leaves the list on a past last page, because it resets Page to 1. A past last page can only be reached by moving Page directly.
  • A page past the last page with rows is not shown as total 0. Return to a page with rows and note the page shown, the total and the view name for the town office.
  • An empty list shows the same active filters, total, page, page size and sort above the rows, with status in words and not by colour alone, as in Empty states.

Check this contract before you publish

Work through these steps in order on one clearly marked test record in the town workspace. Each step ends with what you should see when it worked.

  1. Read the metadata on page 1

    Open a staff queue with no filters set. You should see page 1, page size 20 where no other size is shown, total as distinct record numbers, page count as total divided by page size rounded up, and has_more true only where a later page has rows.

  2. Move page by page to the last page and back

    You should see the same filters, sort, total and page size on each page, no record number repeated across adjacent pages at a tie, and has_more false on the last page with rows.

  3. Request one past last page and one filtered empty list

    You should see an empty list with the unchanged total on the past last page, and an empty list with total 0, page 1 and page count 0 on the filtered empty list, with the same metadata shape in both cases.

  4. Send invalid page and page size values

    Request page 0, a non numeric page, page size 0 and page size 101. You should see a 400 response in the Phase 1 error shape naming the field for each request, with no data returned.

  5. Change a filter from a deep page and confirm the reset

    Go to a page past the first, then change Text, then Status, then Sort. You should see page 1 each time, the same other filters and workspace, and a total that matches the new filtered set across all pages.

  6. Publish only after the test passes

    Run the safe defaults health check in Set up a permit type and fees, then publish only after the test passes. Drafts and the test record stay private and do not appear in public search.

Standardized query contract · Unified API response contract · Search a public record · Reports and setup

Bring your list questions to the demo

Tell us which list, page size or sort order you want to see first, and we will show the contract and the list behind it.

Request a demo

What this page does not publish

This page adds no new filter, no new role, no new permission and no new storage. It reuses the six fields, the fixed workspace and the copied address already stated on the pages linked above.

  • Unknown: contacts list tie break not in supplied site pack, where the list shows no record number. Read adjacent pages together on that list until the town office names a tie break for it.
  • Unknown: a page size already shown on a list that differs from the default above, where the list does not show it. Read the size shown with that list and do not copy a size from another list.
  • Unknown: fee amount, due day count, code section and town timeline not in supplied context. Ask the town office for the town document for your record and do not use a value from another record.