Clatter LabsHelp Center

How do I stop my API key from appearing in my app's logs?

FAQUpdated

Keys often leak through logs, because a request's headers get printed in full.

  • Don't log headers wholesale. Log the method, path, status and error code.
  • Redact Authorization and any string starting with clsk_.
  • Log ids instead: the Model API's X-Request-Id or the Agent API run id.
  • Check error trackers too; some capture headers by default.

Good to know#

  • Never put a key in front-end code, a mobile app, a public repo or a screenshot.
  • Give each integration its own key with only the permissions it needs.
  • If a key may have leaked, revoke it first, then replace it.

Learn more#

Still need help?#

We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Related articles

Still need help?

Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyz
For deleting your whole account or the data of one service.