Skip to content

Endpoint

An endpoint is the addressable point at which a service or API is reachable — typically a URL plus an HTTP method, a host:port pair, or a UNIX socket — where requests arrive and responses leave.

Definition

What it is

An endpoint is where traffic lands. In a REST API, an endpoint is (method, URL): GET /users/42 and DELETE /users/42 are two different endpoints that share a URL. In a TCP service, an endpoint is a host:port pair. In a Unix service, an endpoint is a socket path. In WebSocket, an endpoint is the URL plus the upgrade handshake.

An endpoint is not the same as a URL. A URL names a resource (/users/42). An endpoint names a way to act on it (GET /users/42, DELETE /users/42). Two endpoints may share the same URL. One endpoint may answer a URL range (/users/{id}).

Why it matters

Every public API is a set of endpoints. The discovery question ("what can I do with this service?") is answered by the endpoint list. The documentation question ("how do I call this?") is answered by the endpoint signature. The monitoring question ("is the service healthy?") is answered by the endpoint's availability and latency. Every change to an endpoint is a change to the contract.

Endpoint vs URL vs route vs path

Term

Example

Role

URL

https://api.example.com/users/42

Full locator

Path

/users/42

URL without host and scheme

Route

GET /users/{id}

Server's matching rule

Endpoint

GET /users/42

Method + URL, the callable unit

Where an endpoint sits in the request path

graph LR
  C[Client] --> DNS[DNS resolve]
  DNS --> LB[Load balancer]
  LB --> GW[API gateway]
  GW --> R[Router]
  R --> EP[Endpoint handler]
  EP --> R
  R --> GW
  GW --> LB
  LB --> C
  style EP fill:#E8F5E9

How to design endpoints that age well

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.

Common failures

Origin

In the 1970s, an endpoint was one of the two vertices of a network connection: a host plus a port, or a socket. TCP/IP formalized it: a socket address is (IP, port), and each connection has two endpoints. When HTTP and REST arrived in the 1990s, the term was borrowed: an endpoint was the addressable unit of an API, the URL plus the method. The metaphor survived: an endpoint is a place where traffic lands.

An HTTP endpoint is a URL that identifies a resource on a server, combined with an HTTP method that defines what operation is performed on that resource.

— adapted from RFC 9110, 2022
1970s · "endpoint" en protocolos de red
1994 · REST formaliza el uso en APIs (Fielding, tesis doctoral 2000)
2010 · OpenAPI 1.0 populariza la documentación de endpoints
2022 · RFC 9110 consolida "endpoint" en HTTP

Evidence

FAQ

Endpoint vs URL?

A URL is the address of a resource. An endpoint is a method plus URL — the callable unit. Two endpoints can share one URL.

Endpoint vs route?

A route is the server's matching rule. An endpoint is the concept the client calls. The route implements the endpoint.

How many endpoints?

Enough to model the resources, no more. Every endpoint is a contract and a maintenance cost.

How to version?

In the URL (/v1/), in a header (Accept: application/vnd.api+json;version=1), or not at all if the change is backwards compatible. Pick one and document it.

Connections

Etymology

Origin: compound

  • end (noun): Old English ende, "boundary, extremity"
  • point (noun): Latin punctum, "a small hole, a dot"

Semantic network

Endpointapi-designnetworkingURLRouteapi-gatewarestopenapi

● broader ● narrower ● related

Broader

  • api-design
  • networking

Related

Used in the garden

Sources