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
FieldFrom headerMeaning
cacheX-CacheWhether the result came from Zapi's cache.
age / cacheTtl / maxAgeAge, X-Cache-Ttl, X-Cache-Max-AgeCache age and lifetimes, in seconds.
zap.cost / zap.remainingX-Zap-Cost, X-Zap-RemainingWhat the call cost, and what the month has left.
rateLimitX-RateLimit-*Per-minute and monthly limit and remaining.
requestIdX-Request-IdThe call's id in Dashboard → Logs. Quote it in bug reports.
planExpiredX-Plan-ExpiredYour paid plan lapsed; free limits apply.
Edit this page on GitHubWas this page helpful? ·