Home Documentation Playground Pricing API Status Blog About FAQ Support

API Documentation

Everything you need to integrate real-time currency exchange rates into your application.

Get Free API Key → Quickstart Guide

Quickstart — Get Started in < 2 Minutes

  1. Sign up free or Log in → Get your API key from the profile page
  2. Copy your API key
  3. Try this request:
curl "https://allratestoday.com/api/v1/rates?source=USD&target=EUR" \
  -H "Authorization: Bearer YOUR_API_KEY"

Don't have an account? Create one for free.

Overview

The AllRatesToday API provides real-time and historical currency exchange rates via a simple REST interface. All responses are JSON. The base URL is:

https://allratestoday.com

We offer multiple plans with varying rate limits. All endpoints require authentication via API key. See our pricing page for details.

Authentication

All API endpoints require authentication. Include your API key as a Bearer token:

Authorization: Bearer YOUR_API_KEY

Get your API key from your profile page after signing in.

Security

The AllRatesToday API is designed with security as a first-class concern. This section explains the transport, authentication, and data-handling guarantees you can rely on, plus the responsibilities that sit on your side as an integrator.

Transport (TLS / HTTPS)

  • All API traffic must be sent over HTTPS. Plain-text HTTP requests are permanently redirected (301) to HTTPS but should never be used for API calls — the redirect leaks your API key via the initial request.
  • We require TLS 1.2 or higher. Connections using older TLS versions (1.0, 1.1) or SSLv3 are rejected at the edge.
  • Certificates are issued by publicly-trusted CAs and automatically renewed. HSTS is enforced with max-age=31536000; includeSubDomains.

Authentication

  • Authentication uses a Bearer token in the Authorization header — no query-string keys (which get logged by proxies, CDNs, and browser history).
  • Every API key is scoped to one account and can be rotated or revoked instantly from your profile page.
  • Keys are stored server-side as hashed values — even we cannot read your key after you generate it. If lost, generate a new one.
  • Live keys are prefixed with art_live_, test keys with art_test_. This makes accidental logging easier to spot.

API key handling (your responsibilities)

Never embed your API key in client-side code. Browsers, mobile apps, and any compiled binary can be decompiled. A key shipped to the browser is a public key — expect it to be scraped within hours.
  • Server-side only. Call the AllRatesToday API from your backend. Proxy the result to your frontend.
  • Use environment variables (process.env.ART_API_KEY). Never commit keys to git, never include them in container images.
  • Rotate keys periodically — at minimum every 90 days, and immediately if a key is ever exposed in logs, commits, or error reports.
  • Use one key per service. When a key leaks, you can revoke just that environment instead of rotating everything.

Abuse protection

  • Rate limiting is applied per API key (see Rate Limits). Exceeding the limit returns 429 Too Many Requests; it does not leak usage data to other keys.
  • WAF & DDoS: requests are filtered by Cloudflare's edge network, which applies OWASP Top 10 mitigations automatically. Malformed or abusive requests are rejected before reaching the API.
  • Automated monitoring flags anomalous usage patterns (e.g. sudden 100× spikes) and can lock a key pending verification.

Data handling & privacy

  • We log request metadata (timestamp, endpoint, status code, rate-limit counters) but never the response payload. Rate data is public.
  • We do not collect or store any personal data you send in query strings — but please don't send any: all the API needs is currency codes and optional date parameters.
  • Access logs are retained for 30 days for debugging and abuse investigation, then permanently deleted.
  • AllRatesToday is operated from the UK and complies with UK GDPR. See the privacy policy for the full data-handling statement.

Reporting a vulnerability

If you believe you have found a security issue in the AllRatesToday API, please report it privately to support@allratestoday.com. Please do not disclose the issue publicly (on GitHub, Twitter, blog posts, etc.) until we have had a reasonable chance to respond.

We aim to acknowledge reports within 24 hours and provide a remediation timeline within 72 hours. Responsible disclosure is credited publicly after the fix is deployed (if you want to be named).

Rate Limits

Rate Limit Headers All responses include rate limit headers: X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. Monthly usage headers are also included: X-Monthly-Limit, X-Monthly-Used, and X-Monthly-Resets.

Rate limits vary by plan. When you exceed your monthly limit, the API returns a 429 status with details about your usage and when the limit resets. A warning email is sent when you reach 90% of your monthly limit. View plans and pricing

// Example 429 response when limit exceeded
{
  "error": "Monthly request limit exceeded",
  "used": 5000,
  "limit": 5000,
  "plan": "small",
  "resets_at": "2026-05-01T00:00:00.000Z",
  "upgrade_url": "https://allratestoday.com/pricing"
}

Authenticated Rates

GET /api/v1/rates

Authenticated endpoint with higher rate limits. Requires a Bearer token.

ParameterTypeDescription
sourceoptional string Source currency code (e.g. USD)
targetoptional string Target currency code (e.g. EUR). Supports comma-separated values for multiple targets (e.g. EUR,GBP,JPY)
timeoptional ISO 8601 Rate at a specific point in time
fromoptional YYYY-MM-DD Start date for historical range
tooptional YYYY-MM-DD End date for historical range
groupoptional string Group by: day, hour, minute
amountoptional number Amount to convert (default: 1). The response rate is always per unit; use this for display convenience.

Example:

curl "https://allratestoday.com/api/v1/rates?source=USD&target=EUR" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response:

[
  {
    "rate": 0.9215,
    "source": "USD",
    "target": "EUR",
    "time": "2026-04-03T12:00:00Z"
  }
]

Simple Rate

GET /api/rate

Lightweight endpoint for fetching a single pair rate.

ParameterTypeDescription
sourcerequired string Source currency code
targetrequired string Target currency code
curl "https://allratestoday.com/api/rate?source=GBP&target=USD"
{ "rate": 1.2634, "source": "refinitiv" }
What does "source": "refinitiv" mean? The source field in the response indicates the data provider. AllRatesToday delivers mid-market exchange rates sourced from Refinitiv (Reuters) and interbank market feeds — the same institutional-grade data used by banks and financial platforms worldwide, without any retail markup.

Convert

GET /api/v1/rates

Convert a specific amount from one currency to another. Optionally convert at a historical date.

ParameterTypeDescription
sourcerequired string Source currency code (e.g. USD)
targetrequired string Target currency code (e.g. EUR)
amountrequired number Amount to convert

Example — Convert $1,000 to EUR:

curl "https://allratestoday.com/api/v1/rates?source=USD&target=EUR&amount=1000" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response:

{
  "from": { "currency": "USD", "amount": 1000 },
  "to": { "currency": "EUR", "amount": 923.4 },
  "rate": 0.9234,
  "source": "refinitiv"
}

SDK example:

// JavaScript
const result = await client.convert('USD', 'EUR', 1000);
console.log(`$1,000 = €${result.result}`);  // $1,000 = €923.4

// Historical conversion
const past = await client.convert('USD', 'EUR', 1000, { date: '2026-01-15' });
console.log(`Rate on Jan 15: ${past.rate}`);
# Python
result = client.convert("USD", "EUR", 1000)
print(f"$1,000 = €{result['result']}")

Historical Rates

GET /api/historical-rates Auth Required

Fetch historical exchange rate data for charting and analysis. Requires an API key.

ParameterTypeDescription
sourcerequired string Source currency code
targetrequired string Target currency code
periodoptional string 1d, 7d, 30d, or 1y (default: 7d)
curl "https://allratestoday.com/api/historical-rates?source=USD&target=EUR&period=30d" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "source": "USD",
  "target": "EUR",
  "data": [
    { "date": "2026-03-04", "rate": 0.9198, "timestamp": 1741046400000 },
    { "date": "2026-03-05", "rate": 0.9210, "timestamp": 1741132800000 }
  ],
  "source_api": "refinitiv",
  "period": "30d"
}

Time Series

GET /api/historical-rates

Fetch exchange rates across a custom date range. Returns rates grouped by date — ideal for charts, reports, and trend analysis.

ParameterTypeDescription
sourcerequired string Source currency code (e.g. USD)
targetrequired string Target currency code (e.g. EUR)
fromrequired YYYY-MM-DD Start date of the range
torequired YYYY-MM-DD End date of the range

Example — USD/EUR for Q1 2026:

curl "https://allratestoday.com/api/historical-rates?source=USD&target=EUR&from=2026-01-01&to=2026-03-31" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response:

{
  "source": "USD",
  "target": "EUR",
  "data": [
    { "date": "2026-01-01", "rate": 0.9187, "timestamp": 1735689600000 },
    { "date": "2026-01-02", "rate": 0.9195, "timestamp": 1735776000000 },
    ...
  ],
  "source_api": "refinitiv",
  "period": "custom"
}

SDK example:

// JavaScript — custom date range
const data = await client.timeSeries('2026-01-01', '2026-03-31', {
  base: 'USD',
  symbols: ['EUR', 'GBP'],
});

// Rates grouped by date
console.log(data.rates['2026-01-15']);
// { EUR: 0.9187, GBP: 0.7834 }

// Also supports Date objects
const data = await client.timeSeries(
  new Date('2026-01-01'),
  new Date('2026-03-31')
);
Tip For preset periods (1d, 7d, 30d, 1y) without specifying exact dates, use the Historical Rates endpoint with the period parameter instead.

Symbols

GET /api/v1/symbols

Get all supported currency codes and their full names. Use this to build currency dropdowns and selectors in your UI.

curl "https://allratestoday.com/api/v1/symbols"

No authentication required. Response is cached for 24 hours.

Response:

{
  "currencies": [
    { "code": "USD", "name": "US Dollar", "symbol": "$" },
    { "code": "EUR", "name": "Euro", "symbol": "€" },
    { "code": "GBP", "name": "British Pound", "symbol": "£" },
    { "code": "JPY", "name": "Japanese Yen", "symbol": "¥" },
    ...
  ],
  "count": 48
}

SDK example:

// JavaScript — build a currency dropdown
const data = await fetch('https://allratestoday.com/api/v1/symbols').then(r => r.json());
const options = data.currencies.map(c => ({
  value: c.code,
  label: `${c.code} — ${c.name}`,
}));

// React example
<select>
  {options.map(o => <option key={o.value} value={o.value}>{o.label}</option>)}
</select>
# Python
import requests
data = requests.get("https://allratestoday.com/api/v1/symbols").json()
for c in data["currencies"]:
    print(f"{c['code']}: {c['name']} ({c['symbol']})")

MCP Server

The @allratestoday/mcp-server package lets AI coding tools — Claude Code, Cursor, Claude Desktop, and ChatGPT Desktop — call the AllRatesToday API directly using the Model Context Protocol. Once configured, your assistant gets four new tools without any extra prompt engineering.

Install

Claude Code

claude mcp add allratestoday -- npx -y @allratestoday/mcp-server
claude mcp env allratestoday ALLRATES_API_KEY=art_live_xxxxx

Cursor, Claude Desktop, or ChatGPT Desktop — add the block below to your MCP config (~/.cursor/mcp.json or the desktop app's claude_desktop_config.json). Restart the client after editing.

{
  "mcpServers": {
    "allratestoday": {
      "command": "npx",
      "args": ["-y", "@allratestoday/mcp-server"],
      "env": { "ALLRATES_API_KEY": "art_live_xxxxx" }
    }
  }
}

Tools exposed

ToolAPI key?What it does
get_exchange_ratenoCurrent mid-market rate between two currencies.
get_historical_ratesyesTime series over 1d, 7d, 30d, or 1y.
get_rates_authenticatedyesMulti-target rates and higher limits via /api/v1/rates.
list_currenciesnoAll supported currencies with codes, names, and symbols.

Environment variables

VariableRequired?Purpose
ALLRATES_API_KEYOnly for get_rates_authenticatedBearer token like art_live_xxxxx from your dashboard.
ALLRATES_BASE_URLNoOverride to point at a staging or self-hosted deployment.

Example prompts

  • "What's the USD to EUR rate right now?"
  • "Show me GBP/JPY over the last 30 days."
  • "Convert 2,500 USD to Indian rupees."
  • "List every supported currency."
  • "What's happening in FX markets today?"

Troubleshooting

  • Client doesn't see the tools: restart the MCP client after editing config. Claude Desktop caches the server list.
  • command not found: npx: install Node.js 18+ — npx ships with it.
  • Auth-required tool failing: double-check your ALLRATES_API_KEY. Public tools work without one — test those first to confirm connectivity.

Full setup docs: /docs/mcp-server/. Source & issues: github.com/cahthuranag/mcp-server. Feature overview: /mcp/.

DeepSeek Integration

The Python package allratestoday-deepseek plugs AllRatesToday tools into any deepseek-chat or deepseek-reasoner conversation via OpenAI-compatible function calling.

pip install allratestoday-deepseek
export DEEPSEEK_API_KEY=sk-xxxxx
allratestoday-deepseek --ask "Convert 2500 USD to EUR."

Library usage

from allratestoday_deepseek import DeepSeekCurrencyAgent

with DeepSeekCurrencyAgent() as agent:
    print(agent.ask("How many Japanese Yen is 500 Swiss Francs?"))

Same four tools as the MCP server, plus a dedicated convert_currency tool that fetches the pair rate and multiplies the amount. See the /deepseek/ landing page for details.

LLM Discovery

For browsing-enabled LLMs that don't use MCP or a Custom GPT, AllRatesToday publishes an llms.txt that tells agents exactly which endpoint to call for a live rate:

GET https://allratestoday.com/api/rate?source=USD&target=EUR
# Response: {"rate": 0.92145, "source": "refinitiv"}

This endpoint is public — no API key, no headers. It's safe to mention in user-facing prompts because it won't leak credentials.

Landing pages under /currency-converter/{from}-to-{to}-rate/ additionally expose a schema.org/ExchangeRateSpecification microdata block with the current rate, so LLM browsers can extract a numeric value without calling the API at all.

React Currency Localizer

Automatically display prices in your user's local currency using IP geolocation. Zero runtime dependencies, intelligent caching, and graceful fallbacks.

npm install react-currency-localizer-realtime

How It Works

StepServiceCacheDescription
1. Detect currency ipapi.co (free, no key) 24h (localStorage) Detects user's local currency from their IP address
2. Fetch rate AllRatesToday API 1h (memory) Gets real-time mid-market exchange rate
3. Convert & display Browser (Intl API) Formats the converted price with currency symbol
Performance First load: 2 API calls. Subsequent loads: 0–1 calls (geo cached). Batch conversion: 1000+ prices in <1ms. Bundle: ~10KB minified (~4KB gzipped). Zero runtime dependencies.

useCurrencyConverter()

HOOK useCurrencyConverter(options)

Convert a single price to the user's local currency. Handles geolocation, rate fetching, caching, and error states automatically.

ParameterTypeDescription
basePricerequired number The price in your base currency
baseCurrencyrequired string ISO 4217 currency code (case-insensitive, e.g. USD or usd)
apiKeyrequired string Your AllRatesToday API key
manualCurrencyoptional string Override auto-detected currency
geoEndpointoptional string Custom geolocation endpoint URL
onSuccessoptional function Callback on successful conversion
onErroroptional function Callback on error

Returns:

PropertyTypeDescription
convertedPricenumber | nullPrice in the user's local currency
localCurrencystring | nullDetected or manual currency code
baseCurrencystringOriginal base currency
exchangeRatenumber | nullExchange rate used
isLoadingbooleanTrue while fetching
errorError | nullError object if failed

Example:

import { useCurrencyConverter } from 'react-currency-localizer-realtime';

function ProductPrice({ price }) {
  const { convertedPrice, localCurrency, isLoading, error } = useCurrencyConverter({
    basePrice: price,
    baseCurrency: 'USD',
    apiKey: 'YOUR_API_KEY',
  });

  if (isLoading) return <span>Loading...</span>;
  if (error) return <span>${price}</span>; // Fallback

  return (
    <span>
      {new Intl.NumberFormat(undefined, {
        style: 'currency',
        currency: localCurrency || 'USD',
      }).format(convertedPrice || price)}
    </span>
  );
}

useCurrencyLocalizer() — Batch Conversion

HOOK useCurrencyLocalizer(options)

Convert multiple prices efficiently with a single exchange rate lookup. Returns convert(), format(), and convertAndFormat() functions.

ParameterTypeDescription
baseCurrencyrequired string ISO 4217 currency code
apiKeyrequired string Your AllRatesToday API key
manualCurrencyoptional string Override detected currency
onReadyoptional function Callback when converter is ready
onErroroptional function Callback on error

Returns:

PropertyTypeDescription
convert(price)number | nullConvert a single price
format(price)stringFormat with currency symbol
convertAndFormat(price)stringConvert + format in one call
isReadybooleanTrue when ready to convert
isLoadingbooleanTrue while fetching
localCurrencystring | nullDetected currency
exchangeRatenumber | nullRate used
errorError | nullError if any

Example — Product list:

import { useCurrencyLocalizer } from 'react-currency-localizer-realtime';

function ProductList({ products }) {
  const { convertAndFormat, isReady } = useCurrencyLocalizer({
    baseCurrency: 'USD',
    apiKey: 'YOUR_API_KEY',
  });

  return (
    <ul>
      {products.map(p => (
        <li key={p.id}>
          {p.name}: {isReady ? convertAndFormat(p.price) : '...'}
        </li>
      ))}
    </ul>
  );
}

Example — Pricing table:

function PricingTable() {
  const plans = [
    { name: 'Basic', price: 9.99 },
    { name: 'Pro', price: 19.99 },
    { name: 'Enterprise', price: 49.99 },
  ];

  const { convertAndFormat, isReady } = useCurrencyLocalizer({
    baseCurrency: 'USD',
    apiKey: 'YOUR_API_KEY',
  });

  return (
    <div>
      {plans.map(plan => (
        <div key={plan.name}>
          <h3>{plan.name}</h3>
          <p>{isReady ? convertAndFormat(plan.price) : '...'}/month</p>
        </div>
      ))}
    </div>
  );
}

<LocalizedPrice /> Component

COMPONENT <LocalizedPrice />

Drop-in React component that displays a price converted to the user's local currency. Handles loading, errors, and formatting automatically.

PropTypeDescription
basePricerequired number Price in base currency
baseCurrencyrequired string ISO 4217 code (case-insensitive)
apiKeyrequired string Your AllRatesToday API key
manualCurrencyoptional string Override detected currency
loadingComponentoptional ReactNode Custom loading UI
errorComponentoptional function Custom error UI (receives error, basePrice, baseCurrency). If not provided, shows original price as fallback.
formatPriceoptional function Custom formatter: (price, currency) => string

Basic usage:

import { LocalizedPrice } from 'react-currency-localizer-realtime';

// Simple — auto-detects currency, shows fallback on error
<LocalizedPrice basePrice={99.99} baseCurrency="USD" apiKey="YOUR_API_KEY" />

Custom format:

// Custom formatting for subscription pricing
<LocalizedPrice
  basePrice={19.99}
  baseCurrency="USD"
  apiKey="YOUR_API_KEY"
  formatPrice={(price, currency) => `${currency} ${price.toFixed(2)}/month`}
/>

Custom loading and error:

<LocalizedPrice
  basePrice={99.99}
  baseCurrency="USD"
  apiKey="YOUR_API_KEY"
  loadingComponent={<span>Converting...</span>}
  errorComponent={(error, basePrice) => (
    <span>${basePrice} <small>(conversion unavailable)</small></span>
  )}
/>

Manual currency with selector:

function CurrencySelector() {
  const [currency, setCurrency] = useState('');

  return (
    <div>
      <select value={currency} onChange={e => setCurrency(e.target.value)}>
        <option value="">Auto-detect</option>
        <option value="USD">USD</option>
        <option value="EUR">EUR</option>
        <option value="GBP">GBP</option>
        <option value="JPY">JPY</option>
      </select>

      <LocalizedPrice
        basePrice={99.99}
        baseCurrency="USD"
        apiKey="YOUR_API_KEY"
        manualCurrency={currency || undefined}
      />
    </div>
  );
}
SSR Note When using with Next.js or other SSR frameworks, IP geolocation runs on the server and detects the server's location. Use manualCurrency for server rendering and auto-detect on the client:
const [isClient, setIsClient] = useState(false);
useEffect(() => setIsClient(true), []);

<LocalizedPrice
  basePrice={99.99}
  baseCurrency="USD"
  apiKey="YOUR_API_KEY"
  manualCurrency={!isClient ? 'USD' : undefined}
/>
Environment Variables Store your API key in environment variables: VITE_ALLRATESTODAY_KEY (Vite) • REACT_APP_ALLRATESTODAY_KEY (CRA) • NEXT_PUBLIC_ALLRATESTODAY_KEY (Next.js)

Error Codes

StatusMeaning
400Bad request — missing or invalid parameters
401Unauthorized — missing or invalid API key
429Rate limit exceeded — check Retry-After header
500Internal server error
503Service temporarily unavailable

Data Freshness

AllRatesToday provides real-time exchange rates sourced from institutional-grade forex data providers including Reuters (Refinitiv) and interbank market feeds. Unlike other providers that update once every 60 minutes, our rates are fetched live on every request, ensuring you always get the most current mid-market rates available.

Real-Time Updates Rates sourced from Reuters (Refinitiv) and interbank market feeds — no delayed or batched updates.

Supported Currencies

160+ currencies including:

Major Currencies USD, EUR, GBP, JPY, CHF, CAD, AUD, NZD
Popular Currencies INR, CNY, BRL, MXN, RUB, TRY, ZAR, SGD, HKD, KRW, THB, PHP, PKR, BDT, LKR, NGN, GHS, KES, AED, SAR, EGP, and more

Full list available via the OpenAPI specification. Prefer clicking around? Try every endpoint live in the API Playground.

Official SDKs

Install our official SDK for your language. All SDKs support free and authenticated endpoints, currency conversion, and historical rates.

JavaScript / TypeScript (npm)

npm install @allratestoday/sdk
import AllRatesToday from '@allratestoday/sdk';

const client = new AllRatesToday({ apiKey: 'art_live_...' });

// Get latest rates (multiple currencies in one call)
const { rates } = await client.latest({ base: 'USD', symbols: ['EUR', 'GBP', 'JPY'] });
console.log(rates); // { EUR: 0.9234, GBP: 0.7891, JPY: 151.42 }

// Convert an amount
const result = await client.convert('USD', 'EUR', 1000);
console.log(`$1,000 = €${result.result}`);

// Historical conversion at a specific date
const past = await client.convert('USD', 'EUR', 1000, { date: '2026-01-15' });

// Rates for a specific date
const data = await client.forDate('2026-01-15', { base: 'EUR', symbols: ['USD', 'GBP'] });

// Time series (custom date range)
const series = await client.timeSeries('2026-01-01', '2026-03-31', {
  base: 'USD', symbols: ['EUR']
});

// List all supported currencies
const { symbols } = await client.symbols();
console.log(symbols); // { USD: 'United States Dollar', EUR: 'Euro', ... }

// Historical rates by period
const history = await client.getHistoricalRates('USD', 'EUR', '30d');

Python (pip)

pip install allratestoday
from allratestoday import AllRatesToday

client = AllRatesToday(api_key="art_live_...")

# Get exchange rate
rate = client.get_rate("USD", "EUR")
print(f"1 USD = {rate['rate']} EUR")

# Convert amount
result = client.convert("USD", "EUR", 1000)
print(f"$1,000 = €{result['result']}")

# Historical rates
history = client.get_historical_rates("USD", "EUR", "30d")

PHP (Composer)

composer require allratestoday/sdk
use AllRatesToday\AllRatesToday;

$client = new AllRatesToday('art_live_...');

// Get exchange rate
$rate = $client->getRate('USD', 'EUR');
echo "1 USD = {$rate['rate']} EUR";

// Convert amount
$result = $client->convert('USD', 'EUR', 1000);
echo "$1,000 = €{$result['result']}";

// Historical rates
$history = $client->getHistoricalRates('USD', 'EUR', '30d');

React (npm)

npm install react-currency-localizer-realtime
import { LocalizedPrice } from 'react-currency-localizer-realtime';

// Automatically detects user's currency via IP geolocation
function PricingCard() {
  return (
    <div>
      <h3>Pro Plan</h3>
      <LocalizedPrice
        basePrice={19.99}
        baseCurrency="USD"
        apiKey="art_live_..."
      />
    </div>
  );
}
import { useCurrencyConverter } from 'react-currency-localizer-realtime';

// Hook-based API for full control
function ProductPrice({ price }) {
  const { convertedPrice, localCurrency, isLoading } = useCurrencyConverter({
    basePrice: price,
    baseCurrency: 'USD',
    apiKey: 'art_live_...',
  });

  if (isLoading) return <span>Loading...</span>;

  return (
    <span>
      {new Intl.NumberFormat(undefined, {
        style: 'currency',
        currency: localCurrency || 'USD',
      }).format(convertedPrice || price)}
    </span>
  );
}
import { useCurrencyLocalizer } from 'react-currency-localizer-realtime';

// Batch conversion for product lists
function ProductList({ products }) {
  const { convertAndFormat, isReady } = useCurrencyLocalizer({
    baseCurrency: 'USD',
    apiKey: 'art_live_...',
  });

  return (
    <ul>
      {products.map(p => (
        <li key={p.id}>{p.name}: {isReady ? convertAndFormat(p.price) : '...'}</li>
      ))}
    </ul>
  );
}

React SDK features: Automatic currency detection via IP geolocation, intelligent caching (24h for geo, 1h for rates), manual currency override, custom formatters, graceful fallbacks, and zero runtime dependencies beyond React.

Code Examples (without SDK)

JavaScript / Node.js

const response = await fetch(
  'https://allratestoday.com/api/v1/rates?source=USD&target=EUR',
  { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const data = await response.json();
console.log(`1 USD = ${data.rate} EUR`);

Python

import requests

response = requests.get(
    'https://allratestoday.com/api/v1/rates',
    params={'source': 'USD', 'target': 'EUR'},
    headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
data = response.json()
print(f"1 USD = {data['rate']} EUR")

PHP

$opts = {'http' => {'header' => 'Authorization: Bearer YOUR_API_KEY'}};
$context = stream_context_create($opts);
$response = file_get_contents(
    'https://allratestoday.com/api/v1/rates?source=USD&target=EUR',
    false, $context
);
$data = json_decode($response, true);
echo "1 USD = " . $data['rate'] . " EUR";

cURL

curl "https://allratestoday.com/api/v1/rates?source=USD&target=EUR" \
  -H "Authorization: Bearer YOUR_API_KEY"

API Playground

Try the API directly from your browser. Enter your API key to test.

GET /api/v1/rates?source=USD&target=EUR&amount=100
Click "Send Request" to see the live response...
OpenAPI Specification Full machine-readable spec available at /openapi.json — use it to auto-generate client libraries, or explore it interactively in the API Playground.

Run in Postman

Fork our Postman collection to quickly test all API endpoints.

Ready to integrate?

Get your free API key and start making requests in seconds.

Get Free API Key