What it means
The resource or route does not exist. Not for an empty result set, and not for a failed validation. Also the right answer when you want to hide a resource's existence from an unauthorised caller.
- Class
- 4xx Client error
- Defined in
- RFC 9110 §15.5.5
- Cached by default
- Yes, without explicit headers
When you receive a 404
- Check the URL for typos, a missing or extra trailing slash, the wrong API version, and letter case - paths are case-sensitive on most servers.
- For an API, check the id exists and belongs to the account you are calling as. Some APIs return 404 instead of 403 to avoid confirming it exists.
- A single-page app that 404s on refresh usually means the server is not configured to serve
index.htmlfor client-side routes.
When you send a 404
- When no resource or route matches the request.
- Not for an empty search result - that is 200 with an empty list.
- If the resource existed and is gone for good,
410 Gonesays so, and search engines drop it sooner.
On the wire
HTTP/1.1 404 Not Found
Content-Type: application/json
{"error": "not_found", "detail": "No order with id ord_9999"}