How to Get Real-Time Ukrainian Hryvnia (UAH) Prices with Metals-API for Currency Conversion
Developers building pricing engines, FX modules, and trading tools often need one thing yesterday: real-time Ukrainian Hryvnia (UAH) prices for currency conversion, including the ability to express metal prices in UAH. This guide shows how to integrate Metals-API to fetch the latest data and compute robust UAH conversions for spot quotes, historical backfills, charting, and analytics—without guesswork. We will cover the complete workflow: authenticating, pulling live rates, converting to UAH, handling units (troy ounces vs grams), managing time zones and weekends, and scaling your implementation with production-grade caching, error handling, and security considerations.
Why Real-Time UAH Conversion Matters for Metals and Multi-Currency Workflows
For pricing jewelry, hedging exposures, quoting procurement contracts, or presenting localized checkout totals, you need to convert values into Ukrainian Hryvnia (UAH) with minimal latency and high accuracy. Metals-API consolidates precious and industrial metals prices alongside currency rates and exposes them through a single JSON API. That unified access simplifies the typical multi-source approach—letting you combine live metals benchmarks (gold, silver, platinum, palladium, copper, aluminum, nickel, and more) and currency rates to deliver accurate UAH-denominated results within your applications.
Key UAH Use Cases
- Real-time pricing: Show gold, silver, or nickel prices in UAH for commodity dashboards, e-commerce, or RFQ flows.
- Currency conversion: Convert USD, EUR, or any supported currency amounts to UAH in your checkout or settlement processes.
- Portfolio analytics: Value exposures and hedges in UAH, compute P&L, and build alerts on moves.
- Historical backfills: Recompute historical metal or currency series in UAH for charting and model training.
Start by reviewing the complete documentation and symbols catalog to confirm the coverage you need: Metals-API Documentation and Metals-API Supported Symbols. To begin integrating, request your API key on the Metals-API Website.
How Metals-API Represents Prices and How That Affects UAH Conversion
Understanding the response structure is essential before you convert to UAH:
- Base currency: By default, Metals-API returns exchange rates relative to USD (base = USD).
- Units for metals: Metals are reported “per troy ounce” in the examples below. 1 troy ounce = 31.1034768 grams. If you quote in grams or kilograms, you will convert units after retrieving the data.
- Rates orientation: Metals rates in the “latest” and related endpoints are commonly expressed as how many troy ounces one USD buys (e.g., XAU = 0.000482 oz per USD). To obtain a fiat price per ounce (USD/oz), take the inverse: 1 / 0.000482 ≈ USD per troy ounce. This is a common source of confusion—always confirm the direction before computing conversions.
- Timestamps and dates: API timestamps are in Unix epoch seconds, and dates are ISO-8601 (YYYY-MM-DD). Treat them as UTC unless specified otherwise.
Putting it together for UAH:
- Fetch metal rates (base = USD). Convert to USD per troy ounce by inverting the rate.
- Fetch or compute the USD to UAH conversion using the Convert endpoint (or process a local cache if you maintain one).
- Multiply USD-per-oz by USD→UAH to get UAH-per-oz. Convert to grams if needed (divide by 31.1034768 to get UAH/gram).
Step-by-Step: From Live Metals Data to UAH-Denominated Prices
1) Get Your API Key
Sign up at the Metals-API Website to obtain an API key. You will use this key via the access_key parameter on every request. See Authentication details in the documentation.
2) Pull the Latest Metal Rates
Use the latest endpoint to retrieve current metals rates. In the example response below, values are “per troy ounce” with base = USD. We’ll then transform them to a fiat price per ounce and convert to UAH.
{
"success": true,
"timestamp": 1789433802,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744,
"XCU": 0.294118,
"XAL": 0.434783,
"XNI": 0.142857,
"XZN": 0.344828
},
"unit": "per troy ounce"
}
Interpretation:
- base: USD means the given rates are relative to 1 USD.
- rates.XAU = 0.000482 oz per USD. Therefore, USD per oz of gold = 1 / 0.000482.
- rates.XNI = 0.142857 oz per USD for nickel. USD per oz of nickel = 1 / 0.142857.
3) Get the USD to UAH Conversion Rate
Use the Convert endpoint to obtain how many UAH you get for 1 USD (or for any amount of USD). This step turns your USD-based price per ounce into UAH.
Example Convert response structure (example shown converts USD to XAU; the same structure applies when converting USD to UAH):
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1789433802,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
When converting USD→UAH, the fields will be analogous:
- query.from: "USD"
- query.to: "UAH"
- query.amount: the amount of USD you want to convert (often 1 for a spot rate)
- info.rate: the conversion rate from USD to UAH
- result: the computed UAH for the requested amount
Once you have both values:
- USD per ounce (from latest rates, inverted)
- USD→UAH (from convert)
Compute UAH per ounce: (USD/oz) × (USD→UAH). Then convert to grams if your UI displays UAH/gram: (UAH/oz) ÷ 31.1034768.
4) Complete cURL Example: Live Metals and UAH Conversion
The following demonstrates two calls—fetch recent metal rates and then compute a USD→UAH rate using the Convert endpoint. Replace YOUR_ACCESS_KEY with your key.
curl -s "https://metals-api.com/api/latest?access_key=YOUR_ACCESS_KEY&base=USD&symbols=XAU,XAG,XNI" | jq .
curl -s "https://metals-api.com/api/convert?access_key=YOUR_ACCESS_KEY&from=USD&to=UAH&amount=1" | jq .
In your application, parse the first response to invert the metal rates to USD/oz, and multiply by the second response’s USD→UAH rate to display UAH-denominated prices. See the comprehensive reference in the Metals-API Documentation.
5) End-to-End JavaScript Example: Compute UAH per Gram for Gold and Nickel
This snippet illustrates the two-call approach and unit conversions. Insert your key and handle errors, caching, and retries as shown later in this guide.
async function fetchJson(url) {
const res = await fetch(url, { timeout: 10000 });
if (!res.ok) throw new Error("HTTP " + res.status);
const data = await res.json();
if (data.success === false) throw new Error(data.error ? data.error.type : "API error");
return data;
}
(async () => {
const key = process.env.METALS_API_KEY; // store securely, do not hardcode
const latestUrl = `https://metals-api.com/api/latest?access_key=${key}&base=USD&symbols=XAU,XNI`;
const convertUrl = `https://metals-api.com/api/convert?access_key=${key}&from=USD&to=UAH&amount=1`;
const [latest, usdToUah] = await Promise.all([fetchJson(latestUrl), fetchJson(convertUrl)]);
const toUsdPerOz = (ozPerUsd) => 1 / ozPerUsd; // invert
const uahPerUsd = usdToUah.info.rate; // USD -> UAH
const TROY_OZ_TO_GRAMS = 31.1034768;
const xauUsdPerOz = toUsdPerOz(latest.rates.XAU);
const xniUsdPerOz = toUsdPerOz(latest.rates.XNI);
const xauUahPerOz = xauUsdPerOz * uahPerUsd;
const xniUahPerOz = xniUsdPerOz * uahPerUsd;
const xauUahPerGram = xauUahPerOz / TROY_OZ_TO_GRAMS;
const xniUahPerGram = xniUahPerOz / TROY_OZ_TO_GRAMS;
console.log({
date: latest.date,
xauUahPerGram,
xniUahPerGram
});
})().catch(console.error);
Note: This example focuses on the transformation pipeline and omits production-grade retries, backoff, and persistent caching, which are discussed in later sections.
Understanding Each Endpoint in UAH-Focused Workflows
Below, we walk through core endpoints that matter for UAH conversion, including their purpose, parameters, expected JSON structures, interpretation of fields, typical pitfalls, optimization strategies, and security tips. We also suggest implementation patterns to streamline both live and historical UAH use cases.
Latest Rates: Powering Real-Time UAH-Denominated Metals and Currency Quotes
Purpose: Fetch the most recent exchange rates. For metals, results are typically expressed as ounces per USD (base = USD). To express them in UAH, couple this endpoint with a USD→UAH conversion and invert rates to get fiat per ounce.
Typical parameters:
- access_key: your API key
- base: usually “USD” (default)
- symbols: restrict the returned symbols to those you need (e.g., XAU,XAG,XNI)
Example response (truncated to metals for clarity):
{
"success": true,
"timestamp": 1789433802,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
},
"unit": "per troy ounce"
}
Field usage:
- timestamp: cache key and latency metric for freshness windows.
- date: present a user-facing date label (UTC). Beware local timezone formatting in your UI.
- rates: parse and invert to USD per oz. Then multiply by USD→UAH to display UAH per oz or per gram.
- unit: confirms the measurement basis (“per troy ounce”).
Common pitfalls:
- Forgetting to invert oz/USD rates to USD/oz before currency conversion.
- Mixing troy ounces with grams without converting units, leading to 31x scale errors.
- Assuming instant settlement on weekends/holidays—consider staleness indicators.
Performance tips:
- Request only the symbols you need; this reduces payload size and speeds response parsing.
- Cache per-timestamp for the lifetime of the data freshness window in your plan.
- Serve UI from cache and refresh in background to smooth spikes.
Security tips:
- Keep your access_key server-side; don’t embed in public clients.
- Use HTTPS; never log full URLs with keys in plaintext logs.
Convert: Getting USD→UAH (and Any Currency Pair) on Demand
Purpose: Convert an amount from one symbol to another (currencies or metals). For UAH workflows, the common call is from=USD, to=UAH, amount=1 for spot conversions you then multiply against metal prices.
Example response structure (illustrative format, here shown for USD→XAU; identical shape applies for USD→UAH):
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1789433802,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Field usage:
- query.from, query.to: ensure your direction is correct (USD→UAH vs UAH→USD).
- info.rate: the computed rate to apply to your pipeline.
- result: useful when converting a non-unitary amount, e.g., 10,000 USD to UAH.
Common pitfalls:
- Calling convert repeatedly for the same rate per second without caching—add a short-lived cache keyed by from/to pair and timestamp.
- Misinterpreting result vs rate; for 1-unit quotes, result = rate, but for arbitrary amounts, result = amount × rate.
Performance tips:
- Batch conversions by applying the retrieved USD→UAH rate locally for many metal symbols, rather than calling convert for every symbol.
- Refresh your USD→UAH rate on a schedule aligned with your update needs; most UIs do not require sub-second updates.
Security tips:
- Restrict access to your server-side conversion proxy; do not expose your key directly to browsers or mobile apps.
Historical Rates: Backfilling UAH-Denominated Series for Charts and Analytics
Purpose: Retrieve historical rates for a specific date to rebuild UAH-denominated time series. The typical approach is to fetch the metal rate for the date (base=USD) and then combine it with a USD→UAH conversion for the same date.
Example response:
{
"success": true,
"timestamp": 1789347402,
"base": "USD",
"date": "2026-09-14",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
Workflow for UAH backfills:
- Request metal rate for date D; invert to USD/oz.
- Obtain or compute USD→UAH for date D (e.g., via Convert or pre-stored currency rates).
- Multiply to get UAH per oz; convert to grams if needed.
Pitfalls and mitigation:
- Weekends/holidays: Expect same-day or nearest-available rates; clearly label in UI and logs.
- Time zone alignment: Store all timestamps in UTC; display localized times in the front end.
Time-Series: Automating UAH Conversions Across a Date Range
Purpose: Fetch daily historical rates between start and end dates in a single call. Combine each day’s USD-based metal rate with the corresponding USD→UAH rate to produce a day-by-day UAH-denominated series.
{
"success": true,
"timeseries": true,
"start_date": "2026-09-08",
"end_date": "2026-09-15",
"base": "USD",
"rates": {
"2026-09-08": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-09-10": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-09-15": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
UAH usage:
- For each date, invert rates to USD/oz, retrieve USD→UAH for that date, multiply, and store the UAH value.
- Handle missing dates due to market closures by forward-filling or leaving gaps, depending on your analytics requirements.
Performance hints:
- Stream processing: Iterate date keys as you parse JSON; convert and write to your time-series store in one pass.
- Pre-aggregate to grams/kg if your consumers query those units most often.
Fluctuation: Quantifying Moves for UAH Displays and Alerts
Purpose: Retrieve how rates changed between two dates—useful for alerting users or annotating charts with UAH-converted percentage moves.
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-08",
"end_date": "2026-09-15",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
},
"XAG": {
"start_rate": 0.03825,
"end_rate": 0.03815,
"change": -0.0001,
"change_pct": -0.26
},
"XPT": {
"start_rate": 0.000915,
"end_rate": 0.000912,
"change": -3.0e-6,
"change_pct": -0.33
}
},
"unit": "per troy ounce"
}
UAH interpretation:
- Because the base is USD and rates are oz per USD, interpret changes carefully. If you want changes in USD/oz or UAH/oz, convert at both endpoints (start and end) before computing changes. Don’t mix orientations.
- Alternatively, use change_pct as a neutral measure and apply it to your UAH-converted baseline for a quick approximation.
OHLC (Open/High/Low/Close): Building UAH Charts with Market Structure
Purpose: Obtain open, high, low, and close values within a specified period. Combine with USD→UAH to generate local-currency chart data and candlesticks.
{
"success": true,
"timestamp": 1789433802,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XAU": {
"open": 0.000485,
"high": 0.000487,
"low": 0.000481,
"close": 0.000482
},
"XAG": {
"open": 0.03825,
"high": 0.0383,
"low": 0.0381,
"close": 0.03815
},
"XPT": {
"open": 0.000915,
"high": 0.000918,
"low": 0.00091,
"close": 0.000912
}
},
"unit": "per troy ounce"
}
UAH conversion notes:
- Invert each OHLC point to USD/oz, then multiply by USD→UAH captured at matching timestamps or session boundaries.
- Be explicit about your currency conversion timing policy (e.g., use close’s USD→UAH for the entire session, or per-tick if you maintain intraday FX snapshots).
Bid and Ask: Quoting UAH Spreads and Execution-Sensitive UI
Purpose: Retrieve bid/ask for metals to show tighter execution context or to compute midpoints for pricing models. For UAH quotes, convert both sides accurately to preserve the spread visualization.
{
"success": true,
"timestamp": 1789433802,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XAU": {
"bid": 0.000481,
"ask": 0.000483,
"spread": 2.0e-6
},
"XAG": {
"bid": 0.0381,
"ask": 0.0382,
"spread": 0.0001
},
"XPT": {
"bid": 0.000911,
"ask": 0.000913,
"spread": 2.0e-6
}
},
"unit": "per troy ounce"
}
UAH usage:
- Convert bid and ask separately to UAH (invert first to USD/oz, then multiply by USD→UAH) and maintain numerical precision to avoid artificial spread widening or narrowing.
- In UI, display UAH-bid and UAH-ask; optionally compute UAH-mid and UAH-spread.
Intraday: Higher-Frequency Data for Tight UAH-Conversions
Purpose: Retrieve intraday data for a single symbol at higher frequency. If your app requires rapid UAH updates, pair intraday metal ticks with frequent USD→UAH conversions (mind caching and rate limits). Refer to the Intraday endpoint docs for allowed parameters and usage patterns.
Carat: UAH Pricing for Jewelry Retail and Quoting Engines
Purpose: Obtain gold rates by carat and then convert to UAH. Append the appropriate base and use your USD→UAH workflow. This is effective for consumer-facing shopping carts or B2B quotes where carat-based pricing is standard.
Lowest/Highest and Open/High/Low/Close for Specific Dates
Purpose: Fetch analytics primitives (low, high) or OHLC for a given date, then convert to UAH for enriched dashboards and reports. Decide on session-wide USD→UAH conversions vs point-in-time conversions to keep UAH values consistent with your reporting policy.
Historical LME: Long-Range Nickel and Base Metals Analytics in UAH
Purpose: Access historical LME symbols (dating back to 2008) and express the series in UAH for deeper research and analytics. For nickel (XNI), this allows battery supply chain planners and industrial buyers to model long-run cost curves in local currency.
Parameter Guidelines, Validation, and Error Handling
Parameters You Will Commonly Use
- access_key: Required. Keep secret and rotate if exposed.
- base: Often USD by default. Verify your plan’s base support if you need others.
- symbols: Comma-separated list of metals or currencies to scope responses.
- date/start_date/end_date: ISO-8601 date strings for historical/time-series queries.
- from, to, amount: Used in Convert; ensure direction is correct (e.g., from=USD, to=UAH, amount=1).
Validation and Sanitization
- Whitelist symbols with Metals-API Supported Symbols before sending requests to prevent typos and reduce 4xx errors.
- Normalize dates to UTC and validate ranges (start_date ≤ end_date).
- Constrain amount to positive numeric values; reject NaN and Infinity before callouts.
Error Handling and Recovery
- Check success flag in responses; handle error objects gracefully.
- Implement exponential backoff for transient failures (network timeouts, 5xx).
- Use stale-while-revalidate: show last good UAH prices if live calls fail, with an “as of” timestamp.
- Log request IDs, timestamps, and symbol sets to expedite debugging.
Caching, Freshness, and Weekend Behavior
Many markets have diminished or no trading on weekends and holidays. Metals-API responses may reflect the last available price in these windows. Build a clear policy:
- Freshness windows: Cache responses for the smallest interval that meets your UX and compliance needs.
- Market closures: Display “as of” timestamps and consider color-coding stale vs fresh data.
- Intra-request caching: Deduplicate identical requests for USD→UAH within a short interval.
Precision, Units, and Rounding in UAH
- Floating point: Use decimal libraries where possible to avoid rounding artifacts in UAH conversions and spread calculations.
- Units: Convert troy ounces to grams with 31.1034768. For kilograms, divide by 0.0311034768.
- Display rounding: Choose a consistent rule (e.g., UAH to 2 decimals for retail, 4+ decimals for institutional UI) and be explicit about it.
Security Best Practices
- Store access_key in server-side configuration or secret managers; do not expose to browsers.
- Rotate keys periodically; immediately rotate if you suspect leakage.
- Use HTTPS and avoid logging secrets; scrub URLs and headers in logs.
- Implement input validation and output encoding to avoid injection issues in your middleware.
Performance and Scaling Patterns
- Batching: Fetch latest rates for multiple symbols in one call; combine with a single USD→UAH conversion for the UI refresh cycle.
- Tiered caches: Edge cache for live UAH totals; memory cache for compute pipelines; persistent cache (Redis, database) for historical fallbacks.
- Background refresh: Serve from cache and refresh in the background via cron/schedulers to keep UI snappy.
- Asynchronous pipelines: Offload UAH computations to workers; push updates to clients via websockets or SSE when values change.
Data Analytics and Insights: UAH-Denominated Trends
With UAH conversions in place, you can build richer analytics:
- Volatility: Compute realized volatility of UAH-denominated metal prices to calibrate risk limits.
- Correlation: Study UAH metal price correlation with local macro variables or FX rates.
- Seasonality: Use time-series endpoint to analyze recurring patterns in UAH terms.
- Event studies: Use OHLC and fluctuation data to annotate policy changes or market shocks in UAH context.
Nickel (XNI) in a Digitally Transformed Market
Nickel is central to stainless steel and battery supply chains. As digital transformation accelerates commodity pricing, developers can integrate XNI data with UAH conversion to optimize procurement, quoting, and hedging:
- Technological innovation: Build real-time procurement dashboards auto-quoting nickel in UAH to align with local invoicing and budgeting cycles.
- Smart integration: Combine intraday XNI with inventory IoT signals to trigger replenishment orders when UAH-denominated input costs meet targets.
- Data insights: Run cost sensitivity analysis by varying USD→UAH and nickel prices; surface break-even points in UAH for production planning.
- Future trends: Integrate historical LME data for nickel to forecast in UAH and support long-term contracts with local-currency clauses.
Architectural Considerations
- Services: Isolate a “Rates Service” that fetches latest metals, USD→UAH, and exposes UAH-denominated outputs to downstream apps.
- Schema: Store raw metals in oz/USD and reference USD→UAH snapshots to re-compute UAH at query time; alternatively, pre-materialize UAH series for speed.
- Idempotency: Ingest endpoints should be idempotent by timestamp to avoid duplicates.
- Observability: Emit metrics on latency, cache hit rates, error rates, and staleness windows.
Practical Scenarios You Can Implement Today
Localized E-Commerce Pricing
- Use latest rates for XAU/XAG, compute USD/oz, convert to UAH/gram, and update product pages with a periodic refresh job.
- On checkout, re-validate the UAH rate via Convert to reduce FX slippage between cart and payment.
Trading and Risk Dashboards
- Combine intraday endpoint and bid/ask to show UAH spreads and mark-to-market P&L.
- Run fluctuation endpoint daily to send UAH-based move summaries to your users.
ERP and Procurement
- Use time-series and historical to model nickel (XNI) purchase cycles in UAH, then align budget bands and approval thresholds accordingly.
More JSON Examples and What They Mean for UAH
Another Latest Snapshot (with multiple base metals)
{
"success": true,
"timestamp": 1789433802,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XCU": 0.294118,
"XAL": 0.434783,
"XNI": 0.142857,
"XZN": 0.344828
},
"unit": "per troy ounce"
}
- XNI: Invert 0.142857 to get USD/oz of nickel; then apply USD→UAH to display UAH/oz or UAH/kg.
- Precision: For industrial pricing, keep at least 4–6 decimals after conversion to prevent rounding drift in totals.
Fluctuation Example (interpretation reminders)
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-08",
"end_date": "2026-09-15",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
}
},
"unit": "per troy ounce"
}
- To compute UAH change, convert both endpoints’ rates to UAH and then compare. Do not directly apply change to a UAH value unless you confirm the measure orientation is consistent.
Troubleshooting Common Pitfalls
- Problem: UAH prices look too small or too large by ~31x. Cause: forgot troy ounce to gram conversion. Fix: divide by 31.1034768 for gram-based displays.
- Problem: Negative spreads after conversion. Cause: precision loss or rounding at intermediate steps. Fix: keep high precision during calculations; round only at display time.
- Problem: Stale rates over weekends confuse end users. Fix: show “as of” timestamp, add “market closed” label, and send proactive notifications when markets reopen.
- Problem: API quota spikes. Cause: calling convert for every symbol repeatedly. Fix: cache USD→UAH once per refresh window and reuse across symbols.
Combining Metals-API with Your Existing Stack
- Data stores: Use columnar stores (e.g., Parquet) for historical UAH series to accelerate analytics.
- Pipelines: Integrate with stream processors to distribute UAH updates to dashboards, alerts, and downstream services.
- Testing: Snapshot sample JSON in fixtures; unit-test inversion and UAH conversion logic thoroughly.
- Monitoring: Add alerts on sudden jumps in UAH conversion to detect FX anomalies.
Governance, Compliance, and Auditability
- Provenance: Log timestamp, base, symbols, and conversion chain (including USD→UAH rate and time) for every UAH-denominated quote you store.
- Reproducibility: Archive raw responses to reconstruct historical UAH outputs if audited.
- Versioning: Track changes to your formulae (e.g., rounding rules) with semantic version identifiers on data products.
Where to Find Symbols and Learn More
Before you build, confirm symbol availability and semantics at Metals-API Supported Symbols. For endpoint-by-endpoint details, quotas, and parameters, read Metals-API Documentation. If you haven’t obtained your key yet, get a free API key on the Metals-API Website and start testing.
Appendix: Example JSON Recap and Field Explanations
Latest
{
"success": true,
"timestamp": 1789433802,
"base": "USD",
"date": "2026-09-15",
"rates": { "XAU": 0.000482 },
"unit": "per troy ounce"
}
- Invert 0.000482 to compute USD/oz; then multiply by USD→UAH to obtain UAH/oz.
Historical
{
"success": true,
"timestamp": 1789347402,
"base": "USD",
"date": "2026-09-14",
"rates": { "XAU": 0.000485 },
"unit": "per troy ounce"
}
- Use at specific dates; pair with currency conversion for UAH-denominated historicals.
Time-Series
{
"success": true,
"timeseries": true,
"start_date": "2026-09-08",
"end_date": "2026-09-15",
"base": "USD",
"rates": { "2026-09-08": { "XAU": 0.000485 } },
"unit": "per troy ounce"
}
- Loop over dates, convert each to UAH for charts and analytics.
Fluctuation
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-08",
"end_date": "2026-09-15",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
}
},
"unit": "per troy ounce"
}
- Use change_pct to express normalized moves; compute UAH conversions for each endpoint rate if needed.
OHLC
{
"success": true,
"timestamp": 1789433802,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XAU": { "open": 0.000485, "high": 0.000487, "low": 0.000481, "close": 0.000482 }
},
"unit": "per troy ounce"
}
- Invert each OHLC to USD/oz; multiply by USD→UAH to chart in UAH.
Bid/Ask
{
"success": true,
"timestamp": 1789433802,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XAU": { "bid": 0.000481, "ask": 0.000483, "spread": 2.0e-6 }
},
"unit": "per troy ounce"
}
- Convert bid and ask separately to maintain accurate UAH spreads.
Conclusion: Build Reliable UAH Conversions with Metals-API
To get accurate, real-time Ukrainian Hryvnia (UAH) prices for currency conversion, integrate Metals-API’s unified metals and currency endpoints. Retrieve metals as ounces per USD, invert to USD per ounce, and apply USD→UAH via the Convert endpoint. Handle units carefully (troy ounces vs grams), respect timestamps and market closures, and implement robust caching and error handling for production. With this foundation, you can deliver localized UAH quotes, time-series analytics, and execution-aware dashboards across fintech, trading, manufacturing, and jewelry applications. Explore the full capabilities at the Metals-API Documentation, confirm instrument coverage at Metals-API Supported Symbols, and get your free API key to start building.
FAQ
- How do I convert gold to UAH? Retrieve the latest XAU rate (oz per USD), invert to USD per oz, then multiply by USD→UAH from the Convert endpoint. Convert to grams if needed.
- Why do my UAH numbers look off by a factor of ~31? You likely forgot to convert troy ounces to grams. 1 troy ounce = 31.1034768 grams.
- What timezone are the timestamps in? Treat timestamps as Unix epoch seconds and dates as UTC. Adjust in the UI as desired.
- How should I cache? Cache latest metals and USD→UAH for a short freshness window; serve from cache and refresh asynchronously to reduce latency and API calls.
- Can I get bid/ask and intraday data? Yes. Use the Bid/Ask and Intraday endpoints. Convert each side to UAH separately to preserve spreads.
- What if a day is missing in time-series? Markets may be closed. Decide whether to forward-fill or leave gaps, and document your policy for analytics users.
- Where can I find supported symbols? Check the up-to-date catalog at Metals-API Supported Symbols.