Creating a key
Create keys from the dashboard. A key looks like this:Using a key
Send it as theX-API-Key header:
Rotating a key
Rotation is create, migrate, revoke, in that order:- Create the new key.
- Deploy it wherever the old one is used.
- Confirm traffic has moved. The dashboard shows when each key was last used.
- Revoke the old key.
If a key leaks
Revoke it first, ask questions second. A revoked key cannot be used again, and revocation is instant. Then check usage in the dashboard for calls you do not recognise. If you find any, write to [email protected] with the key prefix and roughly when you think it leaked, and we will help you work out what was called. Keys committed to a public repository are found by scanners in minutes, so treat any key that has ever touched a commit as leaked, even if you removed it in a later commit. Git history keeps it.Keeping keys out of your code
Read the key from the environment rather than pasting it into source:Publishable keys
There is one exception, and it is a separate kind of key. A publishable key starts withhf_pk_ and is designed to sit in your page source, because it authenticates the Logo endpoint — and an <img> tag cannot send a header.
A publishable key serves logos and nothing else. It cannot call /v1/web/scrape or any other endpoint; those return 401. That boundary is what makes it safe to publish, so treat the two kinds differently:
You can lock a publishable key to your own domains, which refuses requests whose
Referer/Origin does not match. That stops a key lifted from your HTML being casually reused elsewhere. It is not access control — Referer is set by the client — and it does not apply to images already sitting in the CDN cache, so treat it as friction rather than a boundary.
A leaked publishable key is not the emergency a leaked secret key is: the worst case is someone else’s site consuming your logo allowance. Revoke it and issue a new one; already-cached images may keep serving for up to a day.