Errors & rate limits
Errors are JSON, signed like any other response, and carry a request_id to quote to support.
Error body
{
"error": {
"code": "VALIDATION_ERROR",
"message": "amount must be a string with exactly two decimals, e.g. \"150.00\".",
"request_id": "req_xxxxxxxxxxxxxxxx"
}
}Branch on code, not on message: messages are for humans and may be reworded.
Signature and request errors #
| HTTP | code | Meaning / fix |
|---|---|---|
| 401 | AUTH_MISSING_HEADER | A required X-Aegis-* header is missing. |
| 401 | AUTH_MALFORMED_HEADER | A header has the wrong format or appears twice. |
| 401 | AUTH_TIMESTAMP_OUT_OF_RANGE | Your clock is more than 300 s off. Run NTP. |
| 401 | AUTH_FAILED | Bad signature, unknown or revoked key, or inactive account. Deliberately vague: see debugging. |
| 409 | AUTH_REPLAYED_REQUEST | This nonce was already used. Use a new nonce for every request, including retries. |
| 413 | AUTH_BODY_TOO_LARGE | Body over 64 KiB. |
| 400 | AUTH_IDEMPOTENCY_KEY_REQUIRED | POST without an Idempotency-Key. |
| 400 | INVALID_JSON | The body isn't valid UTF-8 JSON. |
| 403 | HTTPS_REQUIRED | Plain HTTP. Use https://. |
| 429 | RATE_LIMITED | Too many requests. Wait Retry-After seconds. |
Payment errors #
| HTTP | code | Meaning / fix |
|---|---|---|
| 400 | VALIDATION_ERROR | A field is missing, unknown or invalid. The message says which. |
| 404 | PAYMENT_NOT_FOUND | No payment with that ID for your account. |
| 409 | DUPLICATE_MERCHANT_REFERENCE | That merchant_reference was already used. Each order gets one payment. |
| 409 | IDEMPOTENCY_IN_PROGRESS | The first request with this Idempotency-Key is still running. Retry shortly. |
| 422 | IDEMPOTENCY_KEY_REUSED | This Idempotency-Key was used for a different request. |
| 422 | METHOD_NOT_ENABLED | That payment method isn't enabled for your account. |
| 422 | AMOUNT_TOO_SMALL | The amount doesn't cover the fee. |
| 502 | PROVIDER_REJECTED | The bank network refused the payment; it's marked failed. Use a new merchant_reference. |
| 502 / 503 | PROVIDER_UNAVAILABLE | The bank network didn't answer. 503: outcome unknown, retry with the SAME Idempotency-Key. 502: marked failed. |
| 503 | METHOD_UNAVAILABLE | The method is temporarily unavailable. Try later. |
| 500 | INTERNAL_ERROR | Our problem. Retry with the same Idempotency-Key and back off. |
| 503 | SERVICE_UNAVAILABLE | The API is starting up or unavailable. This one is NOT signed: treat the outcome as unknown and retry after Retry-After. |
Retrying safely #
Retry on network errors, timeouts, 409 IDEMPOTENCY_IN_PROGRESS, 429 and 5xx, with the same Idempotency-Key and a new nonce, timestamp and signature. Back off (e.g. 1 s, 2 s, 4 s…). Don't retry other 4xx errors unchanged: fix the request first.
Rate limits #
| What | Limit | Notes |
|---|---|---|
| Signed requests, per merchant | 600 per 10 s | About 60 per second, with bursts. Need more for a big sale? Ask us in advance. |
| Failed signatures, per IP | 20 per minute | While exceeded, ALL requests from that IP get 429 for up to a minute. Fix the signing bug first. |
| GET /v1/platform-keys, per IP | 120 per minute | Cache the keys. |
A limited request gets 429 RATE_LIMITED with a Retry-After header (seconds), still signed.