Skip to main content

Error Handling

Overview

DEXCHANGE-API uses conventional HTTP response codes to indicate the success or failure of API requests. In general:
  • Codes in the 2xx range indicate success
  • Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted)
  • Codes in the 5xx range indicate an error with our servers

Error Response Format

All error responses follow this format:

HTTP Status Codes

Common Error Codes

Authentication Errors

Transaction Errors

Validation Errors

Service Errors

Best Practices

  1. Always check the response status
    • Verify both HTTP status code and response body
  2. Implement proper error handling
    • Handle both expected and unexpected errors
    • Log errors for debugging
  3. Retry mechanism
    • Implement exponential backoff for 5xx errors
    • Don’t retry on 4xx errors (except 429)
  4. Rate limiting
    • Monitor rate limit headers
    • Implement rate limit handling

Example Error Handling

Support

If you encounter any errors that you can’t resolve, please contact our support team: