Skip to main content

Error Handling

DExchange API uses conventional HTTP response codes to indicate the success or failure of API requests. Here’s a comprehensive guide to our error codes and how to handle them.

HTTP Status Codes

Error Response Format

Common Error Scenarios

Authentication Errors

Validation Errors

Transaction Errors

Best Practices for Error Handling

  1. Always Check Response Status
    • Verify HTTP status code before processing response
    • Handle both success and error cases
  2. Implement Retry Logic
    • Retry failed requests with exponential backoff
    • Only retry idempotent operations
    • Respect rate limits
  3. Log Error Details
    • Store error responses for debugging
    • Include transaction IDs in logs
    • Monitor error patterns
  4. User-Friendly Messages
    • Display appropriate error messages to end-users
    • Translate technical errors into user-friendly language
    • Provide clear next steps when possible
  5. Security Considerations
    • Never expose sensitive information in error messages
    • Validate all input data
    • Handle timeouts gracefully

Maintenance Mode

When the API is under maintenance:

Rate Limiting

  • Requests are limited per API key
  • Rate limit headers included in responses
  • Implement proper backoff when limits are reached

Support

If you encounter persistent errors or need assistance: