API design checklist
Every rule in the API design playbook, by chapter, required rules first. Each links to its own page with how we built it and how to check it. This is a lot to check. An Expert can check it for you.
Resources and methods
- Recommended API-1 Name resources as plural nouns
- Recommended API-2 Use each method for what it means
- Recommended API-3 Answer with the right status code
- Recommended API-4 Return 405 with the allowed methods
- Recommended API-5 Keep addresses stable
- Recommended API-91 Return a result for each item in a batch
Requests and responses
- Required API-8 Send money as an integer with its currency
- Required API-12 Accept only fields you know
- Required API-14 Set caching headers on every response
- Required API-93 Cap the size of every request body
- Recommended API-6 Use JSON with one naming style
- Recommended API-7 Send dates as RFC 3339 with a time zone
- Recommended API-9 Send IDs as strings
- Recommended API-10 Give every response one shape
- Recommended API-11 Use enums for fixed values
- Recommended API-13 Say which format PATCH accepts
- Recommended API-15 Stream in a standard format and describe each item
- Recommended API-92 Reject JSON with duplicate keys
- Optional API-94 Let clients ask for only the fields they need
Errors
- Required API-19 Hide internals in errors
- Recommended API-16 Send errors as problem details
- Recommended API-17 Keep error types stable
- Recommended API-18 Name every field that failed
- Recommended API-20 Say when to retry
Lists
- Recommended API-21 Page lists with cursors
- Recommended API-22 Cap the page size
- Recommended API-23 Filter with plain parameters
- Recommended API-24 Sort in a stable order
- Recommended API-25 Return empty lists as empty
- Optional API-26 Search with QUERY when the filter outgrows the address
Changes over time
- Required API-27 Make only additive changes
- Recommended API-28 Version only for breaking changes
- Recommended API-29 Announce deprecation and sunset in headers
- Recommended API-30 Tell clients to ignore what they don't know
- Recommended API-31 Keep a changelog
Reliability
- Required API-32 Accept idempotency keys on POST that creates or charges
- Required API-35 Set timeouts on every call
- Recommended API-33 Stop lost updates with ETags
- Recommended API-34 Retry with backoff and jitter
- Recommended API-36 Tell clients their rate limit
- Recommended API-37 Run long jobs asynchronously
API security
- Required API-38 Authenticate with tokens in headers
- Required API-39 Grant narrow scopes
- Required API-40 Authorise every object
- Required API-41 Keep secrets out of addresses
- Required API-42 Store API keys as hashes
- Required API-43 Refuse plain HTTP on the API
- Recommended API-95 Bind high-value tokens to the client that holds them
- Recommended API-44 List every API you run
Contracts and docs
- Recommended API-45 Write the contract first
- Recommended API-46 Test the API against its contract
- Recommended API-47 Give every endpoint an example
- Recommended API-48 Generate docs and clients from the contract
- Recommended API-49 Make the API easy for agents to find
- Recommended API-50 Mark server-set fields read-only and secrets write-only
- Optional API-68 Describe multi-step tasks as Arazzo workflows
Live connections
- Required API-70 Check access when the connection opens and while it lasts
- Required API-73 Limit the connections and messages of each client
- Recommended API-69 Choose the transport that the feature needs
- Recommended API-71 Send heartbeats and drop dead connections
- Recommended API-72 Reconnect with backoff and resume from the last event
Using other companies' APIs
- Required API-76 Send the same idempotency key when you retry a write
- Required API-80 Give each environment its own provider key
- Recommended API-75 Wrap each outside API in one adapter
- Recommended API-77 Stay under their rate limits
- Recommended API-78 Decide what happens when a provider is down
- Recommended API-79 Pin their API version and watch for its end
GraphQL and gRPC
- Required API-81 Accept GraphQL mutations only by POST with a JSON body
- Required API-96 Limit the depth and cost of every GraphQL query
- Required API-87 Never reuse or change a protobuf field number
- Recommended API-82 Deprecate GraphQL fields before you remove them
- Recommended API-83 Page GraphQL lists as cursor connections
- Recommended API-84 Load related records in batches
- Recommended API-85 Give every GraphQL error a stable code
- Recommended API-88 Check every schema change for breaking changes in CI
- Recommended API-89 Set a deadline on every gRPC call and pass it on
- Recommended API-90 Answer with the standard gRPC status codes
- Optional API-86 Allow only known queries from your own apps
Related playbooks
Show the badge on your project
When your project passes every Required rule, you can show this badge on your site or in your README. It links to this checklist, so anyone can run the same checks.
<a href="https://agentwranglers.se/playbook/api-design/checklist"><img src="https://agentwranglers.se/badge.svg" alt="Checked against the Agent Wranglers API design playbook" width="214" height="20"></a>
[](https://agentwranglers.se/playbook/api-design/checklist)
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/checklist">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.