Guide · Peru economic indicators

Peru exchange rate API: how to get the SUNAT, SBS and interbank dollar rate in soles

How to get the US dollar rate in Peruvian soles from your code or an AI agent: how the SBS, SUNAT and interbank rates differ, how to work out the SUNAT rate for any date, and how to receive it as clean JSON with Better Llama's MCP tool, with no key.

SBS, SUNAT or interbank: which exchange rate do you need?

Three USD/PEN figures are used in Peru, and they are not interchangeable:

  • SBS rate. The Superintendencia de Banca, Seguros y AFP computes, for every business day, the weighted average buy and sell rate of the financial system's trades. It is that day's close.
  • SUNAT rate. The same SBS figure, published one day later: according to SUNAT's official page, the rate published on a date is the SBS closing rate of the previous day, and on days with no publication (weekends and holidays) the previous day's rate applies.
  • Interbank rate. Published by the Banco Central de Reserva del Perú (BCRP) from trades between banks. It is a market reference, but it does not replace the SBS rate where a regulation requires the latter.

All three series are on BCRPData, the BCRP statistics portal, which allows reproduction citing the source (terms of use). The SBS closes on BCRPData match the rate SUNAT published: we checked November 24, 27, 28, 29 and 30, 2026.

These are the real SBS closes from November 16 to 27, 2026 and the date on which each one is the SUNAT rate. The close of Friday Fri Nov 27 is the SUNAT rate for Saturday, Sunday and Monday the 30th:

SBS closeBuy (S/)Sell (S/)SUNAT rate for
Fri Nov 273.4553.465Sat Nov 28, Sun Nov 29, Mon Nov 30
Thu Nov 263.4703.484Fri Nov 27
Wed Nov 253.4903.496Thu Nov 26
Tue Nov 243.4703.479Wed Nov 25
Mon Nov 233.4443.455Tue Nov 24
Fri Nov 203.4473.453Sat Nov 21, Sun Nov 22, Mon Nov 23
Thu Nov 193.4343.442Fri Nov 20
Wed Nov 183.4263.433Thu Nov 19
Tue Nov 173.4083.415Wed Nov 18
Mon Nov 163.4083.419Tue Nov 17

Two ways to get the exchange rate by API

1. The BCRPData API directly

BCRPData has a public API with no key, with the pattern /estadisticas/series/api/[codes]/[format]/[start]/[end]/[language]. For example, the SBS buy and sell rates for November 26 and 27, 2026:

curl · BCRPData
curl -s "https://estadisticas.bcrp.gob.pe/estadisticas/series/api/PD04639PD-PD04640PD/json/2026-11-26/2026-11-27/esp"

Real response (November 30, 2026):

json
{
"config":
{
"title":"Tipo de cambio",
"series":
[
{
"name":"Tipo de cambio - TC Sistema bancario SBS (S/ por US$) - Compra",
"dec":"3"
},
{
"name":"Tipo de cambio - TC Sistema bancario SBS (S/ por US$) - Venta",
"dec":"3"
}]
},
"periods":
[
{
"name":"26.Nov.26",
"values":["3.47","3.484"]
},
{
"name":"27.Nov.26",
"values":["3.455","3.465"]
}
]
}

The integration is up to you: values arrive as text, dates look like 27.Nov.26, days with no data show n.d. and you have to work out SUNAT's one-day lag yourself.

2. Better Llama's BCRP tool (over MCP)

Our tool Peru BCRP: exchange rate, inflation and series, peru_bcrp_series, queries BCRPData and returns a ready-to-use result:

  • Easy aliases (tc_sbs_compra, tc_sbs_venta, tc_interbancario_venta…) or any BCRPData code, up to 10 series per call.
  • An ISO date (2026-11-27) and a numeric value for each point, newest first, with a summary in latest.
  • n.d. days are dropped and reported in warnings; every response carries the source attribution.

Use it as an MCP tool from Claude, Cursor or other agents, or over HTTP with JSON-RPC from any language.

Step by step: get the SBS and SUNAT exchange rate

Step 1. Choose the exchange rate

These are the exchange rate series in the peru_bcrp_series catalog (with operation set to catalogo and query set to tipo de cambio you get the same list):

AliasBCRPData codeWhat it is
tc_sbs_compraPD04639PDSBS, buy (daily weighted average)
tc_sbs_ventaPD04640PDSBS, sell (daily weighted average)
tc_interbancario_compraPD04637PDInterbank, buy (daily)
tc_interbancario_ventaPD04638PDInterbank, sell (daily)
tc_interbancario_venta_mensualPN01206PMInterbank, sell: monthly average
tc_euro_ventaPD04648PDEuro, sell (daily, S/ per euro)

For the SUNAT rate of a date, ask for tc_sbs_compra and tc_sbs_venta and take the latest close before that date (see the Python example below).

Step 2. Connect the MCP server

Use the MCP https://mcp.betterllama.com/mcp in your client or call it over HTTP with JSON-RPC, as in the examples. This tool needs no key and no account or sign-up during the beta.

Step 3. Build your query

ParameterWhat it does
seriesList of BCRPData aliases or codes (up to 10)
fromDate / toDateFrom and to (YYYY-MM-DD). Default: the last 45 days up to today (Lima time)
maxItemsMaximum data points per series (1 to 1000, default 30), newest first

There is no SBS or interbank close on weekends and holidays: those days simply do not appear. Today's close appears once the BCRP publishes it.

Step 4. Call the tool with curl

A JSON-RPC POST returns the result as JSON. This call asks for the SBS buy and sell rates since November 26, 2026:

curl
curl -s https://mcp.betterllama.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "peru_bcrp_series", "arguments": {"series": ["tc_sbs_compra", "tc_sbs_venta"], "fromDate": "2026-11-26"}}}'

Work out the SUNAT rate for a date in Python

The function asks for the SBS closes of the previous 10 days and keeps the latest one, which is the SUNAT rate for that date (Saturdays, Sundays and holidays included):

python
import json
from datetime import date, timedelta
import requests

URL = "https://mcp.betterllama.com/mcp"
HEADERS = {"Accept": "application/json, text/event-stream"}

def tipo_de_cambio_sunat(fecha):
    """Rate SUNAT publishes on `fecha`: the latest SBS close before it."""
    desde = (fecha - timedelta(days=10)).isoformat()
    hasta = (fecha - timedelta(days=1)).isoformat()
    arguments = {"series": ["tc_sbs_compra", "tc_sbs_venta"],
                 "fromDate": desde, "toDate": hasta}
    body = {"jsonrpc": "2.0", "id": 1, "method": "tools/call",
            "params": {"name": "peru_bcrp_series", "arguments": arguments}}
    resp = requests.post(URL, json=body, headers=HEADERS, timeout=60)
    resp.raise_for_status()
    data = json.loads(resp.json()["result"]["content"][0]["text"])
    compra, venta = (serie["latest"] for serie in data["results"])
    return compra["date"], compra["value"], venta["value"]

for dia in ("2026-11-27", "2026-11-28", "2026-11-29", "2026-11-30"):
    cierre_sbs, compra, venta = tipo_de_cambio_sunat(date.fromisoformat(dia))
    print(dia, "-> SBS close", cierre_sbs, "buy", compra, "sell", venta)

Real output (November 30, 2026, 18:15 Chile time). It matches the rate SUNAT published for those four dates:

output
2026-11-27 -> SBS close 2026-11-26 buy 3.47 sell 3.484
2026-11-28 -> SBS close 2026-11-27 buy 3.455 sell 3.465
2026-11-29 -> SBS close 2026-11-27 buy 3.455 sell 3.465
2026-11-30 -> SBS close 2026-11-27 buy 3.455 sell 3.465

From JavaScript or any other language, a POST with the same JSON-RPC body is enough (for example, with fetch).

Monthly average

For accounting or monthly reports, tc_interbancario_venta_mensual returns the monthly average: in 2026 it was S/ 3.3573 in January and S/ 3.4431 in October (call with fromDate set to 2026-01).

Use the exchange rate API from an AI agent (MCP)

Add Better Llama's MCP server in your client (Claude, Cursor, VS Code or any other with remote MCP). One MCP brings peru_bcrp_series and the rest of the catalog, with no sign-up during the beta.

Cursor · mcp.json
{
  "mcpServers": {
    "better-llama": {
      "url": "https://mcp.betterllama.com/mcp"
    }
  }
}
Claude Code
claude mcp add --transport http better-llama https://mcp.betterllama.com/mcp

Setup for Claude, Codex, Gemini CLI, Windsurf, VS Code and other clients: connect your agent.

Ready-to-run Python and Node.js examples, with config files for each client: examples repository on GitHub.

Example scripts for this guide: python/bcrp_peru.py (Python), node/latam.mjs (Node.js).

Then ask, for example: "What is today's SUNAT exchange rate (buy and sell) and how much did the dollar move in Peru over the last week? Cite the source."

Beta: free and with no sign-up while we test the service.

Which fields it returns

Each series in results has code, alias, name, unit (S/ per US$), frequency, requestedRange, latest, count, points (each with period as the BCRP publishes it, an ISO date and a numeric value) and sourceUrl. The response also includes warnings, attribution, source and retrievedAt.

Real, complete response to the curl call above (November 30, 2026, 18:18 Chile time). The n.d. warning is Monday the 30th, whose close was not published yet; text fields come in Spanish, as the source publishes them:

json
{
  "tool": "peru_bcrp_series",
  "count": 2,
  "results": [
    {
      "code": "PD04639PD",
      "alias": "tc_sbs_compra",
      "name": "Tipo de cambio - TC Sistema bancario SBS (S/ por US$) - Compra",
      "unit": "S/ por US$",
      "frequency": "diaria",
      "requestedRange": {
        "from": "2026-11-26",
        "to": "2026-11-30"
      },
      "latest": {
        "period": "27.Nov.26",
        "date": "2026-11-27",
        "value": 3.455
      },
      "count": 2,
      "points": [
        {
          "period": "27.Nov.26",
          "date": "2026-11-27",
          "value": 3.455
        },
        {
          "period": "26.Nov.26",
          "date": "2026-11-26",
          "value": 3.47
        }
      ],
      "sourceUrl": "https://estadisticas.bcrp.gob.pe/estadisticas/series/api/PD04639PD/html/2026-11-26/2026-11-30/esp"
    },
    {
      "code": "PD04640PD",
      "alias": "tc_sbs_venta",
      "name": "Tipo de cambio - TC Sistema bancario SBS (S/ por US$) - Venta",
      "unit": "S/ por US$",
      "frequency": "diaria",
      "requestedRange": {
        "from": "2026-11-26",
        "to": "2026-11-30"
      },
      "latest": {
        "period": "27.Nov.26",
        "date": "2026-11-27",
        "value": 3.465
      },
      "count": 2,
      "points": [
        {
          "period": "27.Nov.26",
          "date": "2026-11-27",
          "value": 3.465
        },
        {
          "period": "26.Nov.26",
          "date": "2026-11-26",
          "value": 3.484
        }
      ],
      "sourceUrl": "https://estadisticas.bcrp.gob.pe/estadisticas/series/api/PD04640PD/html/2026-11-26/2026-11-30/esp"
    }
  ],
  "warnings": [
    "PD04640PD: 1 periodo(s) sin dato publicado (\"n.d.\", p. ej. días sin operación o dato aún no disponible) se omitieron.",
    "PD04639PD: 1 periodo(s) sin dato publicado (\"n.d.\", p. ej. días sin operación o dato aún no disponible) se omitieron."
  ],
  "attribution": "Fuente: Banco Central de Reserva del Perú (BCRP), BCRPData — estadisticas.bcrp.gob.pe. Reproducción permitida citando la fuente (Condiciones de uso de BCRPData). En series de fuente externa (p. ej. IPC elaborado por el INEI) la responsabilidad del dato recae en la entidad que lo provee. Datos sin modificar salvo formato; no constituyen asesoramiento.",
  "source": "https://estadisticas.bcrp.gob.pe/estadisticas/series/",
  "retrievedAt": "2026-11-30T21:18:19.809Z"
}

If you reuse the data, cite "Source: Banco Central de Reserva del Perú (BCRP), BCRPData". For tax purposes, always check SUNAT's official publication.

Pricing

Free during the beta, no sign-up, with a limit of 60 requests per minute per IP. If paid plans come later, we will announce them on betterllama.com first. This tool needs no key.

Frequently asked questions

Is there a SUNAT exchange rate API?

SUNAT publishes the rate on its web lookup, and that value is the SBS close of the previous day. The SBS closes are on the public BCRPData API (series PD04639PD buy and PD04640PD sell), and Better Llama's peru_bcrp_series tool returns them as JSON over MCP or JSON-RPC, with no key.

What is the difference between the SBS and the SUNAT rate?

It is the same figure published on different dates. The SBS computes the weighted average buy and sell rate at the close of each business day, and SUNAT shows it as the next day's rate. For example, the SBS close of Thursday, November 26, 2026 (buy 3.470, sell 3.484) was SUNAT's rate for Friday the 27th.

Which SUNAT rate applies on a Saturday, Sunday or holiday?

The one from the previous day with a publication. Since there is no SBS close on weekends, Friday's close applies on Saturday, Sunday and Monday: the close of Friday, November 27, 2026 (buy 3.455, sell 3.465) was SUNAT's rate for November 28, 29 and 30.

Should I use the buy or the sell rate?

It depends on the regulation and the transaction. As a general reference, the IGV (VAT) regulation asks for the weighted average sell rate, and for the income tax year-end close the buy rate is used for assets and the sell rate for liabilities. When in doubt, ask your accountant or check SUNAT's rules.

What is the interbank exchange rate?

The one the BCRP publishes from dollar buy and sell trades between banks. It is usually very close to the SBS rate, but not the same: on November 27, 2026 the interbank sell rate was S/ 3.460 and the SBS sell rate S/ 3.465.

Do I need a key or token?

No. Neither the BCRPData API nor Better Llama's tool asks for a key. Better Llama's is free during the beta, with a limit of 60 requests per minute per IP.

Can I use the exchange rate API from Claude, Cursor or another AI agent?

Yes. Add Better Llama's MCP server (https://mcp.betterllama.com/mcp) in your client and the agent can use peru_bcrp_series to get the SBS rate, the SUNAT rate for a date or the interbank rate in natural language.

Is Better Llama affiliated with the BCRP, the SBS or SUNAT?

No. Better Llama is an independent project, not affiliated with, sponsored by or endorsed by the BCRP, the SBS or SUNAT. The data source is BCRPData, reused citing the source under its terms of use.

Other guides

This guide is also available en español.