Error Responses
The API uses structured error responses to provide feedback when an operation fails. This document describes the general error format and some common error codes that might be encountered.
Error Response StructureCopied!
All errors follow a consistent structure to handle errors predictably. For example:
{
"error": {
"code": "BAD_REQUEST",
"message": "The provided input is invalid.",
"data": {
"{fieldKey}": {
"code": "INVALID_FIELD",
"value": "example_value"
}
}
}
}
-
error: Contains the error details.-
code: A machine-readable error code that represents the type of error. Common codes include:BAD_REQUESTUNAUTHORIZEDNOT_FOUNDINTERNAL_ERROR. -
message: A human-readable message that provides more details about the error. -
data: Optional field that provides additional details about the error. This may include:-
{fieldKey}: An object with the field key causing the issue.-
code: The specific field error code, such asINVALID_FIELD. -
value: The value that caused the error, if applicable.
-
-
-
Handling ErrorsCopied!
To handle errors effectively, ensure that your application checks the code and message fields in the response. For example:
-
If the error code is
BAD_REQUEST, review thedataobject to determine which fields were invalid. -
If the error code is
UNAUTHORIZED, ensure that valid credentials are provided in the request. -
If the error code is
NOT_FOUND, review thedataobject to determine which fields were invalid. -
If the error code is
INTERNAL_ERROR, it may be appropriate to retry the request shortly.