Response Envelope
All API responses are wrapped in a standardized envelope for consistent error handling and observability. This allows clients to handle responses uniformly across all endpoints.Envelope Structure
Operation result:
success or failureMachine-readable error code when
status is failure. One of:VALIDATION_ERROR- Invalid request parametersPOLICY_VIOLATION- Policy denied the operationPIPELINE_ERROR- Internal processing failureCONFIRMATION_FAILED- Transaction confirmation failednull- No error (success)
Pipeline stage where failure occurred:
validation- Request validationpolicy- Policy evaluationbuild- Transaction buildingsign- Signing operationsend- Network submissionconfirm- Confirmation timeout/failuregateway- Gateway-level errornull- No failure
Current or final pipeline stage:
validationpolicybuildsignsendconfirmcompletedgateway
Unique request identifier (UUID) for debugging and audit correlation
The actual response payload (present on success)
Human-readable error message (present on failure)
Alternative error message field (some endpoints)
Success Response Example
Error Response Example
Transaction-Specific Behavior
Transaction endpoints may return HTTP 200 with
status: "failure" when the transaction itself fails after being created.Client Handling
TypeScript Example
Python Example
Error Code Reference
- VALIDATION_ERROR
- POLICY_VIOLATION
- PIPELINE_ERROR
- CONFIRMATION_FAILED
When: Invalid request parameters, missing required fields, malformed dataHTTP Status: 400 Bad Request (usually)Example Scenarios:
- Invalid UUID format
- Missing required fields
- Out of range values
- Schema validation failures
- Invalid API key
- Missing authentication headers
Stage Progression
Transaction processing follows these stages: Thestage field reflects the current or final stage in this progression.
Trace ID Usage
ThetraceId field is essential for debugging:
- Log Correlation - Search logs for specific request traces
- Support Tickets - Include trace ID when reporting issues
- Audit Trails - Link audit events to originating requests
- Distributed Tracing - Track requests across services
Best Practices
Always parse the response envelope before accessing
dataCheck
status === 'success' before proceeding with business logicLog
traceId for all errors to facilitate debuggingHandle
errorCode types differently based on retry eligibilityFor transactions, poll the status endpoint until
stage reaches confirmed or failed