API Contract Design Checklist: What to Verify Before You Ship
A pre-ship checklist for REST API contract design covering naming, error shapes, versioning, pagination, security headers, and documentation completeness.
Once clients depend on an API, changing field names, status codes, or error shapes may require a migration. Review these choices before the first integration goes live.
The checklist covers naming, request semantics, error handling, versioning, and compatibility.
API Contract Design Checklist
Use this as a review checklist. Naming, pagination, and versioning conventions are design choices; document exceptions. HTTP method and status-code behavior should follow HTTP semantics.
Resource and Endpoint Naming
- Use a consistent resource-naming convention, such as plural nouns (
/users,/orders,/invoices) - Prefer resource-oriented paths; document action endpoints when an operation does not fit a resource update
- Nested resources reflect genuine ownership, not just relation (
/users/42/addressesis fine;/users/42/global-settingsshould probably be its own root resource) - No trailing slashes (or consistent trailing slashes if your framework requires them)
- All URL segments are lowercase and use hyphens, not underscores or camelCase
- Field names in request and response bodies follow a single consistent convention — snake_case or camelCase, documented and applied uniformly
HTTP Methods and Semantics
GETdoes not request a state change; incidental effects such as access logging are acceptable- Repeating an identical
PUTorDELETEhas the same intended effect as making it once; response status may differ POSTprocesses a request according to the endpoint contract and is not limited to creation;PUTcreates or replaces a resource at a known URIPATCHis used for partial updates where appropriate, with clear documentation of which fields are patchable- For operations where idempotency is critical (payments, order submission), an
Idempotency-Keyheader is accepted and honored
HTTP Status Codes
- Success codes match the result; for resource creation, use
201and identify the primary resource withLocationwhen appropriate - Client errors return
4xx, not200with an error body - Validation failures return
400or422, not500 - Use
401with the required authentication challenge when credentials are missing or invalid; use403for refused access, or404when deliberately concealing a resource - Rate limit responses use
429; includeRetry-Afterwhen the server can provide useful retry timing - All error responses have the same shape — consistent
code,message, and optionalfieldkeys
Error Response Shape
- Every error response includes a machine-readable
codestring, not just a human-readablemessage - Validation errors identify which field or parameter caused the failure
- Error codes are documented alongside their HTTP status mappings
- Error messages are actionable — they tell the caller what to do, not just what went wrong
Versioning
- The API includes a version in the URL path (
/v1/) or a documented version header - The version is present from the first public release, even if it is the only version today
- A deprecation policy is documented: how much notice consumers will receive before a breaking change
Request and Response Contracts
- All response fields are documented with their type, nullability, and allowed values
- Optional fields in requests are explicitly labeled as optional with documented defaults
- Document the meaning of absent and
nullfields, including any difference between them - Document timestamp format, precision, and time zone; distinguish instants from local calendar dates and recurring local times
- Monetary values are integers (cents/pence) or strings with explicit decimal precision — never floats
- Boolean fields do not use numeric proxies (
0/1) in JSON responses
Pagination
- Bound collection responses with pagination or a documented maximum result size
- Default page size and maximum page size are documented
- Document pagination metadata and whether clients find it in the response body,
Linkheaders, or both - Behavior at the last page is defined —
has_more: falseor an absentnext_cursor
Authentication and Security Headers
- Authentication and resource-concealment behavior is consistent with the documented access policy
- The authentication scheme is documented — Bearer token, API key header, OAuth scopes
- Rate limiting is applied and the limits are documented
- Validate request media types against the endpoint contract, including JSON, uploads, or form data as applicable
- CORS policy is intentional, not left at the framework default
OpenAPI Specification
- Every endpoint has a
summaryanddescriptionin the spec - Every request parameter and response field has a description
- Request and response examples are included for the happy path and at least one error case
- The spec is generated from or validated against the actual implementation — they should not drift
Backward Compatibility Verification
- Review each change against existing clients; optional response fields and new endpoints can be compatible, while stricter validation or new required inputs may break consumers
- No existing field has been renamed, removed, or had its type changed without cutting a new version
- Removing an endpoint is preceded by a deprecation period with a
DeprecationandSunsetheader on that endpoint
How to Use This List
Use this list during design review and again before opening the API to its first consumer.
For an existing API, identify which corrections affect clients. Use a migration or new version for breaking changes; a naming preference alone does not justify disrupting consumers.