Error Response Format
All error responses from the GaiterGuard API follow a consistent JSON structure:Content-Type header is always set to application/json for error responses.
Common HTTP Status Codes
Error Types
Authentication Errors
Returned when authentication fails or credentials are invalid. Missing Authorization HeaderValidation Errors
Returned when request data fails schema validation. Invalid JSONValidation errors include the field path and specific validation message in the format:
field.path: Error messageProxy Errors
Errors that occur during request proxying to target services. SSRF Prevention - Hostname MismatchIdempotency Errors
Errors related to idempotency key processing. Duplicate Request ProcessingRisk Assessment Errors
Returned when a request is flagged as risky and requires human approval. Approval Required428 Precondition Required
Use the
action_id to poll for approval status at the provided status_url endpoint, then execute the request using POST /proxy/execute/:actionId once approved.Approval Queue Errors
Action Not FoundError Handling Best Practices
Retry Logic
- 401 Unauthorized: Do not retry. Check your authentication credentials.
- 403 Forbidden: Do not retry. Request is blocked by security policy.
- 409 Conflict: Wait and poll for idempotency key completion, then use cached response.
- 428 Precondition Required: Poll for approval status, then execute with
/proxy/execute/:actionId. - 429 Rate Limited: Implement exponential backoff (not currently returned but reserved).
- 500/502/504: Retry with exponential backoff up to 3 attempts.
Handling Idempotency Conflicts
When you receive a 409 error:- The original request is still processing
- Wait 1-2 seconds
- Retry the request with the same idempotency key
- The gateway will return the cached response once available
Handling Approval Required (428)
When you receive a 428 error:- Extract the
action_idfrom the response - Poll
GET /status/:actionIduntil status isAPPROVED - Execute the approved request with
POST /proxy/execute/:actionId - If status becomes
EXPIRED, resubmit the original request viaPOST /proxy
Error Response Headers
All error responses include:Implementation Details
Error responses are generated using theerrorResponse() utility function from utils/responses.ts:26: