Error response format
Every error response from the Mandate API returns JSON with a consistent structure. The exact fields depend on whether the error is a policy block or a general API error.Policy block response
General error response
blockReason field is only present on policy blocks (422) and circuit breaker blocks (403). The declineMessage field is an adversarial counter-message designed to override prompt injection attempts.
HTTP status code reference
| Status | Meaning | SDK Error Class | When It Happens |
|---|---|---|---|
200 | Success | None | Transaction validated successfully, event posted, or status retrieved |
202 | Approval required | ApprovalRequiredError | Transaction passes policy but requires human approval |
400 | Bad request | MandateError | Missing required fields, invalid JSON, or malformed parameters |
401 | Unauthorized | MandateError | Missing Authorization header, invalid runtime key, or expired key |
403 | Circuit breaker active | CircuitBreakerError | Agent’s circuit breaker is tripped. All transactions blocked. |
404 | Not found | MandateError | Intent ID does not exist or belongs to a different agent |
409 | Conflict | MandateError | Duplicate intent hash or attempt to transition an intent in a wrong state |
410 | Gone | MandateError | Approval expired. The 1-hour TTL has elapsed. |
422 | Policy blocked | PolicyBlockedError or RiskBlockedError | Transaction violates a policy rule or is flagged by risk scanning |
429 | Rate limited | MandateError | Too many requests. Back off and retry. |
500 | Server error | MandateError | Transient server issue. Safe to retry with exponential backoff. |
SDK error class hierarchy
Mapping responses to error classes
The SDK automatically maps API responses to the correct error class:- 403 with
circuit_breaker_activemaps toCircuitBreakerError - 422 with
aegis_critical_riskmaps toRiskBlockedError - 422 with any other
blockReasonmaps toPolicyBlockedError - 202 with
requiresApproval: truemaps toApprovalRequiredError - All other non-2xx responses map to
MandateError
Handling errors
Always check specific subclasses before the base class:Next Steps
SDK Error Classes
Detailed reference for each error class with properties and recovery patterns.
Block Reasons
All blockReason values with causes and resolutions.