Member-only story
Still Returning 200 for Every API Error? I Did for 2 Years
Clients, retries and monitoring all trust status codes, so here is what to return instead, with working examples.
Mahad Nadeem
8 min read1 day ago
Press enter or click to view image in full size
Our dashboard said 100% success. Our customers said checkout was broken.
Both were telling the truth, because every failed request had come back as 200 OK.
I spent two years writing APIs that way. Every endpoint returned 200, and the body said whether things worked: { "success": false, "error": "Order not found" } . It felt friendly. The client never had to deal with HTTP errors, and I never had to remember which code meant what.
It also quietly broke everything that reads status codes first: retries, caches, monitoring, API clients, even other developers’ patience. Here is what I return now for seven situations that cover most real APIs, with Express examples you can paste.
Start with the shape every error should share.
1.…