An HTTP status code is the three-digit number a web server sends back to say how a request went.
This guide is for testers, support staff, new developers and anyone who reads web logs. You do not need to write code. If you have ever seen "404 Not Found" in a browser, you have already met one.
In short
- Every reply from a web server or API starts with a status code. The first digit tells you the family.
- 401 means the server did not get valid proof of who is asking. 403 means it knows enough and still says no.
- 500 means the server itself hit a fault. The reply should stay short and keep the technical details private.
- Patterns of codes in logs, such as many 401s in a row, can be an early sign of trouble.
What you will learn
- Read the five families of status codes at a glance.
- Tell 401 and 403 apart, and explain why the difference matters.
- Spot when an error page gives away too much.
- Use status codes in logs as simple warning signs.
- Request
- a message from a browser, app or script asking a server for something.
- Response
- the server's reply, which starts with a status code.
- Credentials
- the proof a caller sends to show who it is, such as a password, token or key.
What are HTTP status codes?
Think of a reception desk in an office building. You hand over a request and get a quick answer. It might be "here you go", "show me your badge", "you are not allowed in" or "sorry, our system is down".
A web server works the same way. Each reply carries a three-digit number. The first digit sorts it into a family. Codes starting with 4 mean the client seems to have made a mistake, and codes starting with 5 mean the server has a problem [1]. Codes starting with 3 mean the caller needs to take another step, such as going to a new address [1].
| Family | Plain meaning | Common example |
|---|---|---|
| 1xx | Information: carry on | 100 Continue |
| 2xx | It worked | 200 OK |
| 3xx | Go somewhere else or take another step | A move to a new address |
| 4xx | The request has a problem | 401, 403, 404, 429 |
| 5xx | The server has a problem | 500 |
Where the comparison stops working: a receptionist can explain and ask questions. A status code is just a number, and servers do not always pick the right one.
New to how requests travel? Read API Security for Beginners first.
Why does it matter?
Status codes are small, but they show whether checks on identity and access are working. They also show up in every log, which makes them cheap warning signs.
If you build or test web apps
What could happen: a page returns 200 OK to someone who should have been refused, and nobody notices.
Check this: test each private page with no credentials and with the wrong user. Expect 401 or 403.
If you watch logs or alerts
What could happen: a burst of 401s from one source goes unread, though it may be someone guessing passwords or keys.
Check this: set a simple alert for unusual spikes in 401, 403 and 429 replies.
Next: Logging for Beginners
If you run a service with an API
What could happen: a 500 error page shows software names and versions, which helps an attacker plan.
Check this: trigger an error on purpose in a test system and read what the reply reveals.
What does it look like?
Here are made-up log lines from a small web service. Each line shows the time, the caller, the path asked for and the status code.
Example only. All values are made up.
09:00:01 caller=EXAMPLE-app GET /reports 200 (1) 09:00:02 caller=none GET /reports 401 (2) 09:00:03 caller=EXAMPLE-bot GET /admin 403 (3) 09:00:04 caller=EXAMPLE-bot GET /old-page 404 (4) 09:00:05 caller=EXAMPLE-bot GET /reports 429 (5) 09:00:06 caller=EXAMPLE-app GET /search?q=0000 500 (6)
- 200: the request worked and the caller got the report.
- 401: no valid credentials came with the request, so the server asked who is calling.
- 403: the server knows the caller but will not let it into the admin area.
- 404: nothing found at that address. In a real file, this line would contain the caller's network address too.
- 429: the caller sent too many requests in a short time.
- 500: the server hit an unexpected fault. Check what the reply showed the caller.
Why this is risky: one caller hitting 403, 404 and 429 in a few seconds may be probing the service.
The safer way: watch for patterns like this and keep every error reply short and generic.
How does it work?
- The request arrives. It names a path, such as /reports, and may carry credentials.
- The server checks who is asking. If the credentials are missing or not valid, it should answer 401. A 401 reply must also say how to prove who you are [1].
- The server checks what they may do. If the caller is known but not allowed, it answers 403. The standard says the server understood the request but refuses it [1].
- The server checks the pace. If one caller sends too many requests in a given time, it can answer 429. That reply may say how long to wait [2].
- The server does the work. If all goes well, it answers 200. If it hits an unexpected fault, it answers 500 [1].

A server does not always want to admit that something exists. The standard lets it answer 404 Not Found instead of 403, which hides the page from callers who should not know about it [1].
Error pages need care too. OWASP warns that unhandled errors can reveal software names and versions, which helps attackers in their early research [3]. It suggests one central error handler that logs the details and sends back a generic reply [3].
A worked example
This story is made up to show the idea.
Kofi Hollis looks after a small online shop's systems. Each morning he skims a dashboard of status codes from the shop's API.
One Monday he sees a sharp rise in 401 replies overnight. They all come from one network address and target the API used by delivery partners.
Kofi checks the shop's list of partner keys. None of them match the failed attempts. It looks like someone is guessing keys, so he blocks the address and tells the team.
Later that day, a tester, Kofi Iyer, reports something else. A broken search sends back a 500 error page with a long technical trace. It names the database and the framework version.
The developers add a central error handler. Now a fault sends back a short message and a reference number, while the full trace goes to the private logs.
They also add a limit on requests per caller. Callers who go over it get 429 replies, and the dashboard shows them.
The following week, the dashboard shows a few callers hitting the new limit. Kofi checks them, and they turn out to be a partner script stuck in a loop.
Kofi learned that status codes are a quick health check. Rising 401s pointed to guessing, and a chatty 500 page showed details that should have stayed private.
Myths and mistakes
| What people think | What is true |
|---|---|
| 401 Unauthorized is about permissions. | Despite its name, 401 is about missing or invalid credentials[1]. A known caller who lacks permission should get 403. |
| 403 means "log in and try again". | The standard says the client should not simply repeat the request with the same credentials[1]. |
| A detailed 500 page helps everyone. | It helps attackers too. Keep details in logs and send a generic reply[3]. |
| A 200 OK means the access check passed. | 200 only says the server did the work. If the access check is missing, it will still say 200. |
| 404 always means the page does not exist. | A server may use 404 to hide a page the caller is not allowed to know about[1]. |
What can I do this week?
- Open your web or API logs and count the 401, 403, 429 and 500 replies for one day.
- Try a private page with no credentials in a test system. Note which code you get.
- Cause an error on purpose in a test system and read what the reply reveals.
- Read Authentication vs Authorisation for Beginners to fix the 401 and 403 difference in your mind.
Checklist
- I can name the five status code families by their first digit.
- I know 401 is about proving who you are, and 403 is about what you may do.
- I check that private pages refuse callers with no credentials.
- I keep error replies short and generic.
- I keep full error details in private logs.
- I watch for spikes in 401, 403 and 429 replies.
- I do not treat a 200 OK as proof that access checks ran.
Common questions
What is the difference between 401 and 403?
401 means the server did not get valid credentials, so it does not know who is asking. 403 means the server understood the request but refuses it, often because the caller lacks permission. In short, 401 is about identity and 403 is about access.
Why would a site show 404 when the page exists?
Sometimes a server hides a page from callers who are not allowed to see it. The HTTP standard lets a server answer 404 instead of 403 for this reason. It stops outsiders learning which private pages exist.
Is a 500 error a security problem?
Not always, since it just means the server hit an unexpected fault. It becomes a problem when the error page shows internal details such as software versions or code traces. Those details belong in private logs.
What does 429 Too Many Requests mean?
It means the caller sent too many requests in a given time. The reply may include a Retry-After header saying how long to wait[2]. Servers use it to slow down floods of requests, including password or key guessing.
Do apps and scripts get status codes too?
Yes. Software that calls an API, such as a service account or an AI agent, gets the same codes. A run of 401s from a script can mean its key has expired or been revoked, which is worth checking.
Where next?
Ready for the detail? Read the practitioner guide: API Security Guide. It covers how APIs check identity and access, and how to test and monitor them.
Also useful:
- Authentication vs Authorisation for Beginners
- Error Handling for Beginners
- Rate Limiting for Beginners
- Account Enumeration for Beginners
Related NHI Mgmt Group resources: Broken Access Control Prevention Guide, Rate Limiting and API Abuse Guide and Authentication vs Authorisation.
Key terms
- HTTP status codes
- Three-digit numbers a web server sends to say how a request went.
- A reply meaning the request lacked valid credentials, so the server does not know who is asking.
- 403 Forbidden
- A reply meaning the server understood the request but refuses to carry it out.
- 429 Too Many Requests
- A reply meaning the caller sent too many requests in a given time.
- Authentication
- Checking who a person or piece of software is.
- Deciding what a known person or piece of software is allowed to do.
- Verbose error messages
- Error replies that reveal internal details, such as code traces or software versions.
Sources and further reading
- IETF, "RFC 9110: HTTP Semantics", Section 15 (Status Codes), June 2022. https://www.rfc-editor.org/rfc/rfc9110.html (accessed 1 Dec 2026).
- IETF, "RFC 6585: Additional HTTP Status Codes", Section 4 (429 Too Many Requests), April 2012. https://www.rfc-editor.org/rfc/rfc6585.html (accessed 1 Dec 2026).
- OWASP, "Error Handling Cheat Sheet", OWASP Cheat Sheet Series. https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html (accessed 1 Dec 2026).