How to Integrate the Banxico CEP API for Real-Time Mexican Exchange Rates
The Banxico CEP (Centro de Cambios) API provides official exchange rates from the Bank of Mexico, including USD/MXN spot rates, TIIE interbank rates, and UDI inflation indices. This guide walks you through integrating the Banxico CEP API into your application, covering authentication, core endpoints, and practical use cases like ACH payments and AML compliance.

What Is the Banxico CEP API and Why Use It?
Banxico CEP (Centro de Cambios) is the official source for Mexican exchange rates, published daily by the central bank. The API returns data in JSON format, making it easy to integrate into web and mobile applications. Common use cases include:
- USD/MXN spot rate for pricing and conversion
- TIIE (Tasa de Interés Interbancaria de Equilibrio) for loan rate calculations
- UDI (Unidad de Inversión) for inflation-adjusted contracts
Direct API access eliminates the need to manually download PDFs or scrape websites. You get structured data with audit trails, essential for regulated industries like fintech, insurance, and banking.
Authentication and Setup
To access the Banxico CEP API, you need an API token. You can obtain one through Banxico’s SIAC (Sistema de Información Económica) portal or via a third-party provider that handles the authentication layer. The token is passed as a header in every request.
Most providers offer a sandbox environment with synthetic test data. This lets you simulate queries and validate responses before going live. For production, ensure you have a stable token and a clear understanding of usage limits.
Core API Endpoints: What You Send and Get Back
The API is structured around series IDs. You send a request to retrieve data for a specific series, and the response includes an array of dates and values. The conceptual path is /api/series/{seriesId}/datos, where {seriesId} is a unique identifier. Common series IDs include:
| Series ID | Description | Frequency |
|---|---|---|
| SF43718 | USD/MXN exchange rate (FIX) | Daily |
| SF60653 | TIIE 28-day rate | Daily |
| SP68257 | UDI (Unidad de Inversión) | Daily |
Example: Querying SF43718 returns the latest available USD/MXN rate. The response includes the date, value, and metadata. You can also request historical ranges by adding start and end date parameters.
For batch operations, you can request multiple series in a single call or use a dedicated bulk endpoint if your provider offers one. This is useful for populating dashboards or running compliance checks.
Integrating Banxico Data Into Your Workflow
Real-Time Currency Conversion for ACH Payments
When processing cross-border ACH payments, you need the latest USD/MXN rate to convert amounts. Use the Banxico CEP API to fetch the current FIX rate before creating a transfer. For example, a payment of $1,000 USD can be converted to pesos using the retrieved rate, and you can generate a comprobante electrónico de pago to confirm the transaction. The Banco de México ensures the rate is official, so both parties have a reliable reference.
Automating Accounts Payable (AP) With Current Rates
In AP automation, you can use the API to pull the daily TIIE or USD/MXN rate for invoice conversion. This is especially useful for companies dealing with suppliers in Mexico. By querying the consulta endpoint, you can obtain the monto in the correct currency and store the datos for audit trails. The entire process can be run through transferencias via SPEI, ensuring fast settlement.
Using Exchange Rates for AML Compliance Checks
For AML programs, you often need to convert transaction amounts to a baseline currency for monitoring. The Banxico CEP API provides an official rate that can be used to flag suspicious activity. You can also link the exchange rate to a transaction ID, creating a verifiable record. This is critical for meeting regulations from the Comisión Nacional Bancaria y de Valores (CNBV).
Afore and Retirement Fund Calculations
Afore (Administradoras de Fondos para el Retiro) use UDI values to adjust retirement account balances. By integrating the UDI series, you can automate monthly updates and provide account holders with accurate inflation-adjusted figures.

Error Handling and Rate Limits
Common HTTP errors include:
- 400 Bad Request: Invalid parameters or missing data
- 401 Unauthorized: Token missing or expired
- 404 Series Not Found: The series ID does not exist
Banxico updates its rates once per business day, typically after 10:00 AM Mexico City time. On weekends and holidays, the API returns the last available value. Implement caching with a TTL of 1 hour to reduce unnecessary calls. Use retry logic with exponential backoff for transient failures.
When Banxico CEP Is the Wrong Tool
- Real-time streaming rates: If you need sub-second updates for forex trading, consider a commercial provider that offers streaming feeds.
- Non-MXN currency pairs: Banxico only covers Mexican peso pairs. For EUR/USD or other crosses, use a global forex API.
- Historical data beyond 10 years: Banxico’s API may not provide deep historical archives. For long-term analysis, use a data vendor or the Banxico SIE web interface.
Next Steps: Start Testing With the Banxico API
To get started, sign up for a sandbox API key from your preferred provider. Most offer a simple REST call to test the connection. For a unified endpoint with enhanced reliability, check out the Banxico API documentation. You can also explore the Economic Indicators API for combined Banxico and INEGI data, or the Financial Data API for TIIE and BMV market data. For compliance applications, see the CURP Compliance API and AML API Mexico.
External resources:
- Banxico SIE official site
- Official exchange rates page
- DOF - Diario Oficial de la Federación
- CNBV - Comisión Nacional Bancaria y de Valores
- Banxico publications
FAQ
What is the Banxico CEP API?
The Banxico CEP (Centro de Cambios) API provides official exchange rates from the Bank of Mexico, including USD/MXN, TIIE, and UDI data, in JSON format for developers.
How do I get an API token for Banxico?
You can obtain a token through Banxico’s SIAC system or through a third-party provider that offers pre-configured access.
Can I use the Banxico CEP API for real-time forex trading?
No, Banxico updates rates once per business day. For real-time streaming, use a commercial forex API.
What series IDs are most commonly used?
SF43718 for USD/MXN, SF60653 for TIIE, and SP68257 for UDI.
How do I handle missing data on weekends?
The API returns the last available value. Implement caching with a TTL of 1 hour to avoid unnecessary requests.