What is a REST API? Endpoints, methods and status codes explained
By Sina Esfahani, OmniTechs · Published 30 November 2026
A REST API lets one piece of software offer its data to other software over HTTP, the protocol your browser uses. Each kind of data (orders, customers, invoices) has its own web address. Another program sends a request to that address with a method such as GET (read) or POST (create). The server answers with a three-digit status code and usually JSON data.
REST stands for Representational State Transfer: an architectural style Roy Fielding described in 2000, not a product or an official standard. "REST API" and "RESTful API" mean the same thing in everyday use.
Your first action: ask for the API documentation of the system you need, often an OpenAPI file. Its list of endpoints shows within minutes whether your data is available, and whether you can only read it or also change it.
Read any REST API call in this order:
Endpoint: method plus address, for example GET /v1/orders/1042.
Authentication: the key or token sent along, which decides what you may see.
Request body: the data you send, only when creating or changing something.
Status code: the first digit gives the outcome (2 success, 4 your mistake, 5 the server's problem).
Response body: the data that comes back, usually JSON with named fields.
What an integration between two business systems does, and how you get a key, is covered in what an API integration is.
What makes an API RESTful?
Fielding defined REST as six constraints on how client and server talk. Together they let parts change independently, scale easily and cache responses.
The six REST constraints
| Constraint | What it means | What you notice as a buyer |
|---|---|---|
| Client-server | The app that shows data and the server that stores it are separate | You can replace the app without rebuilding the server |
| Stateless | Every request carries everything needed to understand it; the server keeps no session | The key or token goes with every request, and any server in a cluster can answer |
| Cache | Responses say whether they may be reused | Fewer calls for data that rarely changes |
| Uniform interface | Every resource has an address and is handled with the same methods and codes | Once you know one REST API, the next looks familiar |
| Layered system | Gateways and caches can sit in between unseen | The provider can add security or capacity without changing your connection |
| Code on demand | The server may send code for the client to run | Rare in business APIs; Fielding calls it optional |
Strictly, Fielding also requires hypermedia: responses with links that tell the client what it can do next. In 2008 he complained that many APIs called REST skip this. Most APIs sold as REST today use addresses, methods, status codes and JSON without full hypermedia. For a buyer that is usually fine. What matters is documented, stable behaviour.
Resources and endpoints
A resource is anything the API lets you name. In Fielding's words: "Any information that can be named can be a resource." An order, a customer or a stock level can each be one.
An endpoint is a method plus an address. Good APIs use nouns for resources and plural nouns for collections, and put the major version in the address. The Dutch government's REST API Design Rules (version 2.2.2) require exactly this.
Example addresses for an order system (hypothetical)
| Address | Points to |
|---|---|
| /v1/orders | All orders |
| /v1/orders/1042 | Order 1042 |
| /v1/customers/77/orders | The orders of customer 77 |
| /v1/orders?status=open&page=2 | A filtered, paged part of the list |
The part after the question mark holds query parameters: filters, sorting and paging. Paging matters more than it looks, as the worked example shows.
HTTP methods: what each one does
The HTTP standard (RFC 9110, 2022; PATCH in RFC 5789) defines each method. Two properties matter when something fails. A safe method only reads. An idempotent method has the same effect whether you send it once or five times.
The five methods in REST APIs
| Method | Use | Safe | Idempotent | Usual success code |
|---|---|---|---|---|
| GET | Read a resource or list | Yes | Yes | 200 |
| POST | Create something or start a process | No | No | 201 |
| PUT | Replace a resource completely | No | Yes | 200 or 204 |
| PATCH | Change some fields | No | No | 200 or 204 |
| DELETE | Remove a resource | No | Yes | 204 or 200 |
Why this matters: networks time out. A GET or PUT can safely be sent again. A POST that timed out may already have created the order, so a blind retry can make a duplicate. Ask how the API prevents that; some accept a unique reference per request and ignore repeats. Testing one read-only flow first shows how to catch duplicate and silent processing before anything writes data.
Status codes: what the answer means
The first digit gives the class: 1xx information, 2xx success, 3xx redirection, 4xx client error, 5xx server error (RFC 9110, section 15). A client that does not know a code must treat it like the x00 code of its class.
The status codes you will see most
| Code | Meaning | What to do |
|---|---|---|
| 200 OK | Succeeded | Check the content; 200 does not prove the data is complete |
| 201 Created | A new resource exists | Store its address (Location header) or ID |
| 204 No Content | Done, nothing to return | Nothing |
| 400 Bad Request | Malformed or invalid request | Read the error and fix what you send |
| 401 Unauthorized | Not authenticated | Check that the key or token is present, correct and not expired |
| 403 Forbidden | Known caller, access refused | Ask for the right permission; retrying will not help |
| 404 Not Found | Does not exist, or hidden from you | Check the ID and address |
| 409 Conflict | Clashes with the current state | Fetch the current state and decide again |
| 422 Unprocessable Content | Well-formed but unusable values | Fix the values; some APIs use 400 instead |
| 429 Too Many Requests | Rate limit reached | Wait (Retry-After, if sent) and slow down |
| 500 Internal Server Error | The server broke | Retry later; report the time and request ID if it persists |
| 503 Service Unavailable | Overloaded or in maintenance | Wait and retry |
MDN notes that 401 really means unauthenticated, while with 403 the server knows who you are and still refuses. Good APIs also return a readable error body. RFC 9457 standardises one, called problem details, with fields such as type, title, status and detail; the Dutch government's rules prescribe it.
Worked example: one order, five calls
A hypothetical order API that a webshop talks to, written out as plain text.
Five calls to a hypothetical order API
| Step | Request | Response | What it tells you |
|---|---|---|---|
| 1 | GET /v1/orders/1042 with the header Authorization: Bearer plus the token | 200 OK, JSON: id 1042, status shipped, total 149.95, currency EUR | The order exists and has shipped |
| 2 | The same GET without a token | 401 Unauthorized with a WWW-Authenticate header | Anonymous calls are refused, as they should be |
| 3 | PATCH /v1/orders/1042 with JSON: status cancelled | 409 Conflict, problem details: a shipped order cannot be cancelled | The business rule lives in the API, not only on screen |
| 4 | POST /v1/orders with JSON: customer 77, product STAND-01, quantity 2 | 201 Created, header Location: /v1/orders/1043 | Store reference 1043 |
| 5 | Many fast GET calls | 429 Too Many Requests, Retry-After: 30 | Wait 30 seconds |
Now the arithmetic that often decides whether a connection works. Suppose the API allows 60 requests per minute and you need 5,000 orders (hypothetical figures).
One order per GET: 5,000 ÷ 60 = 83.3 minutes, about 1 hour 23 minutes per full sync.
A list endpoint with 100 orders per page: 5,000 ÷ 100 = 50 requests, under one minute.
Replace 60 and 100 with the limits in your API's documentation. If it states neither, ask before anyone builds.
Authentication: proving who is calling
Because REST is stateless, every request carries its own credentials.
Common ways to authenticate
| Method | How it works | Watch out for |
|---|---|---|
| API key | A secret string sent in a header with every request | Often broad rights; ask for a read-only or limited key |
| Bearer token | A token in the Authorization header; whoever holds it can use it | Treat it like a password; tokens expire and must be renewed |
| OAuth 2.0 | An app gets limited access, often after a user approves it, and receives tokens | More set-up, but scoped and revocable without sharing a password |
All three are only safe over HTTPS. RFC 6750 makes TLS mandatory for bearer tokens. The UK Government Digital Service requires TLS 1.2 or above and warns that basic and API key authentication are not secure without HTTPS. Ask for the smallest permission that works, one key per connection, and a way to revoke it. Where to create a key in a specific package is explained in how you get an API key.
REST, GraphQL or SOAP?
REST compared with GraphQL and SOAP
| Point | REST | GraphQL | SOAP |
|---|---|---|---|
| What it is | Architectural style on HTTP | Query language with its own specification | W3C messaging protocol |
| Addresses | One per resource | Usually one endpoint, often /graphql | XML messages over a protocol such as HTTP |
| Who chooses the fields | The server | The client asks for exactly what it needs | The service contract |
| Errors | HTTP status codes | Often 200 with an errors list on partial success | A SOAP fault in the message |
Choose REST when any developer and most tools should understand it. GraphQL suits apps that need many differently shaped views of linked data. SOAP is the older XML protocol: when an existing system only offers SOAP, you connect to it rather than choose it. Webhooks are not an alternative to REST but pushed messages when something changes, explained in API, webhook or export.
What to ask a developer or supplier
Is there an OpenAPI description? A machine-readable list of endpoints, fields and errors. The UK government advises making it the first output of the design.
Can access be limited and revoked per connection? Good answer: scoped keys or OAuth, one per consumer.
What are the rate limits and page sizes? You need both for the arithmetic above.
How are duplicates prevented when a POST is retried? Good answer: a unique reference per request or a documented check.
What does an error look like? Good answer: correct codes and a readable body such as problem details.
How are versions handled? Good answer: a version in the address and a stated period in which the old one keeps working.
Is there a test environment with test data? Never try things out on live data first.
Who owns and maintains the code and documentation after launch?
If a supplier cannot answer the first three, the API is not ready for a dependable connection. In the Netherlands, public bodies must apply the NLGov REST API Design Rules when they offer REST APIs (Forum Standaardisatie, comply-or-explain list). Private companies are not bound, but the rules make a good checklist.
When to stop and get help
Stop when the documentation is missing or contradicts what the API returns, when access only comes with full rights to live financial or customer data, or when there are no rate limits and no test environment. Then a developer should read the contract with you. Bring the documentation link, the data you need in each direction, how often it must move and the error responses you received.
If you need an API of your own for customers, partners or an app, see having a custom API built. OmniTechs designs the endpoints, access rights, validation and documentation, starting with a paid Solution Sprint of €1,250 excl. VAT.

