Errors
Errors use RFC 7807 application/problem+json with an extra machine-readable code:
{ "status": 403, "title": "This API key lacks the required 'purchase' scope.", "code": "api_key.insufficient_scope"}Always branch on code, not on the human-readable title.
Common codes
Section titled “Common codes”| HTTP | code |
Meaning |
|---|---|---|
| 400 | order.invalid |
Invalid order/automation parameters (volume, duration, address) |
| 400 | validation_failed |
Request failed validation; per-field messages are in errors |
| 401 | unauthorized |
Missing, invalid or revoked key (WWW-Authenticate: ApiKey …) |
| 402 | wallet.insufficient_balance |
Not enough TRX on balance |
| 403 | api_key.insufficient_scope |
Key’s scope is below what the endpoint requires |
| 403 | api_key.spend_limit_exceeded |
Would exceed the key’s daily spend limit |
| 429 | rate_limited |
Too many requests |
| 502 | provider.upstream_error |
Energy provider temporarily unavailable (any charge is refunded) |
Validation errors (bad request bodies) carry code: "validation_failed" and an errors object keyed by field:
{ "status": 400, "title": "One or more validation errors occurred.", "code": "validation_failed", "errors": { "volume": ["The value 'abc' is not valid."] }}Business errors carry a domain code and a human-readable title/detail instead of errors.