Lists
Page through long lists with cursors, cap every page, and let clients filter and sort with plain, documented parameters that never change meaning.
- Recommended 5
- Optional 1
Recommended
Page lists with cursors
API-21Return every list that can grow past one page in pages, and point to the next page with an opaque cursor, not a page number.
Cap the page size
API-22Set a default page size and a maximum. Clamp or reject anything above the maximum.
Filter with plain parameters
API-23Let clients filter lists by named query parameters, and document each one with its type.
Sort in a stable order
API-24Sort every list in a documented, stable order, and let clients choose from a fixed set of sort keys.
Return empty lists as empty
API-25Answer an empty result with 200 and an empty array. Never answer 404 or
nullfor a list with nothing in it.
Optional
Search with QUERY when the filter outgrows the address
API-26Send a search that is too long for query parameters, or that holds personal data, in the body of a QUERY request. Never send it as a GET with a body.
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/api-design/lists">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.