Documentation
Metals API
Professional usage documentation for the current Ratez public metals API, including authentication, parameter rules, derived bid/ask calculations, error handling, and implementation examples.
Overview
The current public API surface is intentionally small and focused. At this stage, the exposed endpoint is for metals only.
It returns live data from the current metals pricing table and supports optional spread widening or tightening through signed percentage or signed amount parameters.
This endpoint is suitable for simple downstream client integrations that need direct JSON rather than the rendered web UI.
Endpoint
https://ratez.my/api/metals
Method: GET
Format: JSON
Current scope: Metals only
Docs page: /ta/docs
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| APIKEY | string | Yes | Hardcoded key validation for the current client integration. |
| GAPPCT | signed double | No | Signed percentage used to derive tighter or wider bid/ask values from the base buy/sell values. |
| GAPAMT | signed double | No | Signed raw MYR amount used to derive tighter or wider bid/ask values from the base buy/sell values. |
Rule
Use either GAPPCT or GAPAMT, but never both in the same request. If both are provided, the API returns an error.
Calculation Rules
Default behavior
If neither GAPPCT nor GAPAMT is provided, the API returns raw buy/sell as bid/ask.
When using GAPPCT
bid = buy × (1 - GAPPCT / 100)
ask = sell × (1 + GAPPCT / 100)
Positive percentages widen the market. Negative percentages tighten it.
When using GAPAMT
bid = buy - GAPAMT
ask = sell + GAPAMT
Positive amounts widen the market. Negative amounts tighten it.
Worked Examples
Example A — GAPPCT = 2
Base values: buy = 500000, sell = 505000
Derived bid: 500000 × 0.98 = 490000
Derived ask: 505000 × 1.02 = 515100
Example B — GAPPCT = -0.5
Base values: buy = 500000, sell = 510000
Derived bid: 500000 × 1.005 = 502500
Derived ask: 510000 × 0.995 = 507450
Example C — GAPAMT = 3
Derived bid subtracts 3. Derived ask adds 3.
For example: buy = 1000 becomes bid = 997
For example: sell = 1005 becomes ask = 1008
Usage Examples
https://ratez.my/api/metals?APIKEY=YOUR_API_KEYhttps://ratez.my/api/metals?APIKEY=YOUR_API_KEY&GAPPCT=2https://ratez.my/api/metals?APIKEY=YOUR_API_KEY&GAPPCT=-0.5https://ratez.my/api/metals?APIKEY=YOUR_API_KEY&GAPAMT=3Response Shape
{
"ok": true,
"data": [
{
"id": 1,
"product": "GOLD : 1 KILO 999.9 (MYR)",
"prodTitle": "Gold : 1 Kilo 999.9 (MYR)",
"category": "gold",
"buy": 577423,
"sell": 581249,
"mid": 579336,
"bid": 577423,
"ask": 581249,
"spread": 3826,
"md5": "d199398f...",
"crDt": "2026-03-26T00:00:00.000Z",
"upDt": "2026-03-26T00:00:00.000Z"
}
],
"meta": {
"total": 9,
"gapPct": null,
"gapAmt": null,
"raw": true,
"currency": "MYR",
"timestamp": "2026-03-26T00:00:00.000Z"
}
}Error Conditions
- Missing APIKEY returns a validation error.
- Invalid APIKEY returns 401.
- Sending both GAPPCT and GAPAMT returns 400.
- Non-numeric GAPPCT or GAPAMT returns 400.
Related Navigation
This docs page is linked from the public top menu as Docs.
The rendered metals UI remains available at /ta/metals.
Additional API sections can be added later using the same docs structure.