HTTP status code
The three-digit number at the start of a response, such as 200 or 404, that says how the server handled the request.
In more detail
Read the first digit first: 2xx means it worked, 3xx means look elsewhere or use what you have, 4xx means the request is wrong and repeating it will not help, and 5xx means the server failed and a retry might work. The exact code then refines that family. A wrong status is a real bug, because clients, caches and retry logic act on it.
Examples
grep -c ' 404 ' access.logcurl -f https://example.com/ # fails on 4xx and 5xx201 Created, 404 Not Found, 422 validation failure, 429 Too Many Requests, 500 server error, 502 Bad Gatewayw.WriteHeader(http.StatusBadRequest)Go: w.WriteHeader(http.StatusBadRequest); resp.StatusCodeSpring MockMvc: status().isOk() asserts 200The first digit is the class: 2xx success, 3xx redirection, 4xx client error and 5xx server error. The class tells you who should investigate: a 4xx usually means the request was wrong, a 5xx that the server failed. An HTTP health check can require a particular status, which proves more than an open port.status=200 type=text cache=no id=abc is a success response with content, caching and correlation headers.status=~"5.." selects server errors in PromQL.Codes in the 200s mean success, 300s redirection, 400s a problem with the request (403 refused, 404 not found) and 500s a server error.The course uses 404 for objects the caller may not have, so existence is not confirmed, 400 for unknown fields, and 429 when a rate limit is hit.In this course: A contract test fails if a provider changes the status a consumer depends on, such as returning 200 where 201 was promised. Codes in the 200s mean success, the 400s mean the client made a mistake, and the 500s mean the server failed.Related terms
- HTTP response — The message a server sends back: a protocol version, a status code and phrase, headers, a blank line and usually a body.
- 200 OK — The HTTP status meaning the request worked and the body holds the answer.
- 404 Not Found — The HTTP status meaning there is no resource at the requested address.
- 500 Internal Server Error — The HTTP status meaning something went wrong inside the server while handling the request.
- Problem Details — A standard JSON shape for HTTP error responses, defined in RFC 9457, with members such as type, title, status, detail and instance.
- HTTP — The protocol web browsers and web servers use to send requests and responses.
- access log — A log file where a web server writes one line per request, with the client address, time, method, path and status code.
- curl — A command-line tool for sending web requests and printing the response.
- Lambda handler — The function in your code that Lambda calls for each event, receiving the event and a context object.
- rate limiting — Capping how many requests a client may make in a period of time, and rejecting or delaying the rest.
- http.ResponseWriter — The Go interface a handler uses to send its response: set headers, write the status code with WriteHeader, then write the body.
- 400 Bad Request — The HTTP status meaning the request is malformed or asks for something outside what the API allows, such as a page size above the maximum.
- load balancer health check — A test a load balancer runs against each backend, such as opening a port or requesting a URL, to decide whether it should receive traffic.
- 503 Service Unavailable — The HTTP status code meaning the server cannot handle the request right now, for example because it is overloaded or shutting down.
- error rate — The share of requests that fail, reported alongside latency so a fast result is not mistaken for a healthy one.
- metric label — A name and value attached to a metric, such as status="200", that splits one metric into separate series you can compare.
- web access log — The log a web server writes with one line per request: client address, time, request line, status code, size and often user agent.
- 403 Forbidden — The HTTP status meaning the server knows who the caller is but that identity is not allowed to do this.
- 429 Too Many Requests — The HTTP status meaning the caller has sent too many requests in a given time and should slow down.
- 202 Accepted — The HTTP status meaning the request was accepted for processing but the work has not finished yet.
- API contract — The written promise an API makes about its operations, inputs, outputs and errors, which callers rely on while the code behind it changes.
- literal type — A type that allows exactly one value, such as the string "GET", the number 404 or true.
Taught in
- Streaming Responses — AI Engineering: LLM Apps, RAG & Agents
- When The Call Fails — AI Engineering: LLM Apps, RAG & Agents
- Designing Tools A Model Can Use — AI Engineering: LLM Apps, RAG & Agents
- Capstone: The Tasks Assistant — AI Engineering: LLM Apps, RAG & Agents
- What An API Is, And The Alternatives — Modern API Architecture: REST, GraphQL & gRPC
- HTTP Methods And Status Codes — Modern API Architecture: REST, GraphQL & gRPC
- Error Handling And Safe Retries — Modern API Architecture: REST, GraphQL & gRPC
- Pipelines, tee And Process Substitution — Bash Scripting & Command Line Automation
- Finding Lines: grep And Regular Expressions — Bash Scripting & Command Line Automation
- Archives, Transfers And The Network — Bash Scripting & Command Line Automation
- Serverless Compute (Lambda) — Cloud Infrastructure & Hyperscaler Architecture
- The Dependency Injection Container: Scopes and Lifetimes — Modern .NET Core, C# & Enterprise Microservices
- Building Routes with Controllers — Modern .NET Core, C# & Enterprise Microservices
- The Repository Pattern — Modern .NET Core, C# & Enterprise Microservices
- Global Exception Handling and Problem Details — Modern .NET Core, C# & Enterprise Microservices
- Role-Based and Policy-Based Authorization — Modern .NET Core, C# & Enterprise Microservices
- Resilient Error Handling: Problem Details & Envelopes — Production Full-Stack Engineering
- API Gateway & BFF Patterns: Backend-for-Frontend — Production Full-Stack Engineering
- Distributed Tracing: OpenTelemetry & Traceparent — Production Full-Stack Engineering
- Traffic Management: Sliding Window Rate Limiting — Production Full-Stack Engineering
- Health Probes & Graceful Shutdown: Kubernetes Lifecycles — Production Full-Stack Engineering
- Continuous Delivery: Blue-Green & Canary Pipelines — Production Full-Stack Engineering
- Full-Stack System Verification: Capstone Integration — Production Full-Stack Engineering
- Writing Table Driven Tests — Concurrent Systems Programming with Go
- Calling APIs with net/http Client — Concurrent Systems Programming with Go
- Serving HTTP with net/http Server — Concurrent Systems Programming with Go
- Handling Timeouts and Errors — Concurrent Systems Programming with Go
- Controllers And Routing — Modern Java: Virtual Threads & High-Throughput Services
- Exception Handling To Problem Details — Modern Java: Virtual Threads & High-Throughput Services
- Implementing An OpenAPI Contract — Modern Java: Virtual Threads & High-Throughput Services
- Testing APIs With MockMvc — Modern Java: Virtual Threads & High-Throughput Services
- HTTP Is Text: Requests, Status Codes And Headers — Linux Fundamentals & Systems Administration
- Load Balancing: Algorithms, Health Checks And Layers — Linux Fundamentals & Systems Administration
- Not Found Handling: not-found.tsx & Programmatic Exits — Next.js 15 & Modern App Router Architecture
- Route Handlers: RESTful Endpoints with NextRequest — Next.js 15 & Modern App Router Architecture
- Native HTTP Server: Request & Response Lifecycles — Node.js Internals & Backend Services
- Native WebSockets: Bidirectional Real-Time Streams — Node.js Internals & Backend Services
- Production Hardening: Graceful Shutdown & Docker — Node.js Internals & Backend Services
- Observability Versus Monitoring — Full-Stack Observability: Metrics, Tracing & Logging
- The Three Signals: Logs, Metrics And Traces — Full-Stack Observability: Metrics, Tracing & Logging
- Cardinality And How It Bankrupts You — Full-Stack Observability: Metrics, Tracing & Logging
- The Prometheus Exposition Format — Full-Stack Observability: Metrics, Tracing & Logging
- Two Names For One Fact: Semantic Conventions And Resources — OpenTelemetry Certified Associate (OTCA) Exam Prep
- Traces From A Script Nobody Touched: Instrumentation Approaches — OpenTelemetry Certified Associate (OTCA) Exam Prep
- A Warning With An Address: Correlating Signals — OpenTelemetry Certified Associate (OTCA) Exam Prep
- Fundamentals Sprint: One Declined Card — OpenTelemetry Certified Associate (OTCA) Exam Prep
- Fifty Two Spans, Four Requests: The Trace Data Model — OpenTelemetry Certified Associate (OTCA) Exam Prep
- A Histogram That Could Not Answer: Views — OpenTelemetry Certified Associate (OTCA) Exam Prep
- Failed Twice, Flushed Fine: Error Handling And Schemas — OpenTelemetry Certified Associate (OTCA) Exam Prep
- Log Parsing, Schema Normalization (OCSF/ECS) & Extraction — Security Operations & Threat Hunting (SOC)
- Windows Event Logs, Sysmon & Linux Auditd Telemetry — Security Operations & Threat Hunting (SOC)
- Adversary Tactics, Techniques & Procedures (TTP) Mapping — Security Operations & Threat Hunting (SOC)
- Broken Object Level Authorization — Application Security & Threat Modeling for Engineers
- Mass Assignment — Application Security & Threat Modeling for Engineers
- Rate Limiting And Resource Consumption — Application Security & Threat Modeling for Engineers
- Dynamic Scanning — Application Security & Threat Modeling for Engineers
- Observability As A Design Input — Scalable System Design & Distributed Architecture
- One Assertion Per Reason — Automated Testing, TDD & Quality Engineering
- Contract Testing Between Services — Automated Testing, TDD & Quality Engineering
- Literal Types: String, Number, Boolean Literals And const — Production TypeScript
- The in Operator And Instanceof Narrowing — Production TypeScript
References
- RFC 9110: HTTP Semantics, section 15 Status codes
- MDN: HTTP response status codes
- RFC 9110: HTTP Semantics, Status Codes
- RFC 9110: HTTP Semantics, status codes
- Package net/http: constants
- RFC 9110: HTTP Semantics