Goal
Configure a default retry policy at the account level so that every new validation automatically inherits a consistent retry behavior — without you needing to pass retry_policy in every POST /v1/validate or POST /v1/validate-ocr request body.
Prerequisites
- An active API key (
mxcep_…). No additional permission is required — any authenticated user can read and update their own retry policy. - Know the retry parameters you want: eligible outcomes, max retry count, and interval.
Steps
1. Read the current policy
curl 'https://api.example.com/v1/users/me/retry-policy' \
-H 'Authorization: Bearer mxcep_••••'If no policy has been saved yet, the response returns a synthetic zero-state:
{
"data": {
"type": "retry_policy",
"attributes": {
"enabled": false,
"max_retries": 0,
"interval_seconds": 0,
"outcomes": []
}
}
}If a policy is already configured:
{
"data": {
"type": "retry_policy",
"attributes": {
"enabled": true,
"max_retries": 3,
"interval_seconds": 600,
"outcomes": ["not_found", "cep_unavailable"]
}
}
}2. Update the policy
Send the full policy body (no partial updates):
curl -X PUT 'https://api.example.com/v1/users/me/retry-policy' \
-H 'Authorization: Bearer mxcep_••••' \
-H 'Content-Type: application/json' \
-d '{
"retry_policy": {
"enabled": true,
"max_retries": 3,
"interval_seconds": 600,
"outcomes": ["not_found", "cep_unavailable"]
}
}'Parameters:
| Field | Type | Notes |
|---|---|---|
enabled | boolean | Required. Set false to disable retries globally. |
max_retries | integer | Number of retry attempts. Must be within your plan's cap. |
interval_seconds | integer | Seconds between attempts. Must be within the plan-allowed range. |
outcomes | string[] | Which verdicts trigger a retry. At least one value required when enabled=true. |
Validation is strict — if max_retries or interval_seconds exceeds your plan's caps, the server returns 422 retry_policy_invalid. Check the error details for the allowed ranges.
To disable retries:
curl -X PUT 'https://api.example.com/v1/users/me/retry-policy' \
-H 'Authorization: Bearer mxcep_••••' \
-H 'Content-Type: application/json' \
-d '{
"retry_policy": { "enabled": false }
}'3. Use Idempotency-Key to prevent duplicate writes
If your deployment retries failed PUT requests, use Idempotency-Key to ensure the policy update is applied only once:
curl -X PUT 'https://api.example.com/v1/users/me/retry-policy' \
-H 'Authorization: Bearer mxcep_••••' \
-H 'Idempotency-Key: policy-update-2025-03-15-v1' \
-H 'Content-Type: application/json' \
-d '{ "retry_policy": { "enabled": true, "max_retries": 3, "interval_seconds": 600, "outcomes": ["not_found"] } }'The response includes Idempotent-Replayed: true when the same key returns a cached response (TTL 24h).
What's next
- Manage retry state on individual validation records: see Browse and manage validations.
- Validate a SPEI transfer and have retries applied automatically: see Validate a SPEI transfer (direct).