- One key per app and environment, kept on your server in an environment variable or secrets manager, never in a browser or mobile app.
- A spend cap on each key, so a bug can’t spend your whole month’s credits.
- Branch on
meta.error_code, never on the message. - Handle
402:INSUFFICIENT_CREDITS(top up or wait for renewal) andSPEND_CAP_REACHED. - Handle
429: wait forRetry-Afterseconds, then retry. - Retry
5xxwith backoff. Failed calls cost nothing, so retries are safe. - Treat
404on a job as closed and drop it from your side. - Use cursors within the hour, with the same parameters; don’t store them.
- Narrow searches instead of paging deep: one search reaches at most 100 results.
- Watch
X-Credits-Remainingand alert before you run out. - Log
meta.request_idon errors, for support.
Guides
Go-live checklist
Check these before you ship