Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Web, API & dataMiddleCommonTheory

How do 400, 401, 403, 404, 409, 415, 422 and 429 differ in an API?

Answer

400 is a generic malformed/invalid request; 401 normally means authentication is missing or invalid; 403 means the caller is not permitted; 404 means the resource is not found; 409 is a conflict with current state; 415 means the request media type is unsupported; 422 means the server understands the syntax but cannot process the content semantically; and 429 means the client exceeded a rate limit. A strong API test checks that the exact failure maps to the intended contract code.

Strong answer includes

  • 401 authentication versus 403 authorization
  • 409 conflict versus 422 semantic validation
  • 415 media type and 429 rate limiting

Practical example

A request with an expired token should normally fail as 401, while the same endpoint called with a valid token for a user lacking the admin role should fail as 403 rather than being treated as the same authentication case.

#http#status-codes#rest-api#authentication

Sources

MDN HTTP referenceMozilla · HTTP methods, messages, status codes, headers, cookies and cachingDOU — QA interview: 250+ questionsDOU · Coverage signal across Junior, Middle, Senior, AQA, web, mobile and practical topics