Skip to main content
The API uses standard HTTP status codes and returns error responses in a consistent JSON format.

Error Response Format

All error responses follow this structure:
{
  "success": false,
  "error": {
    "code": "error_code",
    "message": "Human-readable error message",
    "details": {}
  }
}
The details field is optional and typically only included for validation errors.

Error Codes

401 Unauthorized

Returned when authentication is required but not provided or invalid.
{
  "success": false,
  "error": {
    "code": "unauthenticated",
    "message": "Unauthenticated."
  }
}

403 Forbidden

Returned when the authenticated user doesn’t have sufficient permissions to perform the requested action.
{
  "success": false,
  "error": {
    "code": "access_denied",
    "message": "Access denied."
  }
}
Or when the user lacks required abilities:
{
  "success": false,
  "error": {
    "code": "missing_ability",
    "message": "Insufficient privileges."
  }
}

404 Not Found

Returned when the requested resource doesn’t exist.
{
  "success": false,
  "error": {
    "code": "resource_not_found",
    "message": "Resource not found."
  }
}
Or:
{
  "success": false,
  "error": {
    "code": "not_found",
    "message": "Not found."
  }
}

405 Method Not Allowed

Returned when the HTTP method used is not allowed for the requested endpoint.
{
  "success": false,
  "error": {
    "code": "method_not_allowed",
    "message": "Method not allowed."
  }
}

422 Unprocessable Content

Returned when the request data fails validation.
{
  "success": false,
  "error": {
    "code": "validation_failed",
    "message": "The given data was invalid.",
    "details": {
      "name": [
        "The name field is required."
      ],
      "slug": [
        "The slug has already been taken."
      ]
    }
  }
}

500 Internal Server Error

Returned when an unexpected server error occurs.
{
  "success": false,
  "error": {
    "code": "internal_server_error",
    "message": "Internal server error."
  }
}

Other HTTP Exceptions

For other HTTP exceptions, the API returns:
{
  "success": false,
  "error": {
    "code": "http_exception",
    "message": "An error occurred."
  }
}
The status code will match the HTTP exception status code.