Skip to content

API Error and Response Model

OpenSESA uses a mix of HTML responses and API-style JSON endpoints.

Response Pattern

  • HTML route responses for most module views.
  • JSON responses for selected API endpoints and async UI interactions.

Error Categories

  • Authentication required (unauthenticated access).
  • Permission denied (insufficient project or role access).
  • Validation errors (invalid payload or form state).
  • Not found (invalid or cross-scope resource references).
  • Server errors (unexpected failures requiring investigation).
{
  "error": {
    "code": "validation_error",
    "message": "One or more fields are invalid.",
    "details": {
      "field_name": ["Reason"]
    }
  }
}

Consistency goal

Keep error code and message patterns consistent across modules to simplify front-end handling and debugging.