DIVISA API / PRODUCCIÓN

Integrate from Node.js and TypeScript

Use Node.js fetch and load DIVISA_API_KEY from your server secret store. This request uses real rates and consumes quota.

cURL
curl --fail-with-body 'https://api.divisa.do/v1/rates?currency=USD&freshness=current&limit=5' \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $DIVISA_API_KEY"
TypeScript
const response = await fetch(
  'https://api.divisa.do/v1/rates?currency=USD&freshness=current&limit=5',
  { 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);

Backend integration checklist

  1. Create an application and a backend key. Keep the secret out of client code.
  2. Query the appropriate currency, channel and commercial or reference type. Buy and sell use the entity perspective.
  3. Preserve decimal values as strings. Use decimal arithmetic for calculations, not Number or parseFloat.
  4. Store the chosen rate, entity, source, timestamps and temporal precision with the result. Attribute Divisa and display the date.
  5. When a side is missing, expired or uncovered, expose that absence and require an explicit decision. Never invent a value.
  6. Check the request ID in Usage after the first authenticated request.

The initial integration is informational. Using rates for charges or fiscal documents requires a specific assessment with the product owner.