API to Get the Jordanian Dinar (JOD) Price via a REST endpoint

Metals-API 8 min read
API to Get the Jordanian Dinar (JOD) Price via a REST endpoint

You need the live Jordanian Dinar (JOD) price you can hit from a REST endpoint—so you can price a product in Amman, convert settlements for a Jordan-facing desk, or normalize metals quotes into JOD for downstream analytics. In this guide you’ll fetch the current JOD price, read USD per JOD (USDJOD) directly, and query historical and time-series data you can cache and chart.

What you’ll build: live JOD and USDJOD from a single REST call

Metals-API exposes currency and metals prices over a simple JSON interface. For JOD, you typically need both directions:

Illustration: API to Get the Jordanian Dinar (JOD) Price via a REST endpoint
  • rates.JOD — JOD per 1 USD
  • rates.USDJOD — USD per 1 JOD (the inverse)

The Latest endpoint returns both in the same payload when you pass them in the symbols list. You’ll then use Historical or Time-Series for backfills, daily VaR inputs, or charting.

If you’re integrating metals priced per troy ounce and then converting to JOD, keep units straight: metals are quoted “per troy ounce” by default, while fiat currency pairs like JOD/ USD don’t carry a weight unit.

Symbols you’ll use and what they mean

Symbol Meaning How to use it
JOD JOD per 1 USD, when base is USD Multiply a USD amount by rates.JOD to get JOD
USDJOD USD per 1 JOD (inverse of JOD when base is USD) Multiply a JOD amount by rates.USDJOD to get USD
USD Included for reference in some responses Confirms base or round-trip conversions

For a complete catalog of supported symbols beyond JOD, see the Metals-API Supported Symbols.

Fetch the current JOD price: Latest endpoint

The Latest endpoint returns the most recent rates. Depending on your plan, the refresh interval may be every 60 minutes, every 10 minutes, or faster. The base currency defaults to USD; we’ll keep base=USD so JOD means JOD per 1 USD, and we’ll also request USDJOD for the inverse.

cURL request

curl "https://metals-api.com/api/latest?access_key=YOUR_API_KEY&base=USD&symbols=JOD,USDJOD"

Official JSON response example

{"success":true,"timestamp":1793059740,"date":"2026-10-27","base":"USD","rates":{"JOD":0.709035,"USD":1,"USDJOD":1.4103676123181508}}

What these fields mean for your code

  • success: Boolean indicating request status.
  • timestamp: Unix epoch (seconds). Treat as UTC.
  • date: Calendar date aligned to the timestamp.
  • base: The base currency. Here it’s “USD”.
  • rates.JOD: JOD per 1 USD. Example: 1 USD ≈ 0.709035 JOD.
  • rates.USDJOD: USD per 1 JOD (the inverse). Example: 1 JOD ≈ 1.4103676 USD.

Choose the direction that matches your calculation to avoid adding your own inversion step and potential rounding drift.

Use it in code (Python)

This snippet calls the same Latest endpoint, then demonstrates common computations: converting a USD invoice to JOD and a JOD cash amount back to USD using the two rate fields provided.

import os
import requests
from decimal import Decimal, ROUND_HALF_UP

API_KEY = os.getenv("METALS_API_KEY", "YOUR_API_KEY")
URL = "https://metals-api.com/api/latest"

params = {
    "access_key": API_KEY,
    "base": "USD",
    "symbols": "JOD,USDJOD"
}

resp = requests.get(URL, params=params, timeout=10)
resp.raise_for_status()
data = resp.json()

if not data.get("success"):
    raise RuntimeError(f"Metals-API error: {data}")

ts = data["timestamp"]             # Unix seconds (UTC)
date = data["date"]                # e.g., '2026-10-27'
base = data["base"]                # 'USD'
jod_per_usd = Decimal(str(data["rates"]["JOD"]))
usd_per_jod = Decimal(str(data["rates"]["USDJOD"]))

# Convert 1,500.00 USD to JOD
usd_amount = Decimal("1500.00")
jod_amount = (usd_amount * jod_per_usd).quantize(Decimal("0.001"), rounding=ROUND_HALF_UP)

# Convert 10,000.000 JOD to USD using USDJOD (avoid manual inversion)
jod_amount_2 = Decimal("10000.000")
usd_amount_2 = (jod_amount_2 * usd_per_jod).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)

print(f"Timestamp: {ts} (UTC), Date: {date}, Base: {base}")
print(f"1 USD = {jod_per_usd} JOD")
print(f"1 JOD = {usd_per_jod} USD")
print(f"{usd_amount} USD -> {jod_amount} JOD")
print(f"{jod_amount_2} JOD -> {usd_amount_2} USD")

Notes:

  • Use Decimal to control rounding for financial calculations.
  • Quantize to your accounting precision (e.g., 3 decimals for JOD if your ledger requires it).
  • Always prefer the direct rate provided (USDJOD) instead of 1 / JOD for better numeric stability.

Historical and time-series JOD for charts, backfills, and analytics

Two endpoints matter most when you need history:

  • Historical Rates: a single past date for point-in-time valuation (e.g., EOD revaluation or backdated invoices).
  • Time-Series: a date range for charting and analytics (e.g., rolling correlations, drawdowns).

Both accept the same symbols pattern you used for Latest. For full parameter details (e.g., date formats, available ranges), refer to the Metals-API Documentation.

Example: request a single historical JOD fixing

curl "https://metals-api.com/api/2026-09-30?access_key=YOUR_API_KEY&base=USD&symbols=JOD,USDJOD"

Use this for backdated pricing or when you must value a position as of a prior date.

Example: pull a time series for a chart

curl "https://metals-api.com/api/timeseries?access_key=YOUR_API_KEY&base=USD&start_date=2026-09-01&end_date=2026-10-27&symbols=JOD,USDJOD"

Return values will be keyed by date. For visualization, consume rates.JOD (JOD per USD) or rates.USDJOD (USD per JOD) based on which side you want on the y-axis.

Practical details that save you time

  • Base currency: Responses default to base=USD. With base=USD, rates.JOD is JOD per 1 USD, and rates.USDJOD is USD per 1 JOD. Avoid changing the base unless you have a clear reason; it simplifies cross-multiplications with metals quotes, which also default to USD.
  • Timestamps and timezone: timestamp is Unix epoch (seconds) and should be interpreted as UTC. date is the corresponding calendar date. Persist both for traceability in ledgers and audits.
  • Update cadence: The Latest endpoint updates at different intervals depending on your plan (e.g., 60 minutes or 10 minutes). Cache responses locally until the next expected refresh to minimize calls and keep deterministic results across a batch.
  • Weekends and closures: Fiat FX markets exhibit reduced liquidity on weekends and holidays. If you query dates with no trading, expect the most recent available fixing for that period. In charts, you may see flat lines across non-trading days; handle that explicitly in your UI so it doesn’t look like missing data.
  • Precision and rounding: When converting amounts, match your accounting policy. JOD is typically expressed to three decimal places in some systems; confirm your product requirements. Use Decimal in Python or Big.js/Decimal.js in JavaScript.
  • Symbols hygiene: Always fetch only the symbols you need (e.g., JOD, USDJOD) to keep payloads small and predictable. The canonical list is at the Symbols page.
  • Error handling: Check success in the JSON. On failure, log the full response and your query params (minus your key) to troubleshoot quickly.
  • Metals and currencies together: If you’re pricing metals in JOD, first take the metal rate (typically per troy ounce and relative to USD), then multiply by USDJOD to convert to JOD. Keep unit labels in your UI so users don’t confuse per-oz quotes with fiat pair quotes.

Beyond FX: pricing neodymium and other metals in JOD

If you’re modernizing procurement or building smart dashboards for manufacturing, you might combine fiat FX with industrial metals like neodymium (ND). A frequent pattern is:

  • Fetch the metal’s USD-based rate (quoted per troy ounce by default).
  • Fetch rates.USDJOD to convert USD valuations into JOD for regional reporting or supplier contracts.
  • Apply analytics (e.g., moving averages, volatility bands) and alert thresholds within your ERP or trading tools.

This pairing—API-first FX plus metals—supports digital transformation in commodities workflows, where teams stitch together real-time data, historical context, and automated decisioning. You can find endpoint specifics for metals as well as JOD in the Documentation.

Deployment tips for production

  • Key management: Store your API key in a secure secrets manager. Avoid embedding keys in client-side code.
  • Batch windows: If you run hourly or 10-minute batches, align them a few seconds after the documented refresh granularity to avoid pulling an unchanged tick.
  • Idempotency: Persist the timestamp you processed. If a job retries, skip duplicate timestamps to prevent double-booking a revaluation.
  • Backfills: Use Time-Series for large spans rather than looping Historical by day. It reduces request overhead and simplifies retries.
  • Resilience: Wrap calls with timeouts and a small retry budget. If your job can tolerate it, fall back to the last cached good payload until the next refresh window.

Reference links and further reading

FAQ

Q: What’s the difference between rates.JOD and rates.USDJOD?
A: With base=USD, rates.JOD means JOD per 1 USD; rates.USDJOD is USD per 1 JOD. Use whichever direction matches your conversion to avoid inverting yourself.

Q: How often does the JOD rate update?
A: The Latest endpoint refresh interval depends on your plan (for example, every 60 minutes or every 10 minutes). Cache until the next expected refresh to avoid redundant calls.

Q: What timezone are timestamps in?
A: timestamp is a Unix epoch in UTC. The date field corresponds to that timestamp. Log both for audit trails.

Q: How do I convert a USD metals price per troy ounce into JOD?
A: Multiply the USD-per-oz metal price by rates.USDJOD to get JOD-per-oz. Keep the “per troy ounce” label in your UI so users don’t confuse metal units with currency pairs.

Q: How should I handle weekends and holidays?
A: Expect fewer or no new ticks across closures. Historical and Time-Series may return the most recent available fixing for those dates. In charts, you can omit non-trading days or carry forward last values with a visual cue.

Ready to integrate JOD into your pricing, trading, or ERP workflows? Start by creating your API key here: Register. If you need deployment help, SLAs, or white-glove onboarding, explore the MCP program.