Response Codes

Happy paths 😃

Response codeDescription
200 OKEverything worked as expected. Generic, happy response code, if none of the other 2XX are better suited
201 CreatedReturned if we create a new resource
202 AcceptedAcknowledgement of the request but will be processed asynchronously (so the handling could still fail)
204 No ContentA successful request with no body - maybe used in the case of deleting a resource

Client error 🤦‍♂️

Response codeDescription
400 Bad RequestGeneric client error, if none of the below are more suitable
401 UnauthorizedLiterally missing auth token, or token is expired or revoked
403 ForbiddenInsufficient roles - typical if a user doesn't have permission to perform a requested action
404 Not FoundThe entity doesn't exist, for all intensive purposes (or the authenticated user has no access to it)
405 Method Not AllowedIncorrect or unsupported HTTP method used for an endpoint
422 Unprocessable EntityRequest validation error. More details should be provided in the body

Server error 🤖☠️

5XX Server error - hopefully these are rare!