IBJA Gold 916 PM (IB916PM) - Per 10 Grams Spot Price API: Integration Guide for Developers
You're building pricing or analytics that must reflect the IBJA Gold 916 PM benchmark in real time—specifically, the per–10 grams spot price—and you need to plug it into your app safely and accurately. By the end of this guide, you’ll fetch IB916PM spot ticks from Metals-API, compute USD per gram (and optional troy ounce equivalents), chart recent moves, and ship production-grade safeguards like caching and weekend handling.
What “IBJA Gold 916 PM (IB916PM) — per 10 grams” means in the API
IB916PM is the Indian Bullion and Jewellers Association’s 916 (22K) gold PM benchmark quoted per 10 grams. In Metals-API, symbols can represent various units (for example, “per troy ounce” for XAU, or “per 10 grams” for IB916PM). That unit context matters when you convert and display prices.
Metals-API defaults to base=USD. When you query with base=USD:
- rates.IB916PM = number of 10-gram units per 1 USD (metal-per-USD).
- rates.USDIB916PM = USD per 1 unit of IB916PM (USD per 10 grams).
This dual representation saves you from doing the inversion yourself and avoids floating-point mistakes. If you’re unsure about a symbol or its unit, verify on the Symbols page. For platform capabilities and endpoint behavior, see the Documentation and the main site at metals-api.com.
Endpoints you actually need
For IB916PM spot and recent trend work, these cover most use cases:
- Latest Rates: to power live quotes and quick conversions.
- Historical (by date): to backfill a single day.
- Time-series: to draw daily charts and compute returns over a range.
We’ll focus on Latest with a complete example response. For Historical and Time-series, we’ll show concrete requests using the IB916PM symbol so you can copy them into your code or terminal, then consult the Documentation for field-by-field specifics.
Fetch the live IB916PM quote (USD per 10 grams and more)
Query the Latest endpoint with both IB916PM and USDIB916PM to get metal-per-USD and USD-per-10g in one round trip. Replace YOUR_API_KEY with your key.
curl "https://metals-api.com/api/latest?access_key=YOUR_API_KEY&symbols=IB916PM,USDIB916PM"
Sample JSON (copy/pasteable) with real values:
{"success":true,"timestamp":1793146080,"date":"2026-10-28","base":"USD","rates":{"IB916PM":0.00073467630508448,"USD":1,"USDIB916PM":1361.1436670534931}}
What these fields mean for your app
- success: Boolean for request status.
- timestamp: Unix seconds (UTC). Use it for caching and freshness checks.
- date: Calendar date for the rate (UTC). Useful for daily alignment.
- base: The pricing base. Defaults to USD here.
- rates.IB916PM: Metal-per-USD (10-gram units per 1 USD).
- rates.USDIB916PM: USD per 10 grams. Use this directly for retail pricing in USD.
Common derived values:
- USD per gram: USDIB916PM / 10
- USD per kilogram: USDIB916PM × 100
- Optional reference to troy ounces: 1 troy ounce = 31.1034768 grams. If you need a comparable troy-ounce figure for analysis, convert from grams after you compute USD/gram. (Background on troy ounces: Investopedia: Troy Ounce.)
Python example: get USD per 10g, per gram, and cache it
This snippet fetches IB916PM, reads USD per 10g from USDIB916PM, computes USD/gram, and implements a basic time-based cache keyed by day to minimize redundant calls.
import os
import time
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"
SYMS = "IB916PM,USDIB916PM"
# naive in-memory cache
_cache = {"date": None, "data": None, "fetched_at": 0}
def get_ib916pm_latest():
# cache for 60 seconds to avoid hammering the API
if time.time() - _cache["fetched_at"] < 60 and _cache["data"]:
return _cache["data"]
params = {"access_key": API_KEY, "symbols": SYMS}
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}")
_cache["data"] = data
_cache["fetched_at"] = time.time()
_cache["date"] = data.get("date")
return data
def to_decimal(x):
return Decimal(str(x))
def round_usd(x, places=2):
q = Decimal("1." + "0"*places)
return x.quantize(q, rounding=ROUND_HALF_UP)
if __name__ == "__main__":
data = get_ib916pm_latest()
rates = data["rates"]
# USD per 10 grams (prefer USDIB916PM directly when available)
usd_per_10g = to_decimal(rates["USDIB916PM"])
# USD per gram
usd_per_g = usd_per_10g / Decimal(10)
# Optional: USD per troy ounce (31.1034768 g)
USD_PER_TROY_OUNCE = usd_per_g * Decimal("31.1034768")
print(f"Date (UTC): {data['date']}")
print(f"USD per 10g (IB916PM): {round_usd(usd_per_10g)}")
print(f"USD per gram: {round_usd(usd_per_g, 4)}")
print(f"USD per troy ounce (derived): {round_usd(USD_PER_TROY_OUNCE, 2)}")
Implementation notes:
- Use Decimal for money to avoid binary float rounding surprises, especially if you display per-gram prices with four decimals.
- Cache based on timestamp or your business SLA. If your plan updates every N minutes, cache a bit less than N.
- If you need a quote in your local currency, convert USD to your fiat using currency rates from Metals-API. Retrieve the FX pair alongside the metals symbol in the same call when available, then multiply your USD price by USD→Local FX. See the Documentation for currency parameters.
Requests for historical and time-series IB916PM data
Use these when you need to backfill a day or draw a chart. These examples keep the query specific to IB916PM and USDIB916PM.
Single date (Historical)
Append the date (UTC, YYYY-MM-DD) to the path:
curl "https://metals-api.com/api/2026-10-15?access_key=YOUR_API_KEY&symbols=IB916PM,USDIB916PM"
Tip: Expect no change for weekends or holidays. If the market or benchmark is closed, the API may roll the last available rate forward to that date. Always check the date field in the response.
Range of dates (Time-series)
curl "https://metals-api.com/api/timeseries?access_key=YOUR_API_KEY&start_date=2026-10-01&end_date=2026-10-28&symbols=IB916PM,USDIB916PM"
What to do with the series:
- Compute day-over-day changes: use USDIB916PM for price deltas in USD per 10g, or convert to per gram first.
- Handle missing days: iterate by response keys rather than assuming every calendar day is present.
- Pre-calc sparkline arrays for your UI and store them with the same date keys.
Units, conversion, and display guidelines that prevent mistakes
- Unit consistency: IB916PM is per 10 grams. If you show “per gram,” divide USDIB916PM by 10. Label your UI units explicitly (“USD/10g”, “USD/g”).
- Base currency: Responses here are base=USD. If you switch base, revisit your math. With base=USD, rates.IB916PM is 10g-per-USD while rates.USDIB916PM is USD-per-10g. Use the latter for price tags or invoicing.
- Timestamps: The timestamp is a Unix epoch in UTC. Store as integer; convert to your user’s timezone for display while keeping all calculations in UTC.
- Rounding: For per-gram retail prices, four decimals often make sense (e.g., USD/g to 0.0001). For per-10g, two decimals are typical for consumer display.
- Weekend/holiday behavior: The “latest” rate can remain unchanged when there’s no new benchmark print. Decide whether your app repeats the last close or hides intraday deltas on those days.
- Caching: If your plan updates every 10–60 minutes, avoid polling more frequently. Cache in your CDN or edge worker keyed by the date and the symbol list and include your own max-age aligned to the plan cadence.
Reliably mapping symbols and maintaining contracts
Production stability starts with a clear symbol contract. Confirm symbol availability and unit definitions on the Symbols page before shipping to prod. Bake a startup check that validates IB916PM and USDIB916PM appear in the Latest response, and alert on mismatch or missing fields.
If your business logic compares IB916PM against another gold benchmark or purity, isolate conversions behind a function that normalizes everything to USD/gram internally. This keeps your UI and analytics consistent even if you add new sources later.
Example: end-to-end pricing pipeline
This is a practical workflow that teams in jewelry and fintech often use when indexing to IBJA 916 PM:
- Pull Latest for IB916PM and USDIB916PM.
- Compute USD/g = USDIB916PM / 10.
- (Optional) Convert USD→Local currency using the paired FX rate from Metals-API in the same or a subsequent request.
- Add your making charges, taxes, and margins as separate line items to keep the commodity component auditable.
- Round and present according to your UX spec; store the raw Decimal values for audit trails.
- Cache until the next expected update interval; invalidate earlier if the timestamp changes.
Operational safeguards that save you incidents
- Graceful degradation: If Latest fails, fall back to the most recent successfully cached rate and mark the UI accordingly.
- Outlier detection: If the new USDIB916PM deviates from your rolling median by a high multiple, log and require manual confirm before repricing critical SKUs.
- Decimal storage: Use fixed-precision types (Decimal/Numeric) in your database with enough scale to preserve per-gram accuracy.
- Clock drift: Compare response.timestamp against your server time; warn if skew is higher than your SLA tolerance.
Troubleshooting and verification
- Missing symbol in response: Verify spelling and availability on Symbols.
- Unchanged price across hours: Check your plan’s update cadence. If no new print is available (weekend/holiday), the value can remain steady. Use the “timestamp” to decide if you should refresh UI badges.
- Unit confusion: Remember IB916PM is per 10 grams. Prefer USDIB916PM (USD/10g) to avoid inversion errors, especially when displaying to end users.
- Time-series gaps: Don’t assume every calendar day exists. Iterate over the keys Metals-API returns for rates. If needed, forward-fill for charts but mark synthetic points.
Where to go next
If you want to expand beyond spot and simple charts—like OHLC, bid/ask, or fluctuation analytics—Metals-API offers those as separate endpoints. Because this guide is scoped to IB916PM spot and historical pulls, we haven’t covered them in detail. Explore endpoint coverage, parameters, and sample payloads in the Documentation and get hands-on in the MCP console to test queries interactively.
New to the API? Start at metals-api.com and get your key here: Register.
Reference: field map for IB916PM spot
| Field | Meaning | Use in code |
|---|---|---|
| timestamp | Unix epoch (UTC) of the quote | Freshness check, cache key |
| date | UTC date label | Align daily bars, audit logs |
| rates.IB916PM | 10-gram units per 1 USD | Metal-per-USD analysis, inversion check |
| rates.USDIB916PM | USD per 10 grams | Pricing, conversion to USD/gram and USD/kg |
Historical/time-series implementation pointers
- Daily alignment: Store bars keyed by the response’s “date” (UTC). Avoid reindexing to local time zones for persistence; convert only at display time.
- Percent returns: Compute on USDIB916PM (USD per 10g). For example, daily_change_pct = (today - yesterday) / yesterday.
- Batch pulls: If you need a month of data, prefer the Time-series endpoint over multiple single-day calls to reduce latency and request count.
- Compression: If you move large series around, serve cached JSON with gzip or brotli enabled at your edge.
Risk and validation considerations for IB916PM-indexed pricing
- Benchmark specificity: IB916PM represents a 22K (916) standard with a specific publication schedule. Do not substitute with other purities or benchmarks without explicitly transforming to comparable units and purity.
- Back-test window: When building guards (e.g., closing-only repricing), test across holidays and weekends when updates are paused to ensure your logic doesn’t misfire on missing data.
- Change alerts: Hook a simple rule such as absolute move in USD/g or percentage move in USD/10g over your business window. Base it on USDIB916PM to avoid inversion mistakes.
FAQ
1) What exactly does IB916PM measure in Metals-API?
It’s the IBJA Gold 916 PM benchmark quoted per 10 grams. In the Latest response, read rates.USDIB916PM for “USD per 10 grams,” and divide by 10 if you need USD per gram.
2) How do I display a USD/gram price correctly?
Use USD per gram = rates.USDIB916PM / 10. Round to four decimals for display if that matches your UX, but keep full precision internally.
3) Why didn’t the latest price change over the weekend?
Benchmarks may not update on weekends or holidays. The API’s timestamp and date fields will show you whether a new print has arrived; cache and display accordingly.
4) Can I chart IB916PM over the past month?
Yes. Call the Time-series endpoint with symbols=IB916PM,USDIB916PM and your desired start_date and end_date. Plot USDIB916PM for a direct USD per 10g line.
5) Where can I confirm symbol codes and units?
Use the authoritative list at Metals-API Supported Symbols.
Ready to wire IBJA Gold 916 PM into your app? Get your API key and start testing the IB916PM latest and time-series endpoints in minutes: Register. For hands-on exploration and quick queries, open the MCP, and keep the Documentation open as you build.