Convert an amount
Calculate the equivalent of a foreign-currency amount in Dominican pesos.
Convert an amount
amount is expressed in foreign currency, with up to two decimal places. amountDop is a string with two decimal places. The operation is from the user’s perspective: sell to sell foreign currency; buy to buy it.
const response = await fetch(
'https://api.divisa.do/v1/convert?currency=USD&amount=100&operation=sell&fields=amountDop,rate,currency,operation,feesIncluded',
{ headers: { Accept: 'application/json', Authorization: `Bearer ${process.env.DIVISA_API_KEY}` } }
);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const { data, meta } = await response.json();
console.log(data);Live production request: consumes quota. Your key stays in memory until this page is closed or reloaded.
Choose an entity
Without entity, the API uses the best current commercial rates. Add entity and channel to narrow the selection. Unpublished fees are excluded.
curl --fail-with-body 'https://api.divisa.do/v1/convert?currency=USD&amount=100&operation=buy&entity=popular&channel=digital' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $DIVISA_API_KEY"Handle an unavailable rate
A partial quote supports only its available side. If no rate is eligible, do not calculate with zero or treat an official reference as a commercial offer. Always check the HTTP status and the result.