BYTETOOLS

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.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

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 2026-08-21, 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
curl 'https://www.datos.gov.co/resource/32sa-8pi3.json?$limit=1&$order=vigenciadesde%20DESC'
JavaScript (fetch)
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);
Python (requests)
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())
Response — HTTP 200
[
  {
    "valor": "3062.96",
    "unidad": "COP",
    "vigenciadesde": "2026-08-21T00:00:00.000",
    "vigenciahasta": "2026-08-21T00:00:00.000"
  }
]

Parameters

ParameterTypeRequiredDescription
dataset idpath segmentRequiredSocrata dataset identifier. `32sa-8pi3` is the historical TRM series. 32sa-8pi3.json
$limitqueryOptionalNumber of records to return. Defaults to 1000. 1
$orderqueryOptionalSort expression. `vigenciadesde DESC` puts the newest rate first. vigenciadesde DESC
$wherequeryOptionalSoQL 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

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 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.