SUNAT Exchange Rate (apis.net.pe) API
Free API for the official SUNAT exchange rate used in Peruvian tax filings: buying and selling PEN/USD rates for the current or any past date. No key, tested example.
Endpoint tested and returned HTTP 200 on 2026-08-21
What is the SUNAT Exchange Rate (apis.net.pe) API?
apis.net.pe republishes the SUNAT official exchange rate as a free JSON API with no key. It returns the buying and selling rate between the Peruvian sol and the US dollar for the current or a specified date.
SUNAT is Peru's tax authority, and the rate it publishes is the one Peruvian invoices and tax filings are converted at. That makes this a compliance number rather than a market number: it changes once a day, it is what an auditor will check against, and a live market quote is the wrong thing to substitute for it however much fresher it looks.
The response is deliberately tiny — five fields, no envelope, no pagination. The one operational quirk is that requesting a `fecha` SUNAT has not published yet returns HTTP 404 rather than an empty result, so a job that always asks for today will fail on weekends, Peruvian holidays and early mornings. Omitting `fecha` entirely returns the latest published rate and sidesteps the whole problem.
Quick facts
- Base URL
https://api.apis.net.pe/v1- Authentication
- No key required for the public exchange rate endpoint. Some other endpoints on the same host are token-gated.
- Rate limit
- Throttled per IP without a published figure. The rate changes once per working day, so cache it.
- Pricing
- Free for the public exchange rate endpoint.
- CORS
- Not enabled — call it from your server
- Official docs
- Read the docs
How to use the SUNAT Exchange Rate (apis.net.pe) API
Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.
1. Current official SUNAT PEN/USD rate
GET https://api.apis.net.pe/v1/tipo-cambio-sunat
curl 'https://api.apis.net.pe/v1/tipo-cambio-sunat'const res = await fetch("https://api.apis.net.pe/v1/tipo-cambio-sunat");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://api.apis.net.pe/v1/tipo-cambio-sunat", timeout=20)
res.raise_for_status()
print(res.json()){
"origen": "SUNAT",
"compra": 3.351,
"venta": 3.361,
"moneda": "USD",
"fecha": "2026-08-21"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fecha | query | Optional | Date in `YYYY-MM-DD` for a historical rate. Omit it to get the latest published rate, which avoids 404s on non-publication days. 2026-08-20 |
Response fields
origenstring- Source of the figure — `SUNAT`.
compranumber- Official buying rate, soles per US dollar.
ventanumber- Official selling rate. The gap to `compra` is the official spread.
monedastring- The quoted currency, `USD`.
fechastring- The date this rate applies to, which may be earlier than the date you asked for.
What you can build with the SUNAT Exchange Rate (apis.net.pe) API
- Convert invoice amounts for Peruvian tax filing at the accepted rate
- Reconcile accounting entries against the official rate for a booking date
- Show the SUNAT rate alongside a live market quote for comparison
- Fill a currency field in an electronic invoicing pipeline
Common errors and how to fix them
404 with a `fecha`
SUNAT has not published a rate for that date.
Fix: Weekends, Peruvian holidays and today-before-publication all 404. Omit `fecha` for the latest, or step back a working day.
429
Per-IP throttling.
Fix: The rate changes daily at most. Cache it for the day rather than fetching per request.
Fields missing
You called a different endpoint on the same host.
Fix: Only the exchange rate endpoint is key-free; the RUC and DNI lookups on apis.net.pe require a token.
SUNAT Exchange Rate (apis.net.pe) API — frequently asked questions
What is the SUNAT exchange rate?
It is the official rate published by Peru's tax authority and used to convert foreign-currency amounts in invoices and tax filings. It updates once per working day and is a compliance reference, not a live market quote.
Is this API free?
The exchange rate endpoint is free and needs no key. Other endpoints on the same host, such as company lookups, do require a token.
Why do I get a 404 for today's date?
SUNAT publishes on working days and not instantly at midnight. Requesting an unpublished date returns 404 rather than an empty body — omit `fecha` to get the most recent published rate instead.
What is the difference between compra and venta?
`compra` is the buying rate and `venta` the selling rate. Which applies depends on the direction of the transaction being converted; Peruvian accounting rules specify which to use in each case.
Tools that pair with this API
VAT Calculator
Add VAT to a net price or extract VAT from a gross amount. Preset 5%, 10%, 20% and 23% rates plus custom, showing net, VAT and gross values instantly.
Invoice Generator
Create a professional invoice with line items, tax and totals, then export a clean PDF — all in your browser. Free invoice generator, nothing uploaded.
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
SUNAT Exchange Rate (apis.net.pe) is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.