HTTP Status Codes: how it works and how to build one
Every HTTP status code with what it means and when to use it. This guide explains what happens behind the button and shows the code, so you can build your own.
What it does
A searchable list of HTTP status codes from 100 to 511, with a plain explanation and when an API should send each one. Search by number or word, like ‘not found’ or 429.
When to use it
- Designing REST APIs
- Debugging failed requests
- Interview prep
How to use it
- Type a code or keyword.
- Read the meaning and when to use it.
- Copy the code line.
Try it free in your browser, nothing is uploaded: https://eskillsfy.com/tools/http-status-codes
How it works
Status codes are three digits grouped by the first: 1xx information, 2xx success, 3xx redirects, 4xx the client’s fault, 5xx the server’s fault. The tool is a searchable list; the value is in the plain explanations of when to use each one.
Choosing the right code helps clients: 401 tells them to log in, 403 that logging in won’t help, 429 to slow down and retry later.
Build it yourself
Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any TypeScript or JavaScript project.
errors.ts (ts)
// Express: send precise codes, and a JSON body clients can show.
app.post("/api/users", async (req, res) => {
if (!req.user) return res.status(401).json({ error: "Log in first" });
if (!req.user.isAdmin) return res.status(403).json({ error: "Admins only" });
if (!isValid(req.body)) return res.status(422).json({ error: "Email is invalid" });
if (await exists(req.body.email)) return res.status(409).json({ error: "Email already used" });
const user = await create(req.body);
res.status(201).location(`/api/users/${user.id}`).json(user);
});
Make it production-ready
- Return a Retry-After header with 429 and 503.
Questions
401 or 403?
401 means not logged in (or the login failed). 403 means logged in but not allowed.
Free, runs in your browser, nothing is uploaded.