← Glossary

What Is a REST API?

A REST API applies Representational State Transfer principles to a service interface: resources, representations, stateless requests and a uniform interface. Most web implementations use HTTP, though the architectural style is not a synonym for HTTP or JSON.

Updated:

A REST API is an interface designed around Representational State Transfer, an architectural style described by Roy Fielding. It models resources with identifiers and exchanges representations through a uniform interface. On the web, HTTP supplies the standard methods and message semantics. REST itself is an architectural description rather than a particular data format or a requirement to use JSON. Many services called REST APIs adopt only some of the constraints, so the label alone does not establish how an interface behaves.

Resources and Representations

Fielding defines a resource as a conceptual mapping to a set of entities, not the entity itself at any one moment. A resource such as the customer with identifier 1042 keeps its identity while its data changes over time. RFC 9110 uses the same model for HTTP: the target of a request is a resource, usually identified by a URI, and HTTP places no restriction on what a resource can be, only on how it is interacted with.

A resource representation is what actually travels over the wire. RFC 9110 describes it as information intended to reflect a past, current or desired state of a resource, consisting of the bytes plus metadata that describes them, such as the media type. One resource can have several representations: the same order might be available as JSON for a mobile app, as XML for a legacy integration and as a PDF invoice for a human. Content negotiation, driven by request headers, selects among them. The distinction is useful when designing the interface: the URI names the thing, the media type names the form, and the two are deliberately decoupled.

A client can change state by sending a representation, such as an updated customer record with PUT, or submit content for processing with POST. REST does not mean every action is a full replacement. Its uniform-interface constraints cover resource identification, manipulation through representations, self-descriptive messages and hypermedia controls that describe available transitions.

Stateless Requests and HTTP Methods

Statelessness

A stateless API makes each request understandable without relying on a remembered sequence of previous requests from that client. Session context is carried by the client; persistent resource data can remain on the server. This reduces dependence on one server instance and simplifies recovery, but it does not guarantee that any failed operation is safe to retry. Authentication, authorization and database checks still happen server-side. Clients may repeat tokens, cursors or other context instead of assuming a prior conversation is remembered.

Statelessness concerns session state, not resource state. A REST server certainly stores data; the rule is that it does not keep per-client conversational memory such as which step of a wizard a particular client has reached.

The uniform interface of HTTP methods

HTTP implementations of REST use the standard methods as their verbs, relying on the semantics RFC 9110 assigns to each.

MethodSemantics (RFC 9110)SafeIdempotent
GETTransfer a current representation of the target resourceYesYes
HEADSame as GET without the contentYesYes
PUTReplace the resource's state with the enclosed representationNoYes
DELETERemove the association between the target URI and its functionalityNoYes
POSTProcess the enclosed representation according to the resource's own semanticsNoNo

Safe means the client neither requests nor expects a state change on the server, so automated retrieval should not intentionally trigger operations such as deleting an account. Logging and other incidental effects may still occur. Idempotent means repeating the request has the same intended effect as sending it once, which is what allows a client to retry a PUT or DELETE after a timeout without intentionally applying the operation twice; response codes and incidental logging can still differ. POST is neither, which is why a retried POST can create two orders. Clients should not assume they can retry it unless the API documents an appropriate guarantee, such as an idempotency mechanism. PATCH, for partial updates, is defined in a separate specification rather than in RFC 9110. A design that pushes every operation through POST to a single URI discards these guarantees, and often indicates an operation-oriented design rather than a resource-oriented uniform interface.

What Makes an API RESTful

A RESTful API is one that honours the constraints rather than one that merely uses HTTP and JSON. Fielding lists them: client-server separation, statelessness, cacheability of responses, a layered system in which each component sees only its neighbour, the uniform interface described above, and optional code-on-demand. Of these, the uniform interface is what most distinguishes REST, and its hypermedia element is the one most frequently dropped. In a fully RESTful system a client starts from an entry URI and discovers what it can do from links and forms in the responses, in the same way a browser user navigates a website without a manual. Most APIs described as REST instead publish fixed URI templates in documentation and expect clients to construct them. They are resource-oriented HTTP APIs, which is a sensible design, but they stop short of the full style. Whether that matters depends on the goal: hypermedia buys loose coupling and independent evolution, at the price of more complex clients.

REST vs RPC and Other API Styles

Remote procedure call (RPC) styles expose operations. A client calls getCustomer or cancelOrder, typically by POSTing a message to an endpoint whose name is the operation, and the message format defines parameters and results. gRPC and JSON-RPC are examples, and many so-called REST APIs are RPC in practice. The contrast with REST is where the vocabulary lives: RPC has many verbs and few nouns, REST has few verbs and many nouns. RPC can be more compact and more natural for actions that do not map cleanly to resource state; REST gives intermediaries, caches and generic tooling a shared understanding of every request.

GraphQL lets clients select fields from a schema, usually through one HTTP endpoint. It can reduce unwanted response fields and combine related retrievals. It does not inherently eliminate HTTP caching: query operations can use GET, while mutations must not. Cache design depends on the operation, transport and authorization. Streaming channels and webhooks solve other communication needs; a webhook commonly delivers an event through an ordinary HTTP request. These mechanisms can coexist with REST endpoints rather than forcing one exclusive style.

Common Uses and Limitations

REST suits public web services where many independent clients, written in different languages, need a predictable interface that ordinary HTTP tooling can exercise: payment gateways, cloud infrastructure control planes, content management back ends and the data layers behind single-page applications and mobile apps. Its reliance on standard methods and status codes means that proxies, CDNs, browsers and command-line tools understand its traffic without special support, and that caching can be applied at the HTTP layer.

Its limitations are equally structural. Resource modelling can be awkward for workflows and bulk operations that are not naturally a single resource's state. Fetching a graph of related objects can require many round trips or ad hoc expansion parameters. Statelessness pushes repeated metadata into every request. REST specifies no standard for authentication, versioning, error bodies or pagination, so each API makes its own choices and clients must learn them. And because the label is applied loosely, a developer cannot infer from the word REST alone whether responses are cacheable, whether PUT is really idempotent, or whether hypermedia links exist. The documentation, not the name, settles those questions.

Frequently asked questions

Does REST require JSON?

No. REST is defined in terms of resources and representations, and a resource can have several representations selected by content negotiation. JSON is the most common format for web APIs today, but XML, HTML, plain text and binary media types are equally valid representations under the style.

What does stateless mean in a REST API?

The request supplies the context needed to interpret it without a remembered client conversation. Resource data, permissions and account records can still live on the server. Statelessness makes some scaling and recovery tasks easier, but retry safety depends on method and application semantics, not statelessness alone.

Is every HTTP API RESTful?

No. Many APIs that use HTTP and JSON are really RPC: they expose operation names and send everything through POST to one endpoint. A RESTful API models resources, uses the standard HTTP methods with their safety and idempotency semantics, labels cacheability, and in its full form links representations with hypermedia controls.

Why does idempotency matter for HTTP methods?

An idempotent operation has the same intended effect when an identical request is repeated, even if its response changes. That helps clients recover from uncertain outcomes. PUT and DELETE have idempotent HTTP semantics; POST does not guarantee them. Clients should also consider concurrency and the API’s documented retry behaviour.

How does REST differ from GraphQL?

REST organizes interactions around resources and a uniform interface. GraphQL lets clients select fields and relationships through a schema, commonly using one endpoint. GraphQL queries may use GET and HTTP caching; mutations use different rules. Neither style alone guarantees fewer requests or better performance for every workload.