Colombia TRM (datos.gov.co) API
Free API for Colombia's official TRM exchange rate on datos.gov.co: the representative market rate with its validity window, queryable by date. No key, tested example.
Endpoint tested and returned HTTP 200 on 21 Aug 2026
What is the Colombia TRM (datos.gov.co) API?
Colombia's official TRM exchange rate is published as an open dataset on datos.gov.co and served through a free Socrata API with no key. Each record gives the rate and the date range over which it is valid.
The TRM — Tasa Representativa del Mercado — is Colombia's official peso-to-dollar rate, and it is the number Colombian invoicing, customs and tax calculations use. Because it is published as an open dataset rather than a bespoke API, you get the full Socrata query language for free: filtering, ordering, aggregation and paging all work through `$where`, `$order` and `$limit` without any custom syntax to learn.
The record shape encodes something most FX feeds do not: a validity window. `vigenciadesde` and `vigenciahasta` bracket the period a rate applies to, and for a Friday publication that window often spans the weekend rather than being a single day. Query by whether your transaction date falls inside the window rather than matching it against a single date field, or Saturday transactions will find no rate at all.
Quick facts
- Base URL
https://www.datos.gov.co/resource- Authentication
- No key required for moderate use. Socrata offers a free app token that raises the throttling ceiling but is optional.
- Rate limit
- Unauthenticated requests share a per-IP throttle. An optional free app token lifts it.
- Pricing
- Free. Published under Colombia's open data programme.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the Colombia TRM (datos.gov.co) API
Every request below was executed against the live API on 21 Aug 2026, and the response shown is the real body it returned — not an illustration.
1. Most recent official TRM value
GET https://www.datos.gov.co/resource/32sa-8pi3.json?$limit=1&$order=vigenciadesde%20DESC
curl 'https://www.datos.gov.co/resource/32sa-8pi3.json?$limit=1&$order=vigenciadesde%20DESC'const res = await fetch("https://www.datos.gov.co/resource/32sa-8pi3.json?$limit=1&$order=vigenciadesde%20DESC");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://www.datos.gov.co/resource/32sa-8pi3.json?$limit=1&$order=vigenciadesde%20DESC", timeout=20)
res.raise_for_status()
print(res.json())[
{
"valor": "3062.96",
"unidad": "COP",
"vigenciadesde": "2026-08-21T00:00:00.000",
"vigenciahasta": "2026-08-21T00:00:00.000"
}
]Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dataset id | path segment | Required | Socrata dataset identifier. `32sa-8pi3` is the historical TRM series. 32sa-8pi3.json |
$limit | query | Optional | Number of records to return. Defaults to 1000. 1 |
$order | query | Optional | Sort expression. `vigenciadesde DESC` puts the newest rate first. vigenciadesde DESC |
$where | query | Optional | SoQL filter, for example a date-window test against `vigenciadesde` and `vigenciahasta`. vigenciadesde <= '2026-08-20' |
Response fields
valorstring- The TRM, in pesos per US dollar, returned as a string. Parse before arithmetic.
unidadstring- Currency unit of the value — `COP`.
vigenciadesdestring- First date the rate is valid from, as an ISO timestamp.
vigenciahastastring- Last date the rate is valid until. Often spans a weekend for Friday publications.
What you can build with the Colombia TRM (datos.gov.co) API
- Convert dollar amounts for Colombian invoicing and customs at the official rate
- Look up the TRM valid on a given transaction date using a window query
- Chart the TRM over a period by ordering and limiting the dataset
- Reconcile accounting entries against the officially published rate
Common errors and how to fix them
No record for a weekend date
You matched on equality instead of the validity window.
Fix: Filter with `vigenciadesde <= date AND vigenciahasta >= date`. Friday rates commonly cover Saturday and Sunday.
429
Unauthenticated per-IP throttling.
Fix: Cache the daily value, or register a free Socrata app token to raise the ceiling.
String arithmetic errors
`valor` is a string, not a number.
Fix: Parse to a decimal type explicitly. Socrata returns numeric columns as strings in JSON.
Colombia TRM (datos.gov.co) API — frequently asked questions
What is the TRM in Colombia?
The Tasa Representativa del Mercado is the official peso-to-dollar exchange rate, calculated from market transactions and used for invoicing, customs and tax purposes. It is published with a validity window rather than for a single day.
Do I need an API key for datos.gov.co?
No. Unauthenticated requests work and share a per-IP throttle. A free Socrata app token raises that ceiling but is optional and does not change the data.
Why does a rate cover more than one day?
The TRM published on a Friday typically remains valid through the weekend. `vigenciadesde` and `vigenciahasta` bracket the exact period, which is why you should query the window rather than a single date.
How far back does the dataset go?
The historical TRM dataset covers many years of daily publications. Use `$order` and `$limit` to page through it rather than fetching everything at once.
Tools that pair with this API
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.
Percentage Change Calculator
Work out the percentage increase or decrease between an old and a new value. See the absolute change and whether it went up or down, instantly and privately.
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.
Alternatives to Colombia TRM (datos.gov.co) API
If Colombia TRM (datos.gov.co) does not fit, these finance & crypto apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.
| API | What it does | Auth | CORS | Last verified |
|---|---|---|---|---|
| CoinGecko | Free cryptocurrency price API covering 10,000+ coins. Live prices, market cap and volume in any currency, no API key on the public tier. Tested curl example. | No key | Yes | 19 Aug 2026 |
| Binance Public API | Binance public market data API needs no API key: live ticker prices, order books, klines and 24h stats for every trading pair. Tested curl example and response. | No key | Yes | 19 Aug 2026 |
| Coinbase Exchange Rates | Coinbase public exchange rates API with no key: convert any cryptocurrency to 100+ fiat currencies in a single request. Tested curl example and live JSON. | No key | Yes | 19 Aug 2026 |
| Frankfurter | Free currency exchange rate API with no key, built on European Central Bank data. Latest and historical rates, time series and conversion. Tested curl example. | No key | Yes | 19 Aug 2026 |
| Croatian National Bank | Free Croatian National Bank API with no key: official EUR buying, middle and selling rates for every quoted currency, current or for any past date. Tested example included. | No key | No | 21 Aug 2026 |
| Crypto Fear & Greed Index | Free Crypto Fear and Greed Index API with no key: a daily 0-100 sentiment score with its classification and history back to 2018. Tested curl example and live response. | No key | Yes | 21 Aug 2026 |
Colombia TRM (datos.gov.co) is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 21 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.