The problem: trusting screenshots
If your business receives payments via SPEI bank transfers, you probably know this scenario well: a customer sends you a screenshot of their payment receipt and your team has to manually verify that the deposit actually arrived. Best case, someone checks the bank statement. Worst case, the screenshot is taken at face value.
This creates several real problems:
- Screenshots can be faked. Anyone with basic image editing skills can alter a payment receipt. There is no reliable way to tell a real screenshot from a modified one.
- Manual reconciliation is slow. Comparing receipts against bank statements one by one eats up hours of work, especially when you receive dozens or hundreds of payments per day.
- Mistakes are expensive. An unverified payment can mean delivering a product or service without actually receiving the money. A duplicated or mismatched payment creates accounting problems that compound over time.
This issue is particularly acute for ecommerce businesses, SaaS platforms, service companies, and any operation that handles a significant volume of SPEI transfers.
The solution: Banxico's CEP
The Comprobante Electronico de Pago (CEP), or Electronic Payment Certificate, is Banco de Mexico's official system for verifying SPEI transfers. Every transfer processed through the SPEI system generates a CEP that is recorded on Banxico's servers and can be queried at any time.
The CEP is the single source of truth for confirming that a SPEI transfer actually took place. It does not depend on the sending or receiving bank — it comes directly from the system operator.
Tlaloc provides programmatic access to this system through its API. Instead of manually navigating the Banxico website, filling out forms, and solving CAPTCHAs, you can make an HTTP request and get the answer in seconds.
Two ways to verify a payment
The Tlaloc API offers two endpoints for querying CEPs, each designed for a different use case.
Quick query: GET /v1/cep_query
The quick query lets you check whether a transfer exists and see its status with minimal data. You only need the transaction date, the tracking key (or numeric reference), and the sender and receiver bank codes.
It is ideal when all you need is a quick "yes, it exists and was settled" or "not found" answer. You do not need to know the CLABE account number or the exact amount.
Cost: $0.10 MXN per query.
Full download: GET /v1/cep
The full download retrieves the official XML document from Banxico with all the transaction details. In addition to the quick query parameters, you need the beneficiary's CLABE account number (18 digits) and the exact transfer amount.
This is the right choice when you need the complete certificate for accounting, legal, or audit purposes. The response includes the XML document digitally signed by Banxico.
Cost: $0.10 MXN per query.
Data you need
Before making your first query, gather the following data. Most of it can be found in the payment receipt your customer sent:
| Field | Example | Where to find it |
|---|---|---|
| Transaction date | 2026-04-07 | Payment receipt |
| Tracking key | MBAN01042601234567 | Payment receipt |
| Sender bank | BBVA (code: 40012) | Payment receipt |
| Receiver bank | Nu Mexico (code: 90638) | Your bank account |
| CLABE (full download only) | 638180000012345678 | Your bank account |
| Amount (full download only) | 5000.00 | Payment receipt |
The tracking key (clave de rastreo) is the unique identifier for each SPEI transfer. It is an alphanumeric string assigned by the sending bank. Some banks call it "tracking number" or "trace reference".
Example: Quick query
To check whether a transfer exists, use the /v1/cep_query endpoint with the basic parameters:
curl "https://api.tlaloc.sh/mx/v1/cep_query?fecha=2026-04-07&tipo_criterio=T&criterio=MBAN01042601234567&emisor=40012&receptor=90638" \
-H "Authorization: Bearer tlmx_YOUR_API_KEY"
The tipo_criterio=T parameter indicates you are searching by tracking key. To search by numeric reference instead, use tipo_criterio=R.
Response:
{
"found": true,
"estado": "Liquidado",
"detalle": {
"beneficiario": "EMPRESA EJEMPLO SA DE CV",
"ordenante": "JUAN PEREZ GARCIA",
"monto": "5000.00",
"fecha_operacion": "07/04/2026"
}
}
If found is true and estado is "Liquidado" (settled), the transfer was successfully processed by Banxico. If found is false, the transfer does not exist in Banxico's records with the data you provided.
Example: Full download
To get the complete official certificate, use the /v1/cep endpoint. This requires additional parameters:
curl "https://api.tlaloc.sh/mx/v1/cep?fecha=2026-04-07&tipo_criterio=T&criterio=MBAN01042601234567&emisor=40012&receptor=90638&cuenta=638180000012345678&monto=5000.00" \
-H "Authorization: Bearer tlmx_YOUR_API_KEY"
Response:
{
"found": true,
"estado": "Liquidado",
"detalle": {
"beneficiario": "EMPRESA EJEMPLO SA DE CV",
"ordenante": "JUAN PEREZ GARCIA",
"cuenta_beneficiario": "638180000012345678",
"cuenta_ordenante": "012180001234567890",
"monto": "5000.00",
"concepto": "PAGO FACTURA 2026-001",
"clave_rastreo": "MBAN01042601234567",
"referencia_numerica": "1234567",
"fecha_operacion": "07/04/2026",
"hora": "14:32:15",
"sello": "..."
},
"xml_content": "<?xml version='1.0'?>..."
}
The xml_content field contains the XML document digitally signed by Banxico. This document has official validity and can be used as a certificate for accounting and legal purposes.
Bank codes
The emisor and receptor parameters require the numeric codes that Banxico assigns to each financial institution. You can look up the full catalog using the /v1/cep/instituciones endpoint:
curl "https://api.tlaloc.sh/mx/v1/cep/instituciones?fecha=2026-04-07" \
-H "Authorization: Bearer tlmx_YOUR_API_KEY"
This endpoint returns the list of all institutions participating in SPEI for the given date, including their numeric code and name. Some common codes:
| Code | Institution |
|---|---|
| 40002 | BANAMEX |
| 40012 | BBVA MEXICO |
| 40014 | SANTANDER |
| 40021 | HSBC |
| 40072 | BANORTE |
| 90638 | NU MEXICO |
| 90646 | STP |
The institution catalog can change over time as new entities join the SPEI system. Always use the endpoint to get the up-to-date list.
Use cases
Programmatic SPEI payment validation with CEP has direct applications in several business scenarios:
- Automatic payment reconciliation. Integrate CEP verification into your payment system to automatically confirm every incoming payment against Banxico's records, eliminating manual review.
- Fraud prevention. Instead of trusting screenshots, validate each transfer directly against the official source. If the CEP does not exist, the payment did not happen.
- Accounting automation. Download complete CEPs with the official XML to feed directly into your accounting system, with the certainty that every certificate is authentic.
- Payment collection workflows. Integrate verification into your collection flow to release orders, activate services, or update balances automatically once a payment is confirmed.
Next steps
Now that you know how to verify SPEI payments programmatically, you can take automation even further:
- Automate this process with AI — Combine an AI assistant with the CEP API to validate payment receipts from images, with no code required.
- Set up the MCP server to use CEP from ChatGPT or Claude — Connect your favorite AI assistant directly to official Banxico data in minutes.