Level 1: Foundations · L1.1 APIs: REST, gRPC, GraphQL, WebSockets/SSE, webhooks
Pagination, versioning and errors
Design cursor pagination, a versioning strategy and a consistent error format.
12 min · Free
What you take away
- OFFSET pagination makes the database walk and discard every skipped row, so deep pages get slow and shift under inserts.
- Cursor (keyset) pagination remembers where you stopped, so page 10,000 costs the same as page 1.
- Adding an optional field is not a breaking change; removing, renaming or redefining one is.
- One error envelope with a stable machine-readable code and a request id turns support tickets into lookups.
How the class is laid out
- The problem
- The simple version
- Pagination
- Versioning
- Errors
- Check your understanding