Query rates
Filter by currency, entity and channel. Sort or select the fields you need.
Filter and select fields
Buy and sell are from the entity’s perspective. buy is what it pays when you sell foreign currency; sell is what it charges when you buy. Decimals are strings and a missing side is null.
curl --fail-with-body 'https://api.divisa.do/v1/rates?currency=USD&kind=commercial&fields=id,entityId,currency,buy,sell,channel,kind,stale,isOfficialSource,lastCheckedAt,expiresAt&sort=-buy&limit=10' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $DIVISA_API_KEY"Live production request: consumes quota. Your key stays in memory until this page is closed or reloaded.
Read each page
Use meta.nextCursor as the next request’s cursor. Stop when it is null. Keep the same filters between pages.
const url = new URL('https://api.divisa.do/v1/rates?currency=USD&limit=50');
const rates = [];
let cursor = 0;
do {
url.searchParams.set('cursor', String(cursor));
const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.DIVISA_API_KEY}` } });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { data, meta } = await response.json();
rates.push(...data);
cursor = meta.nextCursor;
} while (cursor !== null);
console.log(rates);Find the best rate
operation=sell sorts by the highest buy rate; operation=buy by the lowest sell rate. Official references and expired quotes are excluded.
curl --fail-with-body 'https://api.divisa.do/v1/rates/best?currency=USD&operation=sell' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $DIVISA_API_KEY"Dates and provenance
publishedAt is the published date and time; effectiveDate preserves a date without a time; datePrecision declares that precision. lastCheckedAt is the last check. isOfficialSource is true when the adapter, origin and entity match a registered direct official source; it is false for aggregators, manual submissions and unknown origins. This additive field may be absent during rollout; treat absence as false. It identifies origin, not price certification. JSON and XML retain complete provenance.