The SmartRetry API uses standard HTTP status codes and returns a consistent error body on every failure. Parse theDocumentation Index
Fetch the complete documentation index at: https://www.smartretry.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
reason_code field for programmatic error handling - it identifies the specific failure cause regardless of which endpoint you called.
Error response structure
All error responses share this shape:A URI reference that identifies the error type. Points to documentation for the specific problem category.
A short, human-readable summary of the error. Does not change between occurrences of the same error type.
The HTTP status code for this response (e.g.,
400, 401, 404).A detailed description of what went wrong in this specific request. Use this field for debugging and logging.
A URI that identifies this specific occurrence of the error. Include this in support requests when available.
A machine-readable code identifying the failure cause. Use this for programmatic error handling and branching logic.
Additional structured data about the error, such as which field failed validation or the conflicting transaction ID. Contents vary by error type.
HTTP status codes
| Status | Name | When it occurs |
|---|---|---|
200 | OK | Request succeeded. For payment responses, also check the accepted field - a 200 with "accepted": false means the transaction was declined. |
400 | Bad Request | The request body or parameters failed validation. A required field is missing, a value is the wrong type, or a parameter is out of range. |
401 | Unauthorized | The x-api-key header is missing or the key is invalid. |
403 | Forbidden | The API key is valid but does not have access to the requested terminal. |
404 | Not Found | The transaction, recurring plan, or terminal ID does not exist. |
409 | Conflict | The request conflicts with existing state. For idempotency, this happens when the same Idempotency-Key is reused with a different request body. |
422 | Unprocessable Entity | The request is structurally valid but was rejected by business logic - for example, attempting to capture an already-captured pre-auth. |
429 | Too Many Requests | Your integration has exceeded the rate limit. Back off and retry after the period indicated in the Retry-After response header. |
503 | Service Unavailable | The API could not complete the request right now. For idempotency, this can happen when another request with the same key is still in flight and the replay wait timed out. |
500 | Internal Server Error | An unexpected error occurred on the SmartRetry side. If this persists, check status.smartretry.com and contact support. |
Reason codes
| Reason code | Status | Description |
|---|---|---|
INVALID_API_KEY | 401 | The x-api-key header is missing, malformed, or the key has been revoked. |
TERMINAL_NOT_FOUND | 403 / 404 | The terminal_friendly_id in the path does not match any terminal your key can access. |
TRANSACTION_NOT_FOUND | 404 | No transaction with the given ID exists on this terminal. |
INVALID_IDEMPOTENCY_KEY | 400 | The Idempotency-Key header is malformed, too long, or contains unsupported characters. |
IDEMPOTENCY_CONFLICT | 409 | The Idempotency-Key value was reused with a different request body. Reuse the same key only for an exact retry of the original POST request. |
RESOURCE_LOCKED | 503 | Another request using the same Idempotency-Key is still in flight and SmartRetry could not obtain the cached result before the wait timeout. |
INVALID_AMOUNT | 400 | The amount value is missing, zero, negative, or not a valid number in major currency units. |
INVALID_CURRENCY | 400 | The currency value is not a supported ISO 4217 currency code. |
INVALID_CARD_NUMBER | 400 | The card number failed the Luhn check or is not a recognised card format. |
INVALID_EXPIRY | 400 | The card expiry date is missing, in the wrong format, or in the past. |
MISSING_REQUIRED_FIELD | 400 | A field required by this endpoint was not included in the request body. The context object identifies the missing field. |
RATE_LIMIT_EXCEEDED | 429 | Too many requests in a short window. Honour the Retry-After header before retrying. |
RECURRING_NOT_FOUND | 404 | No recurring plan with the given terminal and reference exists. |
Example error responses
Handling errors in production
Always branch on
reason_code, not on detail or title. The human-readable fields may change; reason_code values are stable across API versions.500 Internal Server Error- retry with exponential backoff. Check status.smartretry.com if errors persist beyond a few minutes.429 Too Many Requests- wait for the number of seconds in theRetry-Afterresponse header before retrying. Do not retry immediately.503 Service Unavailable- if the reason code isRESOURCE_LOCKED, retry the same POST request shortly with the sameIdempotency-Key.
400 Bad Request- fix the request before retrying. Check thecontext.fieldvalue to identify which field is invalid.401 Unauthorized- verify your API key is correct and present in thex-api-keyheader.403 Forbidden- the key is valid but not authorized for this terminal. Check you are using the rightterminal_friendly_id.409 Conflict- if the reason code isIDEMPOTENCY_CONFLICT, do not retry with the same key and a different body. Generate a newIdempotency-Keyfor a new operation.
200 OK with "accepted": false in the response body - this is not an error response. Do not confuse payment declines with API errors. Log the transaction status and handle the decline according to your retry strategy.