Key takeaway
- API design best practices: resource naming, HTTP methods, RFC 9457 errors, versioning, OpenAPI contracts and the OWASP API Top 10 for enterprises.
API design is the set of decisions that shape how other teams, partners and software agents will use your interface: which resources it exposes, how requests and errors look, how change is introduced and what each caller is allowed to do. The best API design practices for enterprise teams are consistent resource naming, correct use of HTTP methods and status codes, a standard error format, deliberate versioning, a written contract in OpenAPI and security decisions made at design time against the OWASP API Security Top 10 (2023).
This guide covers design decisions only. For the wider lifecycle of building, testing and retiring APIs, read our API development best practices guide, and for caller identity see API authentication methods. Each section below answers one question a design review should settle.
What is API design and why does it matter for enterprises?
An API (application programming interface) lets one application request data or actions from another without knowing how it is built. API design is the work of deciding what that interface looks like before and while it is implemented. Once other teams depend on an interface, changing it costs coordination, so early design choices are the cheapest to get right. The Microsoft Azure Architecture Center web API design guidance treats a web API as an abstraction of the underlying data and services, which keeps clients isolated from changes in the schema behind it.
What principles make an API well designed?
Four principles recur in good API design. They are practical tests for a design review, not standards.
| Principle | What it means in practice | Design review question |
|---|---|---|
| Consistent | The same naming, parameters, error shape and documentation style across every endpoint. Each inconsistency becomes extra code in every client. | Would a developer who learned one endpoint guess the next? |
| Hard to misuse | Clear names, strict validation and informative errors make the wrong call difficult to write. | What happens when a client sends bad input or retries a request? |
| Complete and concise | Enough resources for consumers to build real applications, without exposing every internal table. | Does each resource map to a business concept consumers recognise? |
| Easy to evolve | Additive change by default, with a stated process for breaking change. | How will we add a field or retire an endpoint without surprising callers? |
How should resources and URIs be modelled?
Use nouns and plural collections
The Microsoft Azure Architecture Center web API design guidance says to use nouns for resource names, so /orders rather than /create-order, because the HTTP method already carries the action. It also uses plural collections: /customers is the collection and /customers/5 is one item. A single, predictable convention is worth more than the choice itself.

Keep nesting shallow
The same guidance recommends avoiding URIs more complex than collection/item/collection, for example /customers/1/orders and /orders/99/products rather than /customers/1/orders/99/products. It also warns against chatty designs that expose many small resources and force clients into many requests.
Match each HTTP method to its meaning
| Method | Typical use | Design rule from the Azure guidance |
|---|---|---|
| GET | Retrieve a resource or collection | Returns a representation; no side effects expected |
| POST | Create an item in a collection or submit work for processing | Client posts to the collection URI and the server assigns the new URI |
| PUT | Replace an item | Must be idempotent: sending the same request again leaves the state unchanged |
| PATCH | Partial update | Not guaranteed idempotent; JSON Merge Patch (RFC 7396) is simpler, JSON Patch (RFC 6902) is more expressive |
| DELETE | Remove an item | Returns 204 on success and 404 if the item is absent |
Idempotency matters most for payments, orders and any call a client may retry after a timeout, so decide it per operation before implementation.
Which status codes and error format should an API return?
Return the status code that matches the outcome, so clients can handle each class of problem without parsing text. The Azure guidance lists, for example, 200, 204 and 404 for GET, 201 with a Location header for POST, 409 for conflicting PUT or PATCH requests, 415 for an unsupported media type and 406 when no acceptable media type can be matched. RFC 6585 adds 429 Too Many Requests for rate limiting, and the response may include a Retry-After header.
For the body, use RFC 9457 (Problem Details for HTTP APIs, July 2023, which obsoletes RFC 7807). It defines the media type application/problem+json with the members type, status, title, detail and instance, and lets problem types add extension members. Adopting it means every service reports errors the same way instead of each team inventing a format. Do not put stack traces or internal identifiers in detail.
How should an API be versioned and retired?
Choose a versioning approach once, document it and apply it everywhere. The Azure guidance describes five options.
| Approach | Example | When it fits | Trade-off |
|---|---|---|---|
| No versioning | Additive changes only | Internal APIs with few consumers | Removing or renaming a field is still a breaking change |
| URI versioning | /v2/customers/3 | Public or partner APIs that need simple routing and caching | Version appears in the URI |
| Query string | ?version=2 | Keeping one URI per resource | Some older proxies and browsers do not cache query-string responses |
| Header | api-version=2 in a custom header | Clients you control | Clients must send the header; caching needs more logic |
| Media type | Accept: application/vnd.contoso.v1+json | Hypermedia-style APIs | Most complex for clients to use |
For retirement, RFC 9745 (March 2025, Standards Track) defines a Deprecation header that tells clients a resource is or will be deprecated. It is a hint and does not change behaviour. It pairs with the optional Sunset header from RFC 8594, which says when the resource is expected to stop responding. Publish both, with a link to the migration guide, before removing anything.
How should pagination, filtering and long-running work be designed?
Collections should be paged from the start. The Azure guidance suggests limit and offset parameters with defaults and an upper limit on items returned, to help prevent denial-of-service attacks. Filtering and sorting go in the query string, and field selection must validate the requested fields so callers cannot reach fields they should not see. For work that takes longer than a request should, return 202 Accepted with a status endpoint in the Location header, and 303 See Other to the new resource when it completes. Latency targets belong in the design too; see our guide to API latency, response time and SLOs.
Why design the contract first with OpenAPI?
OpenAPI describes REST APIs in a machine-readable file. The Azure guidance notes that it promotes a contract-first approach over implementation-first: agree the contract, review it, then build to it. The same file can generate documentation and client libraries, and gives test tools something to check against, which is how documentation stays accurate. See API testing workflows and tools for how contracts feed testing.
OpenAPI 3.2.0 was announced on 23 September 2025 by the OpenAPI Initiative. It adds tag summary, parent and kind properties, support for the QUERY method, additionalOperations for methods OpenAPI does not define, streaming media types (Server-Sent Events, JSON Lines, JSON Sequences and multipart mixed) with itemSchema, the OAuth 2.0 Device Authorization Flow and an oauth2MetadataUrl property. Check that your gateway and tooling support a version before moving contracts to it.
A gateway can enforce parts of the contract at the edge. Our overview of the KrakenD API gateway for microservices shows one open-source option.
Which security risks should API design address?
Many API security failures are design decisions: which object a caller may read, which properties it may change, how much a single caller may consume. The OWASP API Security Top 10 (2023 edition) is the reference list to design against.
| OWASP 2023 item | Design question |
|---|---|
| API1 Broken Object Level Authorization | Is every object access checked against the caller, not just the endpoint? |
| API2 Broken Authentication | Is authentication handled by a standard mechanism? See API authentication methods. |
| API3 Broken Object Property Level Authorization | Can callers read or write only the properties they should? |
| API4 Unrestricted Resource Consumption | Are page sizes, payload sizes and rates capped? |
| API5 Broken Function Level Authorization | Are administrative functions separated and checked? |
| API6 Unrestricted Access to Sensitive Business Flows | Can automation abuse a flow such as purchasing or sign-up? |
| API7 Server Side Request Forgery | Does any parameter make the server fetch a caller-supplied URL? |
| API8 Security Misconfiguration | Are defaults, headers and error messages reviewed? |
| API9 Improper Inventory Management | Is every version and environment listed, owned and retired on time? |
| API10 Unsafe Consumption of APIs | Are responses from third-party APIs validated? |
Source: OWASP API Security Top 10 2023.
What has changed in API design recently?
| Change | Status | Effect on design |
|---|---|---|
| RFC 9457 replaces RFC 7807 | Published July 2023 | Use application/problem+json as the standard error body |
| RFC 9745 Deprecation header | Published March 2025, Standards Track | Signal deprecation in responses, with Sunset for the end date |
| OpenAPI 3.2.0 | Announced 23 September 2025 | Streaming, QUERY method and device flow can be described in the contract |
| OWASP API Security Top 10 | 2023 edition | Authorisation and resource consumption are design concerns, not only code concerns |
Software agents are now API consumers too. They call APIs without a person reading each response, so explicit contracts, clear errors and per-action authorisation matter more. ElixirClaw is an agentic OS platform to build, orchestrate and govern AI agents and automation workflows while keeping humans in control, and AgentGRC keeps autonomous agent actions inside policy, with the audit trail risk teams need.
What is a sensible order for adopting these practices?
| Step | Action |
|---|---|
| 1 | Write naming, error and versioning conventions as a one-page standard. |
| 2 | Adopt OpenAPI contracts and review them before implementation. |
| 3 | Standardise errors on RFC 9457 and add Deprecation and Sunset headers. |
| 4 | Add page size and rate limits to every collection. |
| 5 | Review each API against the OWASP list and record the owner. |
| 6 | Keep a live inventory of versions and environments. |
What are the trade-offs, and when should you not follow the rules strictly?
Consistency can conflict with a use case that is naturally an action, and the Azure guidance accepts non-resource operations sparingly. Deep hypermedia (HATEOAS) has no general standard, so its link format is proprietary. Header and media type versioning are tidy but harder for clients and caches. Contract-first work slows the first release and speeds every later one. For a short-lived internal API with one consumer, a lightweight version of these steps is reasonable; for public, partner or agent-facing APIs, apply them in full.
To map one API decision your teams and agents depend on, and the context and policy behind it, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What are the most important API design best practices?
Use nouns and plural collections, match HTTP methods to their meaning, return correct status codes with an RFC 9457 error body, choose one versioning approach, write the contract in OpenAPI first and design against the OWASP API Security Top 10 (2023).
Should API URLs contain verbs?
No. The Azure guidance recommends nouns such as /orders because the HTTP method already carries the action. Non-resource operations are allowed sparingly.
Which standard should APIs use for error responses?
RFC 9457, Problem Details for HTTP APIs (July 2023), which obsoletes RFC 7807. It defines application/problem+json with type, status, title, detail and instance members.
How do you retire an API version safely?
Send the Deprecation header (RFC 9745) and, optionally, the Sunset header (RFC 8594) with a link to migration guidance, then remove the version only after the stated date.
What is contract-first API design?
It means writing and reviewing the OpenAPI description before implementation, then building to it. Documentation, client libraries and tests can then be generated from the same contract.
What is the difference between API design and API development?
Design settles the interface: resources, methods, errors, versions and security. Development covers building, testing, deploying and retiring it. See our API development best practices guide for the lifecycle.
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE