FX Rates

Here we walk you through our public FX endpoints so you can quote, price, and chart currencies with just a few lines of code. Whether you're building a fintech app, e-commerce platform, or financial dashboard, our API provides enterprise-grade FX data with developer-friendly simplicity.

Base URL
https://api.due.network/fx

No authentication required for read-only endpoints, but requests are rate-limited. Please cache responses where possible to optimize performance.



Key Concepts & Definitions

TermDefinition
Base CurrencyThe first currency in a pair (e.g., USD in USD/EUR). Represents what you're buying, with the rate showing how much quote currency needed for one unit.
Quote CurrencyThe second currency in a pair (e.g., EUR in USD/EUR). Shows the price of one unit of base currency.
Markup (bps)Fee added to mid-market rate in basis points (1 bps = 0.01%). A 18 bps markup = 0.18% fee, already included in ask rates.
Ask RateRate to buy base currency with quote currency. All API rates are ask rates (inclusive of markup) for conversion quotes.
Bid RateRate to sell base currency for quote currency. Get bid rates by requesting the reverse pair's ask rate.

Market Coverage & Rate Structure

Direct Rates Available

Direct rates are provided only with either of these major currencies:

  • USD (US Dollar)
  • EUR (Euro)
  • USDC (USD Coin)
  • USDT (Tether)
  • EURC (Euro Coin)

Cross-Rate Handling

For currency pairs not directly available (e.g., GBP/JPY, MXN/CAD):

  • Single market requests: Returns computed cross-rates automatically
  • Quote endpoint: Calculates optimal routing and final conversion
  • Historical data: Retrieve constituent pairs separately (e.g., for MXN/EUR history, get MXN/USD and USD/EUR)

Rate Display Best Practices

When rates return very small decimals (< 0.01), consider showing the reverse rate for better readability:

# For currencies like NGN, ARS, KRW, TZS
if rate < 0.01:
    display_rate = f"1 {quote_currency} = {1/rate:.2f} {base_currency}"
else:
    display_rate = f"1 {base_currency} = {rate:.4f} {quote_currency}"

API Endpoints Overview

MethodEndpointPurposeRate Limit
GET/marketsAll tradable pairs with live ask rates60/min
GET/markets/{base}/{quote}Single pair live ask rate120/min
GET/markets/{base}/{quote}/historyHistorical ask rates30/min
POST/quoteExecutable FX quote with firm pricing100/min

All currency codes followISO-4217 standard (USD, EUR, GBP, etc.)


1️⃣ List All Markets

Get every available currency pair with current ask rates in one request.

GET /fx/markets

Example Request

curl -s https://api.due.network/fx/markets | jq .

Sample Response

[
  {
    "pair": { "base": "USD", "quote": "EUR" },
    "rate": 0.91342,
    "markupBps": 18,
    "updatedAt": "2025-07-19T10:04:12Z"
  },
  {
    "pair": { "base": "GBP", "quote": "JPY" },
    "rate": 184.25,
    "markupBps": 18,
    "updatedAt": "2025-07-19T10:04:12Z"
  }
]

Response Fields

FieldTypeDescription
pair.basestringBase currency code
pair.quotestringQuote currency code
ratenumberAsk rate inclusive of markup
markupBpsintegerMarkup in basis points
updatedAtstringLast update timestamp (UTC, RFC 3339)

2️⃣ Get Single Market Rate

Fetch the live ask rate for any supported currency pair.

GET /fx/markets/{base}/{quote}

Example - British Pound to Japanese Yen

curl -s https://api.due.network/fx/markets/GBP/JPY | jq .

This tells you how many Japanese yen you need to buy one British pound (ask rate with markup included).

Cross-Rate Example - Mexican Peso to Euro

curl -s https://api.due.network/fx/markets/MXN/EUR | jq .

Even though MXN/EUR isn't a direct market, our API automatically calculates the cross-rate via USD routing.

Response structure matches single market object from /markets endpoint.


3️⃣ Historical Price Data

Retrieve historical ask rates with customizable sampling intervals.

GET /fx/markets/{base}/{quote}/history?interval={minutes}

Query Parameters

ParameterDefaultDescription
interval15Sampling period in minutes

Common Intervals

  • 1 - 1-minute (intraday trading)
  • 5 - 5-minute (short-term analysis)
  • 15 - 15-minute (default, balanced detail)
  • 60 - 1-hour (daily monitoring)
  • 1440 - Daily (long-term trends)

Example - EUR/USD 15-minute candles

curl -s "https://api.due.network/fx/markets/EUR/USD/history?interval=15" | jq .

Sample Response

[
  { "date": "2025-07-19T09:45:00Z", "rate": 1.0976 },
  { "date": "2025-07-19T10:00:00Z", "rate": 1.0979 },
  { "date": "2025-07-19T10:15:00Z", "rate": 1.0982 }
]

📈 Cross-Rate Historical Data

For cross-rate history (e.g., MXN/EUR), retrieve constituent pairs separately:

import requests

BASE = "https://api.due.network/fx"

# Get MXN/USD and USD/EUR history
mxn_usd = requests.get(f"{BASE}/markets/MXN/USD/history?interval=60").json()
usd_eur = requests.get(f"{BASE}/markets/USD/EUR/history?interval=60").json()

# Calculate MXN/EUR cross-rate for each timestamp
# MXN/EUR = MXN/USD * USD/EUR
cross_rates = []
for mxn_data, eur_data in zip(mxn_usd, usd_eur):
    if mxn_data["date"] == eur_data["date"]:
        cross_rate = mxn_data["rate"] * eur_data["rate"]
        cross_rates.append({
            "date": mxn_data["date"],
            "rate": cross_rate
        })

4️⃣ Create Executable Quote

Generate firm, tradable prices with 30-second validity. Perfect for checkout flows and real-time conversions.

POST /fx/quote
Content-Type: application/json

Request Body

ParameterTypeRequiredDescription
currencyInstringSource currency (what you're paying)
currencyOutstringTarget currency (what you'll receive)
amountInstring✳️Input amount to convert
amountOutstring✳️Desired output amount

✳️ Provide exactly one ofamountIn or amountOut

Example 1 - Convert $1,000 USD to EUR

curl -X POST https://api.due.network/fx/quote \
     -H "Content-Type: application/json" \
     -d '{
           "currencyIn": "USD",
           "currencyOut": "EUR", 
           "amountIn": "1000"
         }' | jq .

Example 2 - Need exactly €500 EUR from USD

curl -X POST https://api.due.network/fx/quote \
     -H "Content-Type: application/json" \
     -d '{
           "currencyIn": "USD",
           "currencyOut": "EUR",
           "amountOut": "500"
         }' | jq .

Sample Response

{
  "currencyIn": "USD",
  "currencyOut": "EUR", 
  "amountIn": "1000",
  "amountOut": "913.42",
  "rate": 0.91342,
  "markupBps": 18,
  "createdAt": "2025-07-19T10:05:22Z",
  "expiresAt": "2025-07-19T10:05:52Z"
}

Response Fields

FieldDescription
rateExecutable ask rate used for calculation
markupBpsMarkup included in rate
createdAtQuote generation timestamp