Skip to content

How to design endpoints that age well

Use nouns for resources, HTTP methods for actions, stable identifiers in the path, and version the URL when the contract changes.

Designing REST endpoints

  1. Nouns, not verbs

    POST /orders creates an order. POST /createOrder is RPC pretending to be REST.

  2. Methods for actions

    GET reads, POST creates, PUT replaces, PATCH updates, DELETE removes. When a route has a verb in its name, the design is fighting HTTP.

  3. Stable identifiers in the path

    /users/42, not /users/current-user-with-name-ana. The path is the address; the body is the data.

  4. Version the contract

    /v1/users/42 lets you break the shape without breaking clients. Silent changes to endpoints are silent outages.