What Is a RESTful API?
A RESTful API follows architectural constraints for identifying resources and exchanging representations. Learn how REST relates to HTTP, JSON, and common API methods.

A RESTful API is an interface designed around the constraints of Representational State Transfer (REST), an architectural style for distributed systems. It identifies resources, exchanges representations of their state through a uniform interface, and follows constraints such as stateless requests, cacheable responses, and a layered system. HTTP is the common protocol used to implement web APIs in this style; JSON is one possible representation format.
Calling an API “RESTful” is often informal shorthand for an HTTP API with resource-like URLs and standard methods. That pattern alone does not establish that the API meets REST’s full architectural constraints. This distinction matters when designing systems, documenting behavior, and deciding what a client can reliably assume.
1. REST, APIs, resources, and representations
An API is an interface that lets software request information or actions from another system. REST describes an architectural style for building networked systems; it is not itself a protocol, programming language, or data format.

A resource is the conceptual thing a client can address: a user, a document, a collection, or a service. It is not necessarily one database row or file. A resource identifier, commonly a URI, names that resource. A representation is the transferable description of its current or intended state, including data and metadata. The same resource might have more than one representation, such as JSON or HTML.
For example, /users/42 could identify a user resource. A response might represent that user in JSON, but the resource and its representation are different concepts: the resource is the thing being addressed, and the representation is what the server transfers about it.
2. What makes an API RESTful?
Roy Fielding’s REST style combines architectural constraints. The constraints work together; a route naming convention or a set of HTTP verbs by itself is not enough. Fielding identifies the uniform interface as the distinguishing feature of REST. Fielding’s dissertation, Chapter 5

Client-server separation
The client handles user-interface concerns while the server handles data storage and resource management. This separation lets each side evolve independently as long as their interface remains compatible. A browser interface can change without requiring the server to adopt its presentation logic, and a server can change its internals without requiring every client to know how the data is stored.
Stateless interaction
Each request contains the information the server needs to understand and process that request. The server does not depend on conversational context retained from a previous request. Statelessness does not mean the overall application has no state: resources can change, users can have accounts, and clients can send credentials or other context with each request.
A practical consequence is that requests may repeat authentication and other context. That can make interactions easier to understand and distribute, but it can add repeated information to requests. If a client depends on hidden server-side conversation state, its behavior becomes harder to reproduce and move between servers.
Cacheability
Responses should indicate whether a client or intermediary can reuse them. Reusing an eligible response can avoid a network request and reduce repeated work. Cache directives must fit the data: reusing a stale or user-specific response can produce incorrect results or expose information. HTTP defines cache behavior and related semantics separately from REST’s architectural description.
Uniform interface
Clients and servers use a consistent interface instead of inventing a different interaction rule for every resource. Fielding describes four parts: identifying resources; manipulating resources through representations; using self-descriptive messages; and hypermedia as the engine of application state. Hypermedia means that representations can provide links or controls through which a client discovers available next actions, rather than relying entirely on out-of-band knowledge of every possible route.
This is the constraint most often missing from APIs casually called RESTful. A service may use HTTP and JSON, and still require clients to hard-code every route and action. Such an API can be useful, but its uniform interface does not necessarily provide the full discovery model Fielding describes.
Layered system
A client may communicate through intermediaries such as proxies or gateways without needing to know each layer’s internal details. Layers can support concerns such as routing or caching while preserving the interface visible to the client. This improves separation, though each added layer can also add processing and another place to investigate when a request fails.
Code-on-demand (optional)
A server can optionally send executable code that extends a client’s capabilities. Because this constraint is optional, a system does not fail the REST definition simply because it does not transfer code to clients.
3. REST, HTTP, and JSON are different things
| Term | What it describes | Example |
|---|---|---|
| REST | An architectural style and its constraints | Stateless interactions and a uniform interface |
| HTTP | A protocol with standardized request and response semantics | GET, status codes, and headers |
| JSON | A representation format | {"id":42,"name":"Rae"} |
REST does not inherently require HTTP, although HTTP is its familiar web deployment. REST does not require JSON either; HTML and other media types can represent resources. HTTP plus JSON is therefore not proof that an API is formally RESTful. MDN notes that “REST API” is often used colloquially for an HTTP service that may not satisfy every REST constraint. MDN: REST
When you know only that a service accepts HTTP requests, “HTTP API” is the precise label. “RESTful API” is appropriate when the system is designed around the REST constraints, including a uniform interface and hypermedia-driven application state.
4. Common HTTP methods and what they mean
HTTP method semantics are standardized independently of the REST style. An API should use a method in a way that respects its defined meaning, so clients and intermediaries can make sound decisions about retries, caching, and side effects. See RFC 9110, Methods.
| Method | General meaning | Safe? | Idempotent? |
|---|---|---|---|
GET |
Transfer a current representation of the target resource | Yes | Yes |
POST |
Submit content for resource-specific processing | No | Not generally |
PUT |
Create or replace the target resource’s representation | No | Yes |
DELETE |
Remove the target resource’s current representations | No | Yes |
PATCH |
Apply a partial modification | Usually no | Depends on the patch operation |
Safe means the client does not request a state change. It does not forbid incidental effects such as server logging. Idempotent means repeating an identical request has the same intended effect as making it once; the response may differ, and incidental effects can still occur. The terms are related but distinct. RFC 9110 defines GET, HEAD, OPTIONS, and TRACE as safe; safe methods plus PUT and DELETE are idempotent.
These semantics have practical consequences. Repeating a GET to recover from a dropped connection is normally reasonable. Repeating a POST that creates a payment or order can duplicate the operation unless the API provides a way to recognize a retry. A method name alone is not a complete retry policy: check the endpoint’s documented behavior and any idempotency mechanism it provides.
5. A small HTTP API example
The following is an illustrative request shape, not a claim about a specific live service. A client retrieves a resource representation with GET:
curl -i https://api.example.test/users/42
A response might include a status, metadata, and JSON representation:
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: max-age=60
{"id":42,"name":"Rae"}
A client might submit a replacement representation with PUT:
curl -i -X PUT https://api.example.test/users/42 \
-H 'Content-Type: application/json' \
--data '{"id":42,"name":"Rae Chen"}'
These examples demonstrate HTTP semantics and a resource-oriented URL. They do not show whether the full API has client-server separation, cache rules, layered intermediaries, self-descriptive messages, or hypermedia controls. That requires examining the complete design and its representations.
6. How to assess or design a RESTful API
- Identify the resources. Name the conceptual things clients need to address. Avoid treating every internal database table as automatically deserving a public resource.
- Choose stable identifiers. Give clients a way to address resources independently of their current representation or storage implementation.
- Use method semantics consistently. Retrieval should not secretly perform a requested state change; replacement and deletion should have their documented meanings.
- Make messages self-descriptive. Include media types, status codes, and relevant metadata so clients can interpret responses rather than relying on undocumented assumptions.
- Define cache behavior. State when representations may be reused and account for freshness and privacy.
- Keep requests self-contained. Ensure credentials and other necessary context accompany each request instead of depending on an invisible earlier interaction.
- Provide hypermedia controls when claiming full REST. Let clients discover relevant actions through representations when the design depends on hypermedia-driven application state.
- Test through the public interface. Verify that clients can use the documented methods, representations, and controls without needing access to internal server state.
These steps do not prescribe one URL style, JSON schema, or naming convention. The architectural question is how the system communicates and evolves, not whether every route follows a particular punctuation rule.
7. Trade-offs, performance, reliability, and cost
REST’s constraints favor a general, visible interface and independent evolution. That generality can cost efficiency for a narrowly tailored interaction: a client may need multiple requests, and stateless messages may repeat context. Fielding describes these as architectural trade-offs, not evidence that REST is always faster or better.
Caching can reduce repeated network work when the response is cacheable and fresh. It can also return stale information if freshness rules are wrong. Intermediaries in a layered system can support routing and reuse, but add hops and complicate diagnosis. Measure the behavior that matters to your application rather than assuming an architectural label guarantees latency or throughput.
For reliability, preserve HTTP semantics in client retry logic. Safe and idempotent requests are generally easier to retry after transient network failures. A non-idempotent operation may have reached the server even if the client never received its response, so retrying blindly can repeat the effect. Use endpoint documentation, request identifiers or idempotency support when available, and explicit timeouts. REST itself does not specify a price model, uptime commitment, or performance target; those depend on the service and its deployment.
8. Troubleshooting REST terminology and behavior
| Problem | Likely cause | What to do |
|---|---|---|
| “It uses JSON, so it must be REST.” | Confusing a representation format with an architecture | Check the resource model, message semantics, statelessness, caching, layers, and uniform interface. |
| “Every URL is a resource, so it is RESTful.” | Resource-like paths are mistaken for all REST constraints | Inspect how clients interpret representations and discover actions, including hypermedia controls. |
| A client repeats a create request after a timeout | The response was lost, but the server may have processed the first POST | Do not assume POST is idempotent. Check for API-supported duplicate protection before retrying. |
| A GET changes application data | The endpoint violates the expected safe meaning or exposes an incidental effect as requested behavior | Move the requested state change to an appropriate method and keep GET retrieval-oriented. |
| A client receives stale data | Cache directives or freshness assumptions do not fit the resource | Review response cache metadata and the client or intermediary’s reuse policy. |
| Requests work only after a prior call | The server may rely on hidden conversational state | Include the required context in each request and make the interaction understandable on its own. |
| “REST” and “HTTP API” are used interchangeably in documentation | Informal usage obscures which constraints are actually supported | Describe the observable interface precisely; reserve the stronger RESTful claim for an architecture that supports it. |
9. Browser screenshots as an HTTP API use case
A screenshot service illustrates the difference between using HTTP and proving REST conformance. For example, ScreenshotNeo is a website screenshot API and MCP server: a GET request with a URL returns an image or PDF. That is a concrete HTTP interface, but the presence of GET alone does not establish every REST constraint. For its request options and response details, see the ScreenshotNeo API documentation.
Or skip the browser setup
For a website screenshot, ScreenshotNeo can capture a page with one GET request. It removes cookie banners, popups, and chat widgets before the shot. Bot checks, blank pages, and failed loads are never billed; responses identify page verdict and billing status. Its MCP server lets AI agents use screenshot tools, and 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000.
cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
See the API docs for configuration details, then sign up for 1,000 free screenshots a month, with no card required.
FAQ
What does REST stand for?
Representational State Transfer. It names an architectural style for distributed systems.
What’s the difference between an API and a REST API?
API is the broad term for a software interface. A REST API is designed around REST constraints; in casual usage, the phrase often means an HTTP API, even when full REST conformance has not been established.
Does a RESTful API have to return JSON?
No. JSON is one representation format. REST does not require it.
Does stateless mean the server cannot store user data?
No. It means the server does not depend on prior conversational context to understand each request. The application can still store resources and user data.
Is REST always faster than another API design?
No. REST makes architectural trade-offs. Performance depends on the interaction, representations, caching, network, and implementation.
Can an API use HTTP and still not be fully RESTful?
Yes. HTTP is a protocol; REST is an architectural style with constraints beyond using HTTP methods and URLs.


