Javarevisited

A humble place to learn Java and Programming better.

Follow publication

Member-only story

REST API BEST PRACTISES #4

16 Common REST API Status Code Mistakes to Avoid in 2025

Did you know 70+% API bugs come from misused status codes?

Sivaram Rasathurai
Javarevisited
Published in
7 min readFeb 26, 2025

Photo by Eliobed Suarez on Unsplash

I messed up this week. We’re building a REST API, and a user clicks “Generate Report.

It’s a big task — takes a while — so I send back a 200 OK with a “Hold on, it’s coming!” message.

Done, right? Nope. My junior dev smirks and says, “Shouldn’t that be 202 Accepted since it’s still processing?

Wait… what? I flip open RFC 7231, Section 6.3.3, and — yep — he’s got me! 😅.

That got me thinking: How many other status codes are we using wrong? Turns out, a lot.

Non Medium Member Alert!!!
If you block by medium pay wall, You can read it with this link.
Dear Folks, Your 50 claps 👏👏 help the discussion [article] reach more developers 👀 on Medium, and your comments 💬 make me to keep writing.

So,

Here are 16 status code best practices to keep your API clean. Let’s go🚀

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Javarevisited
Javarevisited

Published in Javarevisited

A humble place to learn Java and Programming better.

Responses (5)

Write a response

Good article. It could have been even better by elaborating more on the 422 status

--

Thanks for this, just pointing out that your delete 404 example response (9) seems to contradict what you were recommending earlier for when not to use 404 (4).

--

I don't agree with the best practice for "15. Handing CORS Issues Incorrectly" . The API does not handle CORS errors, the browser does. The API just returns the correct Access-Control-XXX headers. I can't think of any scenario where the API returns a 403 for a CORS issue. Do you have one in mind?

--