200 OK
The HTTP status meaning the request worked and the body holds the answer.
In more detail
Only use 200 when there really is a result. A 200 with an empty body for something that does not exist misleads clients and caches into treating it as a real result.
Example
In the APIs course: The course fault that answers 200 with an empty object for a missing task shows why: clients and caches treat it as a valid representation and cannot tell that nothing was found.Related terms
- 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.
- 404 Not Found — The HTTP status meaning there is no resource at the requested address.
- health endpoint — A web address, often /health, that a service answers quickly to show it is up.
Taught in
- What An API Is, And The Alternatives — Modern API Architecture: REST, GraphQL & gRPC
- HTTP Methods And Status Codes — Modern API Architecture: REST, GraphQL & gRPC
- Building Routes with Controllers — Modern .NET Core, C# & Enterprise Microservices
- API Documentation UI with Scalar — Modern .NET Core, C# & Enterprise Microservices
- Health Checks — Modern .NET Core, C# & Enterprise Microservices
- 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
- Edge Middleware: Auth Verification & Route Matchers — Next.js 15 & Modern App Router Architecture