All jobs / Backend developer / API Development

Backend developer interview question · 0–1 years

The interviewer asks: “When is 404 the right status, and when is 400?” Strongest answer?

The strongest answer

404: that resource isn't here (or I must not reveal that it is). 400: the request itself is malformed — bad JSON, missing field, invalid id format.

Why it works

Exactly. 400 is “you sent something I cannot interpret.” 404 is “that thing isn't here.” Don't punish a missing row with a 5xx.

What a good answer covers

Answers that fall short

Who gets asked this

More API Development questions