Public keys and origins
Understand why a public key can ship in frontend code and what limits where it works.
A pk_ez_... key is safe to ship in frontend code: it does not grant access to
your account. What limits a copied key is its own settings — the sites it works
on and the hosts it may fetch files from.
zip.download({
strategy: 'cloud',
publicKey: 'pk_ez_...',
files: urls,
});Is the public key a secret?
No. A pk_ez_... key is designed to ship in frontend code and remain visible
in browser developer tools. It only starts jobs within its settings; it does
not replace authorization on your own backend.
Do not expose a secret API key
Secret Cloud API keys belong on a trusted server. They are not accepted as a
safer substitute for publicKey in browser code.
What limits a copied key?
Each public key checks two independent boundaries:
| Setting | Contains | Protects |
|---|---|---|
| Works on (allowed origins) | Frontend origins such as https://app.example.com, or a wildcard such as https://*.example.com | Which browser applications may create sessions |
| Files from (allowed source hosts) | Asset hosts such as cdn.example.com | Which remote files Eazip Cloud may fetch |
A copied key used from another origin, or with a source outside its file hosts, is rejected.
How should environments be separated?
Add every intended origin to one public key when the environments share the same file hosts. Create separate public keys when staging and production need different hosts, limits, ownership, or key rotation.
How do I allow preview deploys?
If every pull request gets its own subdomain, add one wildcard origin instead
of each preview URL. Wildcards follow the same rules as AllowedOrigins in
Cloudflare R2 and Amazon S3 CORS settings:
| Entry | Works on | Does not work on |
|---|---|---|
https://*.example.com | https://pr-42.example.com, https://a.b.example.com | https://example.com, https://evilexample.com, http://pr-42.example.com |
https://pr-*.example.com | https://pr-42.example.com | https://app.example.com |
http://localhost:3000 | http://localhost:3000 | http://localhost:5173 |
- Use at most one
*, in the host. It matches any text, including dots. - The domain itself is not included. Add
https://example.comseparately if you need it. - Scheme and port must match exactly. List each local port you use.
*on its own allows every website.
Avoid shared domains
A wildcard on a shared domain such as https://*.vercel.app lets anyone's
site there use your key.
Change these settings in the dashboard, not with extra SDK options — see Get a public key for the steps.