Docs › Core › Response metadata
Response metadata
run() returns a promise with one extra method: .withMeta() resolves with the data and what the response said about itself. The request runs once either way.
meta.ts
const { data, meta } = await zpi
.run("finance:goldprice/spot", { currency: "IDR" })
.withMeta();
meta.cache; // "HIT" | "MISS" | "STALE" | …
meta.age; // seconds since a cached result was fetched
meta.zap; // { cost: 2, remaining: 178 } once Zap is on
meta.rateLimit; // { minute: { limit, remaining }, month: { limit, remaining } }
meta.requestId; // the id of this call in Dashboard → Logs
meta.responseTime; // server-side ms, the number the dashboard shows
meta.headers; // every response header| Field | From header | Meaning |
|---|---|---|
| cache | X-Cache | Whether the result came from Zapi's cache. |
| age / cacheTtl / maxAge | Age, X-Cache-Ttl, X-Cache-Max-Age | Cache age and lifetimes, in seconds. |
| zap.cost / zap.remaining | X-Zap-Cost, X-Zap-Remaining | What the call cost, and what the month has left. |
| rateLimit | X-RateLimit-* | Per-minute and monthly limit and remaining. |
| requestId | X-Request-Id | The call's id in Dashboard → Logs. Quote it in bug reports. |
| planExpired | X-Plan-Expired | Your paid plan lapsed; free limits apply. |
Edit this page on GitHubWas this page helpful? ·