4xx
HTTP response code should be returned for all application level errors and the response should always contain a
JSON-encoded body.
If any non 2xx
HTTP response code is returned then the request will have been fully rolled back and should have no impact on any data.
HTTP Response Codes
The different types of errors which may occur in the application (excluding any network or routing errors) typically belong to one of the following HTTP response codes:- 400 Bad Request
- 401 Unauthorized
- 404 Not Found
- 405 Not Allowed
- 409 Conflict
- 412 Not Supported
- 422 Unprocessable
- 500 Internal Error
- 503 Service Unavailable
- Other 5xx Errors
400 Bad Request
The server cannot or will not process the request due to something that is perceived to be a client error.Request Not Valid
Response Example
Parse Error
The server was not able to parse the request body or the decoded request body was not the proper data type.Response Example
OpenAPI Validation
Before the server begins to process the request it will validate the full request against the OpenAPI spec. Specifically, the parts of the request which are validated are:- Headers
- Cookies
- Body
- Query
- Path
- Security Scheme
openapi
type error with the details
describing which step failed validation in the key
and a message
describing the failure.
Response Example
401 Unauthorized
The request requires user authentication. If the request lacks valid credentials, the server will respond with a “401 Unauthorized” error.Response Example
404 Not Found
The server can not find the requested resource. In the context of this API, this will mean that the endpoint is valid but the resource itself does not exist or a resource that was referenced in the request does not exist.Response Example
405 Not Allowed
The request method is known by the server but is not supported by the target resource.Response Example
409 Conflict
Errors that do not fit one of the other response types may use this response code.Response Example
412 Not Supported
The request is known by the server but a required feature may be disabled or it is not supported by the requested API version.Response Example
422 Unprocessable
The request encountered an anticipated error during processing.Response Example
message
but not a details
array.
Response Example
500 Internal Error
An unexpected/internal error is an indication that something went wrong, possibly indicating a bug or a temporary service interruption. Although these errors should be exceedingly rare, you should anticipate that they may occur as these errors will likely not be returned in a JSON-encoded format.503 Service Unavailable
The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded.Other 5xx errors
Any other5xx
range errors are likely due to a network or routing issue and should be temporary and will likely not have a predictable response format.