Skip to content

Readiness Checklist

Standards from the REST API pages, consolidated for review before shipping.

Run this before shipping a new API or cutting a new version. Section headers link to the page where each standard is explained.

Endpoints

  • Resources are plural nouns in kebab-case; the HTTP method carries the action
  • Sub-resources are nested at most one level deep
  • Partial updates use PATCH; PUT is reserved for full replacement
  • DELETE returns 204 No Content and is idempotent
  • Non-CRUD actions are sub-resource nouns: POST /invoices/{id}/void, not POST /voidInvoice
  • Query parameters are snake_case; sort uses - prefix for descending

Authentication

  • Session cookies are signed, HttpOnly, Secure, SameSite=Lax or stricter, with the __Host- prefix
  • Logout deletes the session row; expiry is enforced by expires_at server-side, not only Max-Age
  • Tokens travel in Authorization: Bearer only: never in query strings or request bodies
  • Sign with RS256 or ES256; avoid HS256 in multi-service environments
  • Access tokens expire within one hour; refresh tokens rotate on each use
  • 401 means unauthenticated; 403 means authenticated but not authorized
  • 401 responses to bearer-token requests include a WWW-Authenticate header

Versioning

  • The major version is the first path segment: /v1/
  • Deprecated versions send Deprecation and Sunset headers from the announcement date
  • Removed versions return 410 Gone, not 404 Not Found
  • Clients get at least six months between deprecation announcement and removal

Errors

  • Error codes are SCREAMING_SNAKE_CASE strings, not integers
  • code is stable API surface; message is prose and may change freely
  • All validation failures are reported in a single response, not one per round-trip
  • Field pointers follow JSON Pointer (RFC 6901): /addresses/0/city
  • Adding new codes is non-breaking; renaming or removing codes is breaking

Response envelopes

  • Add an envelope only when it earns its keep: pagination metadata, consistent error shape
  • Success responses carry data; failures carry error; never both in the same response
  • Metadata already present in HTTP headers is not duplicated in the body

Pagination

  • Use cursor-based pagination, not offset
  • Paginated responses include next_cursor, has_next_page, and limit
  • No total_count by default; expose a separate endpoint if clients need it
  • Enforce a maximum limit server-side; return an error for out-of-range values, not a silent clamp
  • Cursors encode the sort order and are not valid across different sort orders

CORS

  • Origins are an explicit allowlist, not a wildcard
  • Access-Control-Allow-Origin: * cannot be combined with Access-Control-Allow-Credentials: true
  • OPTIONS preflight requests return 204 No Content with the CORS headers

Type to search…

↑↓ navigate↵ selectEsc close