Terbium (TER) - Per Ounce Price API integration guide for 2026

Metals-API 9 min read
Terbium (TER) - Per Ounce Price API integration guide for 2026

You need a reliable way to quote Terbium (TER) per troy ounce in USD across an ERP, pricing page, or internal trading tool. By the end of this guide, you will fetch the live TER price via a single API request, read both oz-per-USD and USD-per-oz, convert to grams/kilograms, and productionize it with caching and edge cases covered.

What you will build

We’ll integrate Metals-API’s latest endpoint for Terbium (symbol: TER) to:

Illustration: Terbium (TER) - Per Ounce Price API integration guide for 2026
  • Retrieve the current price of TER per troy ounce with base currency USD.
  • Use the inverted quote (USDTER) for USD-per-oz when you need a user-facing price.
  • Convert to per-gram and per-kilogram prices from the returned values.
  • Add basic caching logic and weekend/holiday handling.

If you are new to the TER symbol or want to check coverage, see the live catalog at Metals-API Supported Symbols.

Key concept: units and base currency for TER

Metals-API returns metal prices relative to a base currency, which is USD in our examples. For metals, the standard unit is the troy ounce (ozt), not the avoirdupois ounce. One troy ounce equals 31.1034768 grams.

  • rates.TER (with base=USD) is “troy ounces of TER per 1 USD”.
  • rates.USDTER is the inversion “USD per 1 troy ounce of TER”.

Most downstream UIs and billing flows prefer USD per ounce (USDTER). Analytics and conversions often need grams or kilograms, which you derive from USDTER using the troy-ounce conversion factor.

Get the live Terbium price (per ounce) via the Latest endpoint

Use the latest endpoint with symbols set to TER and its inverted pair USDTER. Adding USD is helpful for cross-checks and relative conversions in your application state.

curl request

curl "https://metals-api.com/api/latest?access_key=YOUR_API_KEY&symbols=TER,USDTER,USD"

Official JSON response

{"success":true,"timestamp":1792368540,"date":"2026-10-19","base":"USD","rates":{"TER":0.0069806238905384,"USD":1,"USDTER":143.25367125929947}}

How to read this response

  • success: Boolean flag indicating a successful request.
  • timestamp: Unix epoch seconds for the price snapshot. Treat timestamps as UTC.
  • date: Human-readable date for the snapshot. This aligns with the timestamp’s day in UTC.
  • base: The base currency of all rates in this response. Here it is USD.
  • rates.TER: 0.0069806238905384 means 0.0069806238905384 troy ounces of TER per 1 USD.
  • rates.USDTER: 143.25367125929947 means USD 143.25367125929947 per 1 troy ounce of TER.
  • rates.USD: Always 1 when base is USD; useful if you request mixed symbols.

In practice, for pricing and display, you will typically use rates.USDTER as your USD/oz quote for TER. When you need to convert to per-gram: USD per gram = USDTER / 31.1034768. For kilograms: USD per kg = USDTER × (1000 / 31.1034768).

JavaScript example: fetch, invert checks, and unit conversions

This example calls the same Latest endpoint, extracts USD-per-oz, and computes per-gram and per-kg prices. It also shows safe parsing and basic caching guidance in comments.

/**
* Fetch the latest Terbium price (USD per troy ounce) and convert to per-gram and per-kg.
* Notes:
* - Cache this response for a few minutes to reduce API calls in production.
* - Treat timestamp as UTC when persisting into databases or caches.
*/
async function fetchTerbiumPrice() {
const API_KEY = process.env.METALS_API_KEY || "YOUR_API_KEY";
const url = `https://metals-api.com/api/latest?access_key=${encodeURIComponent(API_KEY)}&symbols=TER,USDTER,USD`;

const res = await fetch(url, { method: "GET" });
if (!res.ok) {
throw new Error(`HTTP ${res.status} fetching Metals-API latest`);
}
const data = await res.json();

if (!data.success || !data.rates || typeof data.rates.USDTER !== "number") {
throw new Error("Unexpected response structure for TER/USDTER");
}

const ts = data.timestamp; // epoch seconds (UTC)
const asOf = new Date(ts * 1000).toISOString(); // e.g., 2026-10-19T...
const usdPerOz = data.rates.USDTER; // USD per troy ounce of TER
const OZT_TO_GRAMS = 31.1034768;

const usdPerGram = usdPerOz / OZT_TO_GRAMS;
const usdPerKg = usdPerGram * 1000;

return {
asOfUtc: asOf,
usdPerOz,
usdPerGram,
usdPerKg,
debug: {
base: data.base,
ozPerUsd_TER: data.rates.TER, // troy ounces per 1 USD
usdPerOz_TER: data.rates.USDTER
}
};
}

// Example usage
fetchTerbiumPrice()
.then((p) => {
console.log("As of (UTC):", p.asOfUtc);
console.log("USD/oz (TER):", p.usdPerOz);
console.log("USD/g (TER):", p.usdPerGram);
console.log("USD/kg (TER):", p.usdPerKg);
})
.catch((err) => {
console.error("Failed to load TER price:", err);
});

Precision, units, and display

  • Units: Metals-API metals are per troy ounce by default. Convert to grams using 31.1034768 g per ozt.
  • Precision: Preserve numeric precision in storage (decimal or double). Only round at display time to your product’s rules.
  • Inversion: If USDTER is present, use it directly for USD/oz. If you only have TER (oz/USD), then USD/oz = 1 / TER.
  • Base currency: If you change base from USD, re-check which side of the quote you need; the USDTER field is explicitly USD per oz regardless.

Time-series and analytics for TER

For backtesting or charting, use the time-series endpoint to request daily closes between two dates. You specify start_date, end_date, and symbols=TER. If you need period changes, the fluctuation endpoint can summarize start rate, end rate, absolute change, and percent change for the same window.

  • Typical query structure (no response shown here; see docs for full parameters and output):
https://metals-api.com/api/timeseries?access_key=YOUR_API_KEY&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD&symbols=TER

For endpoint behavior, field definitions, and availability windows, review the Metals-API Documentation. When using historical or timeseries data, align your timestamps to UTC and expect daily bars to align to the service’s market calendar rather than local timezones.

Production considerations (save yourself an hour)

  • Timezone and timestamps: Treat timestamp as UTC. Normalize all store-and-compare operations to UTC to avoid daylight-saving pitfalls.
  • Caching: If your UI queries every few seconds, introduce a short-lived cache (e.g., 30–60 seconds) at your edge or server to reduce request volume and latency spikes.
  • Weekend/holiday behavior: Metals-API serves snapshots for non-trading days. On closures, the date/timestamp may roll over without price changes. Build UI labels like “As of” with the returned timestamp.
  • Fallback logic: If the latest call fails, optionally serve the most recent cached successful payload with the “As of” timestamp flagged to the user.
  • Validation: Before assuming fields exist, check data.success and confirm the numeric types of data.rates.TER and data.rates.USDTER. Fail fast when they are missing or malformed.
  • Rounding rules: Decide and document how you round for display (e.g., 2–4 decimals for USD/oz) versus how you round for billing (often more precision).
  • Server-side key management: Keep your Metals-API key on the server. If you need browser access, proxy through your backend to avoid exposing credentials.
  • Resilience: Use short timeouts and retry with backoff. Guard against intermittent network or upstream issues.

From ounces to grams, kilograms, and inventory costing

Many ERP and manufacturing systems track inventory in grams or kilograms, while pricing teams often quote in per-ounce. Compute and store all three to avoid repeated conversions:

  • USD/oz = rates.USDTER.
  • USD/g = USD/oz / 31.1034768.
  • USD/kg = USD/g × 1000.

When converting to other currencies (e.g., EUR), call the conversion or latest endpoints with the correct symbols and base currency; see the Documentation for details. Keep your ledger in a single canonical unit (often grams) to prevent cumulative rounding drift across multiple conversions.

Monitoring and key management

Use the control panel to track usage and manage keys across environments. Rotate keys on a schedule and upon personnel changes.

Visit the MCP (Metals-API Control Panel) to review account metrics, configure settings, and check request health.

Quality checks your team should automate

  • Snapshot parity: Ensure USDTER ≈ 1 / TER within a small tolerance. Alert if the deviation exceeds your threshold.
  • Staleness: Flag if timestamp is older than your freshness SLA (e.g., 15 minutes) before showing a “live” badge.
  • Type safety: Assert numeric fields for rates before arithmetic. Log schema changes.
  • Unit tests: Verify ounce-to-gram and ounce-to-kilogram conversions, making the troy-oz constant a single source of truth.

Where this fits in your stack

  • Pricing services: A server-side service fetches USDTER for TER, caches it, and exposes a normalized “prices” API to frontends and other services.
  • Trading/alerts: A scheduler reads USDTER and computes changes vs. prior closes from time-series data. Trigger notifications when thresholds are breached.
  • ERP costing: Batch jobs update standard costs daily using USD/oz and convert to grams or kilograms for SKUs and BOM roll-ups.

Validation workflow for new deployments

  1. Hit the Latest endpoint for symbols=TER,USDTER,USD and log the raw payload.
  2. Verify 1 / rates.TER ≈ rates.USDTER.
  3. Compute per-gram and per-kg and ensure expected magnitude (orders of magnitude errors often stem from mixing avoirdupois and troy ounces).
  4. Set up a minimal dashboard with “As of (UTC)”, USD/oz, USD/g, USD/kg and your cache age indicator.
  5. Introduce latency and retry monitoring to catch client or network regressions.

Advanced: building analytics with time-series and fluctuation

If your product includes charts or performance analytics, augment your latest quote with historical pulls:

  • Daily chart: Request the time-series endpoint for TER over your desired lookback and render USDTER (derived as 1 / TER if needed) as the plot series.
  • Changes: Use fluctuation to compute period returns without manually differencing bars.
  • Market closures: For weekends/holidays, you may observe flat periods. Decide whether your chart interpolates, steps, or hides non-trading days.

For request parameters and edge-case behavior, rely on the Documentation. Keep symbol discovery current with the Symbols page.

Security notes for developers

  • Never ship your Metals-API key in client-side code. Use a server-side proxy or server-only environment variables.
  • Rotate keys regularly. Remove old keys from CI/CD and secret stores after rotation.
  • Limit blast radius: Use environment-specific keys (dev/stage/prod) and isolate access.

Helpful references

FAQ

1) Which rate should I display as “the price of Terbium per ounce”?
Display rates.USDTER, which is USD per troy ounce of TER. If only TER (oz per USD) is present, invert: USDTER = 1 / TER.

2) How do I get USD per kilogram for TER?
Compute USD/kg = (USD/oz) × (1000 / 31.1034768). Use USD/oz = rates.USDTER from the Latest response.

3) Why does the response sometimes look unchanged on weekends?
On market closures, snapshots may carry forward the last available price. Use the response timestamp to show “As of (UTC)” and avoid implying intraday movement when markets are closed.

4) How often should I refresh?
That depends on your plan and UI needs. Many apps refresh every few minutes and cache responses briefly. Check the Documentation for update frequencies available to your subscription.

5) Where can I manage my API key and observe usage?
Use the MCP to manage keys, monitor calls, and review account details.

Get your API key and ship it

Start integrating the TER per-ounce price with the Latest endpoint and scale into historical analytics when you’re ready. Create your account here: Register. For endpoint details and symbol coverage, keep the Documentation and Symbols pages handy as you build.