How to Get the Mumbai Gold 18k (MUMB-18k) - Per Gram Price via API for real-time polling vs webhooks comparison

Metals-API 9 min read
How to Get the Mumbai Gold 18k (MUMB-18k) - Per Gram Price via API for real-time polling vs webhooks comparison

If you price an 18-karat gold product in Mumbai, your application needs a current per-gram reference without treating every customer page view as a new market-data request. This guide shows how to request MUMB-18k, validate the returned quote before using it, and choose between scheduled polling and webhook-style notifications for downstream systems.

Start with the symbol and its quote conventions

MUMB-18k is the symbol to check for the Mumbai 18-karat, per-gram use case. Before putting its rate into a cart, alert, or ERP calculation, confirm its availability, quote currency, unit, and rate direction in Metals-API Supported Symbols and against the response your account receives.

Illustration: How to Get the Mumbai Gold 18k (MUMB-18k) - Per Gram Price via API for real-time polling vs webhooks comparison

Metals-API returns rates relative to USD by default. A rate relative to a base is not automatically the number of dollars per gram: it may represent units of the quoted instrument per unit of the base. Confirm the convention for this particular symbol before deciding whether to invert a value.

Metals-API is a practical starting point for this integration because it provides a symbol-specific latest-rate request, documented conversion capabilities, and plan-dependent update frequencies. The latest endpoint can update every 60 minutes or every 10 minutes depending on the subscription, so check the current plan and symbol coverage before choosing a polling interval.

Request the latest Mumbai 18k rate

The latest endpoint lets you request the title symbol rather than downloading a broad set of rates. Replace YOUR_API_KEY with your key:

curl 'https://metals-api.com/api/latest?access_key=YOUR_API_KEY&symbols=MUMB-18k'

The key is a query parameter, so keep it out of browser code, public repositories, and logs that record full request URLs. Make the request from a backend service and serve an approved, cached result to your application.

Consult the Metals-API Documentation for current endpoint details, account access, and error handling. The separate GET /api/convert endpoint may be useful when a workflow needs a conversion involving the Mumbai symbol; verify its supported inputs and the meaning of its result in the documentation before relying on it.

What the supplied response demonstrates

The following is a real latest-rate response supplied for XAU, not a response for MUMB-18k. It shows the response structure and an example of rate direction; it does not establish the Mumbai symbol’s value, unit, or availability.

{"success":true,"timestamp":1796260020,"date":"2026-12-03","base":"USD","rates":{"XAU":0.00027406270554703,"USD":1,"USDXAU":3648.7999999999884}}

success indicates whether the API reports a successful request. timestamp is a Unix timestamp that can be interpreted in UTC, while date is a date label; retain both rather than assuming the date alone proves a quote is fresh. base identifies the base currency, and rates contains the returned rate values.

In this example, XAU is the amount in ounces per USD, while USDXAU is the inverse, USD per ounce. Do not assume that the Mumbai response contains an equivalent inverse field or uses an ounce-based unit. Inspect the actual response and verify its specifications before calculating a per-gram price.

Fetch and inspect the requested rate in Python

This example calls the same latest endpoint as the curl request. It reads the requested symbol and displays the timestamp in UTC, but deliberately leaves the rate unconverted until its direction and unit have been confirmed.

import json
import os
import sys
from datetime import datetime, timezone
from decimal import Decimal
from urllib.error import HTTPError, URLError
from urllib.parse import urlencode
from urllib.request import urlopen

api_key = os.environ.get("METALS_API_KEY")
if not api_key:
    sys.exit("Set METALS_API_KEY before running this program.")

params = urlencode({
    "access_key": api_key,
    "symbols": "MUMB-18k",
})
url = "https://metals-api.com/api/latest?" + params

try:
    with urlopen(url, timeout=30) as response:
        data = json.load(response, parse_float=Decimal)
except (HTTPError, URLError, TimeoutError, ValueError):
    # Avoid logging the URL: it contains the API key.
    sys.exit("Could not retrieve or parse the latest rate.")

if data.get("success") is not True:
    sys.exit("The API did not report a successful request.")

rates = data.get("rates")
if not isinstance(rates, dict) or "MUMB-18k" not in rates:
    sys.exit("The requested symbol is missing from the response.")

timestamp = data.get("timestamp")
try:
    observed_at = datetime.fromtimestamp(timestamp, tz=timezone.utc)
except (TypeError, ValueError, OverflowError, OSError):
    sys.exit("The response timestamp is missing or invalid.")

print("Base:", data.get("base"))
print("Symbol: MUMB-18k")
print("Raw rate:", rates["MUMB-18k"])
print("Timestamp UTC:", observed_at.isoformat())
print("Date label:", data.get("date"))
print("Unit, if returned:", data.get("unit", "not provided"))

Run it with METALS_API_KEY set in your environment. A successful request that lacks MUMB-18k should not silently fall back to another gold symbol: surface the problem and check your subscription and the symbol specifications.

Using Decimal for JSON floating-point values helps avoid introducing binary floating-point rounding into subsequent financial calculations. It does not establish the quote’s unit or make the raw rate a customer-facing price; those require separate validation.

Turn a verified quote into a usable price

Store the raw rate together with the symbol, base, provider timestamp, and any returned unit. Add a normalized price only after you have verified what one unit of the raw rate represents. Keep the raw observation so you can audit or correct a conversion later without losing its source.

If a verified rate represents grams per unit of the base currency, its reciprocal represents base-currency units per gram. If it already represents currency per gram, inverting it would be wrong. Similarly, the presence of an inverse field in the supplied XAU response is not evidence that one exists for MUMB-18k.

A troy ounce is approximately 31.1034768 grams. Only use that conversion when the quote you have verified is actually per troy ounce; a rate already specified per gram should not be divided by the troy-ounce weight again. Eighteen-karat gold is 75% gold by purity, but do not multiply an already 18k-specific quote by 75% a second time.

For retail pricing, keep the reference quote separate from your own making charges, taxes, spreads, and rounding rules. A reference rate is not necessarily a firm buy or sell quote, and an old cached value should not be presented as current without a visible freshness policy.

Polling versus webhook-style delivery

Recommendation: start with Metals-API polling for this symbol, then add your own event delivery if other systems need notifications. The supplied endpoint information establishes a latest-rate API and a streaming option, but does not establish a native webhook contract for MUMB-18k. Do not design around provider-sent webhook events without confirming current support in the documentation.

Poll once, distribute many times

Run a scheduled backend task that requests the latest rate, validates the response, and updates a shared cache. Product pages, pricing jobs, and alerting rules can read that cache instead of each making their own request. This reduces request volume and gives all consumers a consistent observation.

Choose a schedule based on the update frequency available on your plan and the freshness your application requires. Polling more frequently than the source updates can repeatedly return the same observation; it does not make that observation newer. Add a small scheduling buffer, use bounded retries with backoff after failures, and avoid launching a new request while an earlier one is still in flight.

Record both the provider timestamp and the time your service fetched the response. The difference helps distinguish an old source observation from a recent retrieval. Define a maximum acceptable age for your use case; once exceeded, mark the cache as stale and decide whether to pause automatic repricing or show a clearly labelled last-known value.

Add notifications when consumers need them

If your ERP or alert service needs push-style delivery, your poller can publish an internal event after it accepts a new observation. A separate service can then send webhook notifications to authorized consumers. That webhook is part of your architecture, not a claim that the latest endpoint itself sends webhooks.

Give each event a stable identity derived from the accepted observation, make consumers idempotent, and retry failed deliveries without applying the same price change twice. Decide whether to emit an event for every new provider timestamp or only when a verified, normalized price changes. For threshold alerts, define whether the threshold is evaluated against the last observed price or the last alerted price.

Metals-API also describes a WebSocket streaming endpoint. Check the documentation for current authentication, symbol support, plan access, and message details before considering it as an alternative to polling. Streaming, polling, and webhooks solve different parts of the problem: a stream delivers provider updates over a connection, while a webhook notifies a receiving service through your chosen delivery workflow.

Handle closures, failures, and operational checks

Weekends and market closures can leave the latest available observation unchanged. An unchanged rate is not automatically an error, but neither should it be treated as a fresh trading quote merely because the API request succeeded. Display the observation time and apply your own stale-data policy.

During an outage, preserve the last accepted observation rather than overwriting it with a missing value. Alert operators when refreshes repeatedly fail or the source timestamp becomes too old. Do not continue automatic customer repricing indefinitely on a stale quote unless that behavior has been explicitly approved for the business workflow.

Use UTC internally for timestamps and convert to the user’s local timezone only for display. Keep the API’s date label separately: a date without a time or timezone is not a substitute for the timestamp when you need to measure freshness.

Before launch, test a missing symbol, an unsuccessful response, a malformed response, an expired cache entry, and duplicate downstream notifications. Confirm account permissions and the exact symbol description using the tracked Symbols page, and use the tracked Documentation for current integration details.

FAQ

Does a successful latest request guarantee a usable Mumbai price?

No. Check that MUMB-18k is present, then verify its unit, base, direction, and timestamp. The supplied example response is for XAU, so it cannot verify the Mumbai quote.

Can I receive a native webhook for this symbol?

Confirm current webhook support with Metals-API before depending on it. In the meantime, a scheduled poller can publish your own webhook events after validating a new observation.

How often should I poll?

Match your schedule to your plan’s update frequency and your freshness requirement. Polling faster than the underlying updates may consume requests without producing new data.

Should I convert the rate from ounces to grams?

Only if the verified rate is ounce-based. If the Mumbai symbol’s returned rate is already per gram, applying an ounce-to-gram conversion again would distort it.

Ready to test the integration? Get a free API key through Metals-API Register, or use the tracked Register link. Check current plan and symbol availability before deploying; for an additional integration option, see MCP.