Handle Errors

When interacting with our API, it's crucial to handle errors gracefully. Our API uses a consistent JSON structure to communicate errors, ensuring that your application can parse them programmatically.

When a request fails, you'll receive a JSON response body following the structure detailed below.

Error Object Structure

FieldTypeDescription
statusnumberThe HTTP status code associated with the error.
codestringA machine-readable error code for programmatic handling.
messagestringA human-readable message providing a summary of the error.
errorsobject(Optional) An object where each key is a form field and the value is an array of string error messages for that field. This is typically present for validation errors (e.g., HTTP 400).

Example Error Response

This example shows a validation error response. Note how the errors object provides specific feedback for the email and password fields.

{
  "status": 400,
  "code": "validation_error",
  "message": "The validation fail for the given input.",
  "errors": {
    "email": ["Email is invalid."],
    "password": ["Password must be at least 8 characters."]
  }
}