Skip to Content

Errors

All AEGIS API errors return a consistent JSON structure.

Error Response Format

{ "detail": "Human-readable error description" }

For validation errors (422), FastAPI returns a more detailed format:

{ "detail": [ { "loc": ["body", "field_name"], "msg": "field required", "type": "value_error.missing" } ] }

HTTP Status Codes

CodeMeaningWhen It Occurs
200OKSuccessful request
201CreatedResource successfully created
204No ContentSuccessful deletion
400Bad RequestMalformed request body or invalid parameters
401UnauthorizedMissing or invalid JWT token
403ForbiddenValid token but insufficient permissions
404Not FoundResource does not exist
409ConflictDuplicate resource or state conflict
422Unprocessable EntityRequest body fails validation (Pydantic)
429Too Many RequestsRate limit exceeded (100 req/min)
500Internal Server ErrorUnexpected server failure
502Bad GatewayUpstream service unreachable (via API gateway)
503Service UnavailableService is starting up or unhealthy

Common Error Scenarios

Authentication Errors

# Missing token curl http://localhost:8000/compliance/summary # → 401 {"detail": "Authorization header required"} # Expired token curl -H "Authorization: Bearer expired_token" http://localhost:8000/compliance/summary # → 401 {"detail": "Token has expired"}

Validation Errors

# Missing required field curl -X POST http://localhost:8000/execute \ -H "Content-Type: application/json" \ -d '{}' # → 422 {"detail": [{"loc": ["body", "agent_type"], "msg": "field required", ...}]}

Rate Limiting

# Too many requests # → 429 {"detail": "Rate limit exceeded. Try again in 60 seconds."}

When you receive a 429 response, check the X-RateLimit-Reset header for the timestamp when you can retry.

Resource Not Found

# Non-existent resource curl http://localhost:8000/conversations/nonexistent-id/messages # → 404 {"detail": "Conversation not found"}

Retry Strategy

Status CodeRetry?Strategy
429YesWait until X-RateLimit-Reset, then retry
500YesExponential backoff (1s, 2s, 4s), max 3 retries
502/503YesWait 5s, retry up to 3 times (service may be starting)
400/401/403/404/422NoFix the request — these are client errors
Last updated on