Goal

Configure a retry policy on your account so that every new validation automatically inherits a retry behavior — without needing to pass retry_policy in every request to POST /v1/validate or POST /v1/validate-ocr.

Prerequisites

  • An active API key (veriko_…). If you don't have one, you can generate it in the API Key panel, inside the API page.
  • Know the retry parameters you want: eligible Banxico responses, maximum retry count, and interval.

Steps

1. Read the current policy

curl 'https://api.veriko.mx/v1/users/me/retry-policy' \
  -H 'Authorization: Bearer veriko_••••'

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 (partial updates are not supported):

curl -X PUT 'https://api.veriko.mx/v1/users/me/retry-policy' \
  -H 'Authorization: Bearer veriko_••••' \
  -H 'Content-Type: application/json' \
  -d '{
    "retry_policy": {
      "enabled": true,
      "max_retries": 3,
      "interval_seconds": 600,
      "outcomes": ["not_found", "cep_unavailable"]
    }
  }'

Parameters:

FieldTypeNotes
enabledbooleanRequired. Set false to disable retries globally.
max_retriesintegerNumber of retries.
interval_secondsintegerSeconds between attempts.

outcomes

string[]

Which verdicts trigger a retry. At least one value is required when enabled=true.

The events can be:

  • not_found for transactions not found
  • cep_unavailable for transactions found but without a CEP yet.

Validation is strict — if max_retries or interval_seconds exceeds your plan's limits, the server returns 422 retry_policy_invalid. Check the error details for the allowed ranges.

To disable retries:

curl -X PUT 'https://api.veriko.mx/v1/users/me/retry-policy' \
  -H 'Authorization: Bearer veriko_••••' \
  -H 'Content-Type: application/json' \
  -d '{
    "retry_policy": { "enabled": false }
  }'

3. Use Idempotency-Key to prevent duplicate writes

If your system retries failed PUT requests, use Idempotency-Key to make sure the update is applied only once:

curl -X PUT 'https://api.veriko.mx/v1/users/me/retry-policy' \
  -H 'Authorization: Bearer veriko_••••' \
  -H 'Idempotency-Key: actualizacion-politica-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). That is, no changes are made.

What's next