https://api.veriko.mx/v1/validate-ocrValidate a SPEI transfer (OCR)
How-to guide →Validates a SPEI transfer from its receipt (image or PDF) and obtains its CEP with optical character recognition (OCR) and Banxico.
The final verdict can be:
valid: CEP found and validated.not_found: CEP not found.cep_unavailable: CEP unavailable.returned: Settled and returned.error: Internal error.
With ?async=1 it responds with an HTTP status 202; the verdict is collected from GET /v1/validations/{id}.
The accounting is in quotas and plans.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
async | query | string | optional | When Default: |
Idempotency-Key | header | string | optional | Optional client-generated key (Stripe-style) that guarantees the request is processed exactly once within a 24-hour TTL. The scope is 11111111-2222-3333-4444-555555555555 |
No matches
| Parameter | Type | Required | Description |
|---|---|---|---|
image | string (byte) | Required unless image_url is sent | Receipt encoded in base64, as an image or a PDF. If iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg== |
image_url | string (uri) | Required unless image is sent | Public HTTPS URL of the receipt. It follows the same format and size limits as https://storage.example.com/receipts/comprobante-2025-03.jpg |
beneficiary_account | string (pattern) | optional | Receiving account for the transfer. Accepts a CLABE (18 digits), a card (16 digits), or a DiMo phone (10 digits). It cannot be sent together with 012180004412345678 |
candidate_accounts | array<string> (items: 2–10, unique items) | optional | Accounts among which the receiving one is, when it is not known. It
replaces ["012180004412345678","002010077777777771"] |
sender_bank | string | optional | SPEI name or code of the sending bank, to correct the one read from the receipt. It accepts a code of 4 or 5 digits, e.g. 40012 |
receiver_bank | string | optional | SPEI name or code of the receiving bank, to correct the one read from the receipt. It accepts a code of 4 or 5 digits, e.g. 40002 |
recipient_is_bank | boolean | optional |
Default: false |
retry_policy | object | optional | Automatic retry policy for this validation. If omitted, the policy configured at |
enabled | boolean | optional |
true |
max_retries | integer (≥ 1) | optional | Maximum number of automatic retries. Once reached, the cycle enters the 3 |
interval_seconds | integer (≥ 300, ≤ 86400) | optional | Seconds to wait between each retry (300–86400, i.e., 5 minutes to 24 hours). e.g.600 |
outcomes | array<string> (items: 1–?, unique items) | optional | Outcomes that trigger a retry. By default, they are ["not_found","cep_unavailable","error"] |
client_ref | string (pattern, 1–64) | optional | Reference of your own that is returned as sent in the validation, in its webhooks, and as an exact filter of orden-4812 |
retain_image | boolean | optional |
Default: false |
curl -X POST 'https://api.veriko.mx/v1/validate-ocr' \
-H 'Authorization: Bearer veriko_••••' \
-H 'Content-Type: application/json' \
-d '{
"image": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}'Python example — coming soon.
JavaScript example — coming soon.
PHP example — coming soon.
Retry policy
POST /v1/validate-ocr
Validation retry policy: activation, limit, interval, and eligible outcomes.
- Attempts
- —
- Interval
- 5 min – 1 h × 24
- Eligible outcomes
not_found,cep_unavailable,error
This operation accepts an optional retry policy.
No matches
| Field | Type | Description |
|---|---|---|
type* | string | JSON:API resource type. Always validation |
id* | string (uuid) | Unique identifier of the validation (UUID v4). e.g.3fa85f64-5717-4562-b3fc-2c963f66afa6 |
attributes* | object | Canonical validation data. |
validation_type | string | Validation mode — direct |
origin | ValidationOrigin | null | Where the validation came from. |
is_playground | boolean |
false |
status | string | Lifecycle state — valid |
banxico_status | string | nullnullable | Verdict reported by Banxico. Values: valid |
processing_time_ms | integer | nullnullable | Milliseconds spent processing the validation. e.g.1320 |
request_data | object | Copy of the original request fields. |
send_date | string (date) | Transfer send date ( |
amount | number | Transfer amount in MXN. |
tracking_key | string | Identifier assigned by the sending bank (tracking key). |
numeric_reference | string | Numeric series of up to 7 digits identifying the transfer. It is not unique and may repeat. |
sender_bank | string | Sending bank: name or SPEI code in direct validation, SPEI code read from the receipt in OCR validation. |
receiver_bank | string | Receiving bank: name or SPEI code in direct validation, SPEI code read from the receipt in OCR validation. |
beneficiary_account | string | Receiving account (CLABE, card, or mobile/DiMo). |
candidate_accounts | array | Candidate accounts to try, in order, when the receipt account is masked. |
recipient_is_bank | boolean |
|
client_ref | string | Reference of your own sent in the request ( orden-4812 |
created_at | string (date-time) | Validation creation timestamp in ISO 8601 UTC. e.g.2025-03-15T14:22:10Z |
completed_at | string | nullnullable | Date and time of completion, in ISO 8601 UTC. 2025-03-15T14:22:11Z |
enqueued_at | string | nullnullable | Queue-entry timestamp in ISO 8601 UTC. e.g.2026-04-30T10:15:00Z |
processing_started_at | string | nullnullable | Processing start timestamp in ISO 8601 UTC. e.g.2026-04-30T10:15:00Z |
expires_at | string | nullnullable | Expiration timestamp for queued validations in ISO 8601 UTC. After this, the validation moves to 2026-04-30T10:15:00Z |
etag_version | integer | nullnullable | Incremental version used with 1 |
image_path | string | nullnullable | Relative reference to the receipt, image or PDF, only when comprobantes/3fa85f64-5717-4562-b3fc-2c963f66afa6.jpg |
image_retained | boolean |
true |
purged_at | string (date-time) | Date and time, in ISO 8601 UTC, when the validation was
purged. It only appears on a purged validation, which is left
as a tombstone: it keeps the verdict, dates, and
2026-10-02T09:30:00Z |
ocr_result | object | nullnullable | Fields extracted from the receipt, only when |
receipt_type | string | Receipt type ( |
tracking_key | string | Identifier assigned by the sending bank (tracking key). |
numeric_reference | string | Numeric series of up to 7 digits identifying the transfer. It is not unique and may repeat. |
send_date | string (date) | Transfer send date ( |
time | string | Transfer time ( |
amount | number | Transfer amount in MXN. |
sender_bank | string | Sending bank: name or SPEI code in direct validation, SPEI code read from the receipt in OCR validation. |
receiver_bank | string | Receiving bank: name or SPEI code in direct validation, SPEI code read from the receipt in OCR validation. |
sender_name | string | Sender name. |
beneficiary_name | string | Beneficiary name. |
beneficiary_account | string | Receiving account (CLABE, card, or mobile/DiMo). |
beneficiary_account_is_partial | boolean |
|
beneficiary_account_is_masked | boolean |
|
beneficiary_account_visible_first | string | First visible digits of the masked receiving account. |
beneficiary_account_visible_last | string | Last visible digits of the masked receiving account. |
beneficiary_account_total_length_hint | integer | Estimated total length of the receiving account. |
sender_account | string | Sending account (CLABE, card, or mobile/DiMo). |
sender_account_is_partial | boolean |
|
sender_account_is_masked | boolean |
|
sender_account_visible_first | string | First visible digits of the masked sending account. |
sender_account_visible_last | string | Last visible digits of the masked sending account. |
sender_account_total_length_hint | integer | Estimated total length of the sending account. |
payment_concept | string | Payment concept. |
other_accounts_detected | array | Other accounts detected in the receipt. |
receipts_detected | integer | Number of receipts found in the PDF. |
confidence | number | Extraction or normalization confidence score (0–1). |
confidence_by_field | object | Confidence score (0–1) per extracted field. |
sender_bank | number | Confidence score (0–1) for extracting |
receiver_bank | number | Confidence score (0–1) for extracting |
beneficiary_account | number | Confidence score (0–1) for extracting |
sender_account | number | Confidence score (0–1) for extracting |
amount | number | Confidence score (0–1) for extracting |
tracking_key | number | Confidence score (0–1) for extracting |
send_date | number | Confidence score (0–1) for extracting |
ocr_confidence | number | nullnullable | OCR score from 0 to 1, only when 0.94 |
normalized_data | object | nullnullable | Fields normalized after OCR extraction, or the winning account in |
receipt_type | string | Receipt type ( |
tracking_key | string | Identifier assigned by the sending bank (tracking key). |
numeric_reference | string | Numeric series of up to 7 digits identifying the transfer. It is not unique and may repeat. |
send_date | string (date) | Transfer send date ( |
time | string | Transfer time ( |
amount | number | Transfer amount in MXN. |
sender_bank_code | string | SPEI code of the sending bank. |
sender_bank_name | string | Name of the sending bank. |
receiver_bank_code | string | SPEI code of the receiving bank. |
receiver_bank_name | string | Name of the receiving bank. |
beneficiary_account | string | Receiving account (CLABE, card, or mobile/DiMo). |
beneficiary_account_type | string | Receiving account type ( |
beneficiary_account_is_masked | boolean |
|
sender_account | string | Sending account (CLABE, card, or mobile/DiMo). |
sender_account_is_masked | boolean |
|
sender_account_visible_first | string | First visible digits of the masked sending account. |
sender_account_visible_last | string | Last visible digits of the masked sending account. |
sender_name | string | Sender name. |
beneficiary_name | string | Beneficiary name. |
payment_concept | string | Payment concept. |
confidence | number | Extraction or normalization confidence score (0–1). |
normalization_warnings | array | nullnullable | Normalization warnings present. They can explain an unexpected |
duplicate_of | object | Earlier validation that confirmed this transfer in the
same account, never another account. It appears only with a
|
id* | string (uuid) | Identifier of the earlier validation. e.g.3fa85f64-5717-4562-b3fc-2c963f66afa6 |
created_at* | string (date-time) | Creation date and time of the earlier validation, in ISO 8601 UTC. e.g.2026-10-01T15:04:05Z |
account_conflict | object | Conflict between the sent account and the image account. It
only appears on |
sent_last4* | string | Last 4 digits of the account sent in 5678 |
read_last4* | string | Last 4 digits of the account shown in the image (the visible ones, 3 or 4, if it is masked). e.g.9012 |
truncated_fields | array | Fields the receipt shows cut off with an ellipsis. It only
appears on |
candidate_match | object | Which of the |
index* | integer | Position (from 0) of the winning account in the 1 |
account_last4* | string | Last 4 digits of the winning account. e.g.7771 |
account_cross_checked | boolean |
true |
is_masked | boolean | nullnullable | Whether the beneficiary account is masked in the receipt, be it a CLABE, a card or a phone number. It is included only when it is |
banxico_result | object | nullnullable | Data returned by Banxico, with |
operationDate | string | SPEI business day that Banxico assigned to the operation, as reported by the CEP ( 2025-03-15 |
processingTime | string | Operation time as reported by the CEP ( 14:22:10 |
speiKey | string | Operation key within the SPEI system (the CEP's |
trackingKey | string | SPEI tracking key of the operation — the same one sent in the validation request. e.g.MBAN01002503151422ABCDEF |
digitalSignature | string | Digital seal of the CEP ( |
certificateNumber | string | Serial number of the digital certificate Banxico used to seal the CEP. |
cadenaCda | string | Original data string of the operation ( |
senderBank | string | Sending bank of the operation, as identified by the CEP. e.g.BBVA |
senderName | string | Name of the operation's sender, as reported by the CEP. |
senderAccountType | string | Sender's account type (e.g. CLABE or card), as reported by the CEP. |
senderAccount | string | Sender's account number, as reported by the CEP — unmasked in this resource (a private lookup, owned by the validation's account). |
senderRfc | string | Sender's RFC (Mexican tax ID), as reported by the CEP. |
receiverBank | string | Receiving bank of the operation, as identified by the CEP. e.g.STP |
beneficiaryName | string | Name of the operation's beneficiary, as reported by the CEP. |
beneficiaryAccountType | string | Beneficiary's account type (e.g. CLABE or card), as reported by the CEP. |
beneficiaryAccount | string | Beneficiary's account number, as reported by the CEP. Unmasked in this resource (a private lookup, owned by the validation's account). Outgoing webhooks DO mask it to the last 4 digits in |
beneficiaryRfc | string | Beneficiary's RFC (Mexican tax ID), as reported by the CEP. |
amount | number (float) | Operation amount Banxico confirmed via the CEP, in pesos. e.g.1500 |
iva | number (float) | VAT (IVA) of the operation reported by the CEP, in pesos. |
paymentConcept | string | Payment concept of the operation, as reported by the CEP. |
error_message | string | nullnullable | Human-readable error message when terminal. e.g.Banxico no respondió tras tres intentos. |
error_code | ValidationErrorCode | null | Stable code of the terminal error, when there is one. After
|
batch_id | integer | nullnullable | Bulk import job identifier, when applicable. e.g.318 |
batch_position | integer | nullnullable | Position within the job, starting at 1. e.g.12 |
retry_state | object | Full retry cycle state. Always present; if retries are not active, |
enabled | boolean |
true |
max_retries | integer | nullnullable | Configured maximum number of retries; 3 |
interval_seconds | integer | nullnullable | Interval between retries in seconds, from 600 |
outcomes | array | nullnullable | Outcomes that trigger a retry: ["not_found","cep_unavailable","error"] |
attempts_completed | integer | Number of retries completed so far. e.g.1 |
next_attempt_at | TimestampUTC | null | Date of the next retry; |
resolved_at | TimestampUTC | null | Date when a retry produced |
exhausted_at | TimestampUTC | null | Date when attempts were exhausted; |
cancelled_at | TimestampUTC | null | Cycle cancellation date; |
terminal_state | string | nullnullable | Cycle state: pending |
links | object | Related links (JSON:API |
self | string | Canonical link to the validation details. e.g./v1/validations/3fa85f64-5717-4562-b3fc-2c963f66afa6 |
cep_xml | string | nullnullable | URL of the CEP in XML format. It only appears when /v1/validations/a1b2c3d4-e5f6-4890-abcd-ef0123456789/cep?format=xml |
cep_pdf | string | nullnullable | URL of the CEP in PDF format. It only appears when /v1/validations/a1b2c3d4-e5f6-4890-abcd-ef0123456789/cep?format=pdf |
| Status | Class | Description | Body |
|---|---|---|---|
| 200 | 2xx | Resolved validation with the data extracted from the receipt and its verdict. | Validation |
| 202 | 2xx | Validation enqueued. Poll GET /v1/validations/{id} until one of the terminal statuses (valid, not_found, cep_unavailable, invalid, returned, failed, error). meta.next_poll_after_seconds hints the recommended first-poll interval. Without ?async=1, this response arrives when the Banxico query takes longer than 45 seconds, with meta.async_reason set to sync_deadline.
| ValidationQueued |
| 400 | 4xx | The Idempotency-Key header value does not meet the allowed format (alphanumeric + _ + -, 1–255 characters).
| ErrorResponse |
| 401 | 4xx | Authentication is required or the provided credentials are invalid. | ErrorResponse |
| 409 | 4xx | A request with the same Idempotency-Key is still being processed. The client must retry after the number of seconds indicated by the Retry-After header.
| ErrorResponse |
| 413 | 4xx | The request body exceeds the maximum accepted size ( body_too_large). | ErrorResponse |
| 422 | 4xx | The image or request data is invalid. It responds with an HTTP status 422 (with code in the body). Codes for this operation: account_and_candidates_mutually_exclusive, candidate_accounts_invalid, alias_conflict, invalid_retain_image; the rest are in {% concept slug="errors-taxonomy" %}the error taxonomy{% /concept %}. | ErrorResponse |
| 429 | 4xx | Rate limit exceeded ( rate_limit_exceeded: wait a few seconds) or plan quota used up (quota_exceeded: wait for the next period or change plans). | ErrorResponse |
| 503 | 5xx | OCR is unavailable, with no provider configured or temporarily paused ( ocr_not_configured), the Banxico request could not be completed (banxico_rate_limit_exhausted), or the asynchronous validation could not be started (dispatch_failed). | ErrorResponse |
| Header | Type | Description |
|---|---|---|
Deprecation | string | Date when this operation was marked as deprecated (11 November 2026, RFC 8594). Spanish field names stop being accepted on 1 March 2027 (see the Sunset header). |
Idempotent-Replayed | string | Present only when the client sent Idempotency-Key. false for fresh responses; true when replayed from cache. |
Link | string | Migration guide to English field names. |
Sunset | string | Date when Spanish field names stop being accepted (1 March 2027). |
X-Quota-Included | integer | Validations included in the plan for the current cycle. With overage enabled it is lower than X-Quota-Limit (the cap); without overage, equal. Also in the body, under meta.quota. |
X-Quota-Limit | integer | Monthly validation cap of the account plan. Emitted when quota is enabled. |
X-Quota-Remaining | integer | Validations remaining in the current cycle. |
X-Quota-Reset | string (date-time) | End of the current cycle in ISO 8601 UTC, when the quota renews. |
X-Quota-Used | integer | Validations consumed in the current cycle. |
| Status | Code | Example |
|---|---|---|
| 400 | body_empty | The request has no body. Envelope
|
| 400 | invalid_idempotency_key | The idempotency key format is not valid. Envelope
|
| 400 | invalid_json | The request body is not valid JSON. Check its syntax and resend it. Envelope
|
| 400 | url_dns_failed | We could not find the server for the URL. Check that the address is spelled correctly. Envelope
|
| 400 | url_ssrf_blocked | The URL does not point to a public server. Use a public HTTPS URL. Envelope
|
| 401 | unauthorized | This request requires authentication. Envelope
|
| 409 | idempotency_key_in_progress | A request with this Idempotency-Key is still being processed. Envelope
Response headers
|
| 413 | body_too_large | The body exceeds the 1 MB maximum. Envelope
|
| 422 | account_ambiguous | The visible digits of the account match too many accounts. Envelope
|
| 422 | account_ambiguous_in_whitelist | Several saved beneficiaries end the same way, so we cannot tell which one got the payment. Envelope
|
| 422 | account_and_candidates_mutually_exclusive | The beneficiary account and the candidate accounts cannot be sent together. Envelope
|
| 422 | account_unresolvable | We could not identify the account that received the payment from the image. Envelope
|
| 422 | bank_code_unresolvable_for_phone | The bank for this phone number could not be determined. Envelope
|
| 422 | candidate_accounts_invalid | This candidate account is repeated. Envelope
|
| 422 | image_decompression_bomb | We can't process the image in ''image''. Send a new screenshot. Envelope
|
| 422 | image_dimensions_too_large | ''image'' exceeds 12000 px per side. Envelope
|
| 422 | image_invalid | The image is not valid. Send JPEG, PNG, WebP or PDF. Envelope
|
| 422 | image_invalid_format | The receipt must be a JPEG, PNG, WebP, or PDF file. Envelope
|
| 422 | image_mime_mismatch | We don't recognize the format of ''image''. Send JPEG, PNG, WebP or PDF. Envelope
|
| 422 | image_not_readable | We couldn't read the image. Upload it again. Envelope
|
| 422 | image_not_readable_receipt | The image is not a readable receipt. Envelope
|
| 422 | image_not_spei_receipt | The image is not a SPEI receipt. We only validate SPEI. Envelope
|
| 422 | image_or_image_url_required | Send 'image' (base64) or 'image_url'. Envelope
|
| 422 | image_polyglot_detected | We can't accept the file in ''image''. Send the bank's original receipt. Envelope
|
| 422 | image_strip_failed | We couldn't process the image in ''image''. Try again. Envelope
|
| 422 | image_too_large | ''image'' exceeds 12 MB. Envelope
|
| 422 | image_too_small | 'image' is too small to be an image. Envelope
|
| 422 | invalid_bank_code | The bank code ''999'' is not valid. Envelope
|
| 422 | invalid_client_ref | The reference must be 1 to 64 characters. Envelope
|
| 422 | invalid_retain_image | 'retain_image' must be true or false. Envelope
|
| 422 | masked_account_no_suffix | The receipt hides the account and does not show its last digits. Envelope
|
| 422 | masked_account_unresolvable | The receipt hides the account and we could not identify it. Envelope
|
| 422 | pdf_active_content | We can't accept the PDF in ''image''. Send the bank's original. Envelope
|
| 422 | pdf_encrypted | The PDF in ''image'' has a password. Send a copy without one. Envelope
|
| 422 | pdf_hidden_content | We can't accept the PDF in ''image''. Send the bank's original. Envelope
|
| 422 | pdf_invalid_structure | The PDF in ''image'' is damaged. Download it again from the bank. Envelope
|
| 422 | pdf_modified_after_issue | We can't accept the PDF in ''image''. Send the bank's original. Envelope
|
| 422 | pdf_multiple_receipts | The document has more than one receipt. Send each one separately. Envelope
|
| 422 | pdf_text_layer_too_large | We can't accept the PDF in ''image''. Send the bank's original. Envelope
|
| 422 | pdf_too_many_pages | The PDF in 'image' has too many pages. Send only the receipt. Envelope
|
| 422 | pdf_unsupported_image | We can't read the PDF in ''image''. Send it as JPEG or PNG. Envelope
|
| 422 | preflight_failed | Some data needs fixing. Envelope
|
| 422 | receiver_bank_unresolvable | The receiving bank could not be identified. Envelope
|
| 422 | retry_pending_cap_exceeded | You reached the limit of validations with pending retries. Envelope
|
| 422 | retry_policy_invalid | The retry policy is not valid. Envelope
|
| 422 | sender_bank_unresolvable | The sending bank could not be identified. Envelope
|
| 422 | tracking_required | The receipt shows neither a tracking key nor a numeric reference. Envelope
|
| 422 | validation_error | Some data needs fixing. Envelope
|
| 429 | quota_exceeded | You used all 500 validations in your plan for this period. Envelope
Response headers
|
| 429 | rate_limit_exceeded | You exceeded the request limit. Envelope
Response headers
|
| 503 | dispatch_failed | We could not start the request. Envelope
|
| 503 | ocr_not_configured | Receipt reading is not available. Envelope
|