Skip to content

Error Handling

All error responses follow a consistent format:

json
{
  "error": "Human-readable error message",
  "details": "Optional additional context"
}

HTTP Status Codes

CodeMeaningWhen
200SuccessRequest completed successfully
400Bad RequestInvalid request body, missing fields, malformed data
401UnauthorizedMissing or invalid X-API-Key header
404Not FoundNo pools for the pair, or quote ID not found
410GoneQuote expired (30s TTL)
429Too Many RequestsRate limit exceeded — check Retry-After header
500Internal Server ErrorServer-side failure (swap build failed, etc.)
502Bad GatewayJito submission failed
503Service UnavailableBlockhash not available (server just started)

Rate Limit Errors

json
{
  "error": "Rate limit exceeded",
  "limit": 60,
  "windowMs": 60000,
  "retryAfterSeconds": 12
}

The Retry-After HTTP header is also set.

Validation Errors

json
{
  "error": "Invalid request",
  "details": "Invalid type: Expected string but received undefined (path: inputMint)"
}

Handling Tips

  • Always check the HTTP status code first
  • Parse the error field for user-facing messages
  • Use details for debugging (not user-facing)
  • On 429, respect Retry-After — don't retry immediately
  • On 503, retry after 2-3 seconds (server is warming up)
  • On 502, the transaction may or may not have been sent — check the signature on-chain before retrying