# Treasury Id — Zapi reference > Treasury's current retail gold quote in rupiah — what the app buys at and sells **Base URL:** `https://api.zpi.web.id` **Auth:** Send `x-api-key: YOUR_KEY` header on every request. Get a free key at https://zpi.web.id/dashboard/keys. **Response envelope:** `{ content, message, errors }` **Rate limit:** 60 req/min on free tier. **Related:** - Detail page: https://zpi.web.id/api/finance/treasury-id - Endpoint catalog: https://zpi.web.id/category/finance - Concise index: https://zpi.web.id/llms.txt - Full reference: https://zpi.web.id/llms-full.txt --- ## Treasury Id **Category:** finance · **Slug:** `treasury-id` **Detail page:** https://zpi.web.id/api/finance/treasury-id Treasury's current retail gold quote in rupiah — what the app buys at and sells **Tags:** finance, treasury-id ### Gold Price Treasury's current retail gold quote in rupiah — what the app buys at and sells - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:treasury-id/gold-price` - **Cache TTL:** 900s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `x` | string | query | no | Unused — the current price takes no parameters. | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:treasury-id/gold-price?x=" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:treasury-id/gold-price?x=", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:treasury-id/gold-price?x=", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "asOf": "2026-08-21T09:23:00", "metal": "gold", "spread": 87611, "dataset": "gold-price", "asOfText": "21/08/26 - 09:23", "buyPrice": 2655779, "currency": "IDR", "movement": "profit", "provider": "treasury-id", "unitGram": 1, "changeAbs": 30090, "sellPrice": 2568168, "changePercent": 1.15 } ``` --- ### Gold History Treasury's retail gold price series in rupiah. The API decides its own - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:treasury-id/gold-history` - **Cache TTL:** 3600s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `period` | enum(1d|1w|1m|3m|6m|1y|5y) | query | no | Window ending now. Default 1m. Ignored when startDate is given. | | `startDate` | string | query | no | Explicit window start, YYYY-MM-DD. Overrides period. | | `endDate` | string | query | no | Explicit window end, YYYY-MM-DD. Defaults to now. | | `type` | enum(daily|last_price) | query | no | Upstream series mode. Default daily. | | `order` | enum(asc|desc) | query | no | Oldest first (asc) or newest first (desc). Default asc. | | `page` | number | query | no | Page of points. Default 1. | | `limit` | number | query | no | Points per page. Default 500, max 2000. | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:treasury-id/gold-history?period=1m&startDate=2026-01-01&endDate=2026-08-20&type=daily&order=asc&page=1&limit=500" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:treasury-id/gold-history?period=1m&startDate=2026-01-01&endDate=2026-08-20&type=daily&order=asc&page=1&limit=500", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:treasury-id/gold-history?period=1m&startDate=2026-01-01&endDate=2026-08-20&type=daily&order=asc&page=1&limit=500", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "page": 1, "type": "daily", "count": 31, "items": [ { "time": "2026-07-22T00:00:00", "spread": 81942, "buyPrice": 2484171, "timeText": "22/07/26 - 00:00", "sellPrice": 2402229 }, { "time": "2026-07-23T00:00:00", "spread": 81524, "buyPrice": 2474085, "timeText": "23/07/26 - 00:00", "sellPrice": 2392561 }, { "time": "2026-07-24T00:00:00", "spread": 80332, "buyPrice": 2438342, "timeText": "24/07/26 - 00:00", "sellPrice": 2358010 }, { "time": "2026-07-25T00:00:00", "spread": 80193, "buyPrice": 2432033, "timeText": "25/07/26 - 00:00", "sellPrice": 2351840 }, { "time": "2026-07-26T00:00:00", "spread": 82067, "buyPrice": 2421212, "timeText": "26/07/26 - 00:00", "sellPrice": 2339145 }, { "time": "2026-07-27T00:00:00", "spread": 81272, "buyPrice": 2464130, "timeText": "27/07/26 - 00:00", "sellPrice": 2382858 }, { "time": "2026-07-28T00:00:00", "spread": 81159, "buyPrice": 2460448, "timeText": "28/07/26 - 00:00", "sellPrice": 2379289 }, { "time": "2026-07-29T00:00:00", "spread": 80385, "buyPrice": 2437428, "timeText": "29/07/26 - 00:00", "sellPrice": 2357043 } ], "metal": "gold", "order": "asc", "total": 31, "period": "1m", "dataset": "gold-history", "endDate": "2026-08-21", "hasMore": false, "currency": "IDR", "movement": "profit", "nextPage": null, "provider": "treasury-id", "unitGram": 1, "changeAbs": 171608, "startDate": "2026-07-22", "changePercent": 6.91 } ``` --- _Generated: 2026-08-21T07:42:06.983Z_