Customers & growth · Developer marketing
API design principles
Best for Early Startup to Startup
Use it when
You are about to build or extend a public API and need every endpoint to follow one set of rules for resources, methods, errors and versions.
Skip it when
- You do not yet know where developers get stuck with your current API. Run Developer friction analysis first, which feeds this framework.
- The API is live and you need to change it without breaking clients. Use API versioning strategy.
- The design is settled and developers need help using it. Use API documentation framework.
- Only the error responses need work. Use Error message framework.
What to apply first and what to use instead are listed below.
Inputs
- Consumer scenariosThree to ten tasks developers must complete with the API, from customer interviews, support tickets and sales notes.
- Domain modelThe business objects and how they relate, from the product team and the current data model.
- Style guideOne published guide to adopt, such as Google's API design guide or Microsoft's REST API guidelines, or your company's own.
- Existing APIsOptionalCurrent endpoints, field names and error formats, from your API description or gateway, so new work stays consistent.
- ReviewersTwo or more people outside the building team, such as an API review group, who will sign off before code is written.
Steps
- Write the consumer scenarios as tasks and pick the style guide every endpoint will follow.
- List the resources the scenarios need and their parent and child relationships, keeping them independent of your database tables.
- Define each resource's fields with one naming convention, and use the same schema in every method that returns the resource.
- Give each resource the standard methods (get, list, create, update, delete), add a custom method only where none fits, and decide paging for every list that can grow.
- Specify the error format with its codes and status codes, then the version scheme and what counts as a breaking change.
- Send the written design to the reviewers before implementation, and record each deviation from the style guide with its reason.
Output
An API design document, signed off before code is written, that a team can turn into an API description and build from.
- Consumer scenarios covered
- Resources and their hierarchy
- Fields per resource, with names and types
- Methods per resource, standard or custom
- Paging rule for each list method
- Error format and codes
- Version scheme and breaking change rules
- Deviations from the style guide, with reasons
Done when
- Every consumer scenario maps to at least one method on a named resource.
- Every resource has a get method and every collection has a list method, or the gap is recorded as a deviation.
- Every field name follows the chosen naming convention, checked field by field.
- The error format lists each error code with its status code and meaning.
- Reviewers outside the building team have signed off, and every deviation has a stated reason.
Measure
Track support tickets and forum questions about the API, the share of calls that end in client errors, and time to first successful call for new developers. Review monthly for two quarters after release. Compare against your previous API or the first month after launch. It worked when client errors and design questions fall while new developers reach a first call faster.
Hypothetical example
Fernway, a shipping software firm, planned a public API for printing labels. The team wrote five scenarios, such as creating a shipment and printing its label, and adopted Google's API design guide. Resources were accounts, shipments and labels, with labels under shipments. Each got get and list, and shipments got create. Cancel became a custom method because no standard method fit. The warehouse table layout stayed out of the API, and every field used lower camel case. Errors used one shape with a code, a message and a target field. Two engineers from another team reviewed the document and flagged that the shipment list needed paging from day one. The team added it and logged one deviation, a batch create method, with its reason.
Common mistakes
- Mirroring the database tables in the API. Design resources from the consumer scenarios and keep storage details hidden.
- Adding paging to a list after launch. Decide paging before release for every list that can grow, since adding it later breaks clients.
- Returning a different shape for the same resource in different methods. Keep one schema per resource across all its methods.
- Reviewing after the code is written. Review the written design before implementation, when changes are cheap.
- Inventing custom methods where a standard one fits. Prefer standard methods and justify each custom one.
Sources
- AIP-121: Resource-oriented design · Google API Improvement Proposals, 2019
- API design guide · Google Cloud, 2014
- Microsoft Azure REST API Guidelines · Microsoft, 2026
Show all 5 sources
- Microsoft Graph REST API Guidelines · Microsoft
- APIs as infrastructure: future-proofing Stripe with versioning · Brandur Leach, 2017
By company stage
Apply first
Nothing. You can start here.
Use instead
- Developer friction analysis
You do not yet know where developers get stuck with your current API. Run Developer friction analysis first, which feeds this framework.
- API versioning strategy
The API is live and you need to change it without breaking clients. Use API versioning strategy.
- API documentation framework
The design is settled and developers need help using it. Use API documentation framework.
- Error message framework
Only the error responses need work. Use Error message framework.
Where it sits
Open the developer marketing roadmapRecommended resources
No sponsored resources on this framework yet. Sponsored listings would be labelled here, never in search.
Progress is not saved until you have an account. Create a free account