Error Handling

All API errors follow a consistent format. Use the error code for programmatic handling and the message for debugging.

Error Format

Every error response contains an error object with a machine-readable code, a human-readable message, and an optional details object with field-level information.

422Validation error example
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters",
    "details": {
      "amount": "Must be at least 32000"
    }
  }
}

Error Codes

CodeHTTPDescription
UNAUTHORIZED401Missing or invalid API key / JWT
FORBIDDEN403Key lacks the required permission
NOT_FOUND404Resource does not exist
DUPLICATE_REQUEST409Idempotency key already used with different parameters
VALIDATION_ERROR422Request body failed validation
INSUFFICIENT_BALANCE422Account balance too low for the operation
BELOW_MINIMUM_ORDER422Order amount is below provider minimum
INVALID_ADDRESS422TRON address failed validation
PRICE_EXCEEDED422Current price exceeds the specified max price
RATE_LIMITED429Too many requests, check Retry-After header
PROVIDER_UNAVAILABLE503No providers can fulfill the request
MAINTENANCE503Platform is undergoing maintenance
INTERNAL_ERROR500Unexpected server error

Retry Strategy

Not all errors should be retried. Use the HTTP status and error code to decide how to handle each case.

Idempotency

The POST /orders and POST /withdraw endpoints support the Idempotency-Key header. Sending the same key with identical parameters returns the original response without creating a duplicate.

409Duplicate request with different parameters
{
  "error": {
    "code": "DUPLICATE_REQUEST",
    "message": "Idempotency key already used with different parameters"
  }
}
IDEMPOTENCY KEYS

Use a UUID v4 or a deterministic hash of the request parameters. Keys are valid for 24 hours. Always include an idempotency key on order and withdrawal requests to prevent accidental duplicates.