What Is a Currency Exchange Rate API?
Why Exchange Rate API? Exchange rates between currencies fluctuate continuously during trading hours, driven by macroeconomic data releases, central bank decisions, geopolitical events, and market sentiment. Applications that display prices in multiple currencies, process cross-border payments, or perform financial analysis need access to rates that reflect the current market — not values from an hour ago that may be off by a meaningful margin on volatile pairs.
The Currency Exchange Rate API by GLOBUS.studio provides real-time rates sourced from major global financial feeds, refreshed every minute, for a wide range of currency pairs. Each response includes both buy and sell rates — the spread used in real financial transactions — along with timestamps and structured JSON data ready for financial calculations. Response latency is 2ms.
API Endpoint and Parameters
GET https://api.globus.studio/v2/currencies?base={currency}&format=json
base— the base currency code (e.g.USD,EUR) against which all pairs are quotedformat— response format;jsonreturns a structured array of currency pair objects
Full parameter reference and live rate testing are available on the Exchange Rate API documentation page.
Response Structure
Each object in the response array represents a currency pair relative to the requested base:
currencyCodeA— the quote currency (e.g.EUR)currencyCodeB— the base currency (e.g.USD)rateBuy— the rate at which the market buys currency A with currency BrateSell— the rate at which the market sells currency A for currency B
Request and Response Examples
Base USD — Selected Pairs
GET /v2/currencies?base=USD&format=json
[
{
"currencyCodeA": "EUR",
"currencyCodeB": "USD",
"rateBuy": 1.0845,
"rateSell": 1.0887
},
{
"currencyCodeA": "GBP",
"currencyCodeB": "USD",
"rateBuy": 1.2614,
"rateSell": 1.2662
}
]
Base EUR — Selected Pairs
GET /v2/currencies?base=EUR&format=json
[
{
"currencyCodeA": "USD",
"currencyCodeB": "EUR",
"rateBuy": 0.9185,
"rateSell": 0.9219
},
{
"currencyCodeA": "GBP",
"currencyCodeB": "EUR",
"rateBuy": 1.1628,
"rateSell": 1.1671
}
]
Buy Rate vs. Sell Rate — Why Both Matter
Most free exchange rate APIs return a single mid-market rate — the mathematical midpoint between buy and sell. This is useful for display purposes but insufficient for any application that needs to model real transaction costs. The spread between rateBuy and rateSell represents the cost of conversion that any real financial institution charges, and it varies by currency pair, market conditions, and time of day. Applications that calculate actual conversion amounts — rather than just displaying indicative rates — must use the correct directional rate to avoid systematic errors that compound at scale.
Common Use Cases
Multi-Currency E-Commerce Pricing
Online stores serving international customers need to display prices in the visitor’s local currency without manually maintaining a conversion table that becomes stale within hours. Calling the Exchange Rate API at page render time — or caching rates with a one-minute TTL matching the API’s own refresh cycle — ensures that displayed prices reflect current market conditions. WooCommerce stores, Shopify storefronts running custom middleware, and headless commerce platforms all benefit from a live rate feed rather than a static conversion factor set weeks ago.
Invoice and Billing Systems
Businesses billing international clients in local currencies need to lock in an exchange rate at invoice generation time and record it for accounting purposes. Fetching the current rateSell from the API at the moment an invoice is created — and storing it alongside the invoice record — produces an auditable conversion history that accountants and auditors can trace back to a timestamped market rate rather than an internal estimate.
Financial Dashboards and Portfolio Tracking
Investment portfolios holding assets denominated in multiple currencies require continuous recalculation of total value as rates move. A dashboard polling the Exchange Rate API every minute — matching the data refresh cycle — displays portfolio value in the user’s base currency with the same freshness as the underlying rate data. The structured JSON response maps directly to charting and calculation libraries without transformation overhead.
WordPress WooCommerce Currency Switching
WooCommerce multi-currency plugins need a reliable live rate source to convert product prices on the fly. A WordPress plugin can call the Exchange Rate API via wp_remote_get() and cache the result with set_transient() using a 60-second TTL — matching the API’s one-minute refresh cycle exactly. The cached rate array is then available to all WooCommerce price filters without incurring repeated API calls per product displayed on a category page.
Remittance and Money Transfer Applications
Remittance platforms need to quote a precise converted amount to the sender before they confirm a transfer — and that quote must reflect a real, achievable rate, not a mid-market fiction. Using rateBuy or rateSell depending on the direction of the conversion produces quotes that are financially meaningful and match what the recipient will actually receive, building user trust in the accuracy of the platform.
Travel and Expense Management Tools
Corporate expense platforms that allow employees to submit receipts in foreign currencies need to convert amounts to the company’s reporting currency at the rate applicable on the date of the expense. Pulling historical rate snapshots — or the current rate for real-time submissions — from the API and attaching the rate to each expense record creates a transparent audit trail that satisfies both internal finance requirements and external reporting obligations.
Crypto and Fintech Application Backends
Fintech applications that bridge fiat and cryptocurrency markets need reliable fiat-to-fiat rates as one component of a multi-step conversion chain. The Exchange Rate API’s low latency and minute-level freshness make it suitable as a building block in pricing engines where USD/EUR/GBP rates feed into downstream calculations alongside crypto spot prices from separate data sources.
Automated Currency Arbitrage Monitoring
Developers building rate monitoring tools — alerting systems that notify users when a target exchange rate is reached, or analysis tools tracking spread behavior across time — need a polling source with consistent structure and high availability. At 2ms latency, the API can be polled at the maximum meaningful frequency (once per minute, matching the data refresh cycle) without any concern about response time variability degrading the monitoring loop.
Integration Examples
cURL
curl "https://api.globus.studio/v2/currencies?base=USD&format=json"
JavaScript (Fetch API)
const res = await fetch('https://api.globus.studio/v2/currencies?base=USD&format=json');
const rates = await res.json();
rates.forEach(pair => {
console.log(
`${pair.currencyCodeA}/${pair.currencyCodeB}`,
`Buy: ${pair.rateBuy}`,
`Sell: ${pair.rateSell}`
);
});
PHP
$response = file_get_contents(
'https://api.globus.studio/v2/currencies?base=USD&format=json'
);
$rates = json_decode($response, true);
foreach ($rates as $pair) {
printf(
"%s/%s — Buy: %s | Sell: %s\n",
$pair['currencyCodeA'],
$pair['currencyCodeB'],
$pair['rateBuy'],
$pair['rateSell']
);
}
Python
import requests
rates = requests.get(
'https://api.globus.studio/v2/currencies',
params={'base': 'USD', 'format': 'json'}
).json()
for pair in rates:
print(f"{pair['currencyCodeA']}/{pair['currencyCodeB']} "
f"Buy: {pair['rateBuy']} Sell: {pair['rateSell']}")
WordPress (PHP) — Transient-Cached Rate Lookup
function globus_get_exchange_rates( $base = 'USD' ) {
$cache_key = 'exchange_rates_' . strtolower( $base );
$cached = get_transient( $cache_key );
if ( false !== $cached ) {
return $cached;
}
$response = wp_remote_get(
'https://api.globus.studio/v2/currencies?base=' . urlencode( $base ) . '&format=json'
);
$rates = json_decode( wp_remote_retrieve_body( $response ), true );
set_transient( $cache_key, $rates, 60 ); // 60s matches API refresh cycle
return $rates;
}
// Convert a USD price to EUR using the sell rate:
function globus_convert_price( $amount, $from = 'USD', $to = 'EUR' ) {
$rates = globus_get_exchange_rates( $from );
foreach ( $rates as $pair ) {
if ( $pair['currencyCodeA'] === $to ) {
return round( $amount / $pair['rateSell'], 2 );
}
}
return $amount;
}
echo globus_convert_price( 100, 'USD', 'EUR' );
Node.js — Rate Polling Loop
const fetch = require('node-fetch');
async function pollRates(base = 'USD', onUpdate) {
const res = await fetch(
`https://api.globus.studio/v2/currencies?base=${base}&format=json`
);
const rates = await res.json();
onUpdate(rates);
}
// Poll every 60 seconds — matching the API's refresh cycle
setInterval(() => {
pollRates('USD', rates => {
console.log('Rates updated at', new Date().toISOString());
// update in-memory rate cache, notify subscribers, recalculate prices
});
}, 60_000);
Data Freshness and the One-Minute Refresh Cycle
Foreign exchange markets operated by institutions such as the Bank for International Settlements trade over $7 trillion per day, with rates moving continuously during the global trading session. A rate that was accurate at 09:00 UTC may be meaningfully different by 09:05 during high-volatility periods — major data releases or central bank statements can move major pairs by hundreds of pips within seconds. The API’s one-minute refresh cycle provides the maximum practical freshness achievable without crossing into tick-level market data territory, making it appropriate for all commercial applications that do not require sub-second rate precision.
Applications should align their own caching TTL with this refresh cycle — there is no benefit to calling the API more frequently than once per minute, as the underlying data will not have changed. The WordPress and Node.js examples above both implement this correctly.
Performance
At 2ms average latency, the Exchange Rate API returns a full structured JSON payload fast enough for synchronous use in server-side rendering, checkout price calculation, and API gateway middleware. For applications with high request volumes, a single shared cache per base currency — refreshed once per minute — reduces origin API calls to a negligible rate while ensuring every user sees rates no more than 60 seconds old.
Test live rates and review the full response schema on the Exchange Rate API documentation page.