HomeAdvanced FeaturesAPI Keys
all
3 min read

API Keys

API keys allow external applications — and your own storefront — to interact with your store's data. There are two types: Publishable (safe for client-side) and Secret (server-side only).

Key types

TypeSafe to exposeUsed for
Publishable keyYes (in browser)Storefront product browsing, cart, checkout
Secret keyNo — keep privateServer-side admin operations

Where keys are used

Publishable key: Your storefront's environment variables contain the publishable key. It's sent with every storefront API request to identify your store to the backend. It's visible in browser requests — that's intentional and safe.

Secret key: Used by server-side scripts, webhooks, and admin API calls. Never include in frontend code or commit to a public repository.

Viewing your keys

Go to Settings → API Keys in the admin panel.

You'll see:

  • All publishable keys (with their labels and creation dates)
  • A button to create new keys
  • A "Revoke" option for each key

Secret keys are only shown once at creation time and cannot be retrieved afterward.

Creating a new API key

1
Go to Settings → API Keys
Click "+ New API key".
2
Select the type
Choose "Publishable" (for storefront use) or "Secret" (for server-side scripts).
3
Add a label
Label it with its intended use (e.g. "Production Storefront", "Admin Script", "Integration Sync").
4
Copy and save the key
For secret keys, copy the key immediately — it won't be shown again. Save it to your server environment variables or a secrets manager.
🔥Important

If you accidentally expose a secret key (e.g. commit it to a public repository), revoke it immediately and create a new one. Treat it like a compromised password — assume it's been seen.

Revoking a key

Open the key in Settings → API Keys and click Revoke. Any system using the revoked key will immediately lose access. Make sure you update all dependent services before revoking a production key.

Your storefront's publishable key

Your storefront was configured with a publishable key at setup time. This key is stored in your storefront's environment variables. If you ever need to rotate it (e.g. security audit):

  1. Create a new publishable key in Settings → API Keys
  2. Update your storefront's environment variable with the new key
  3. Redeploy the storefront
  4. Revoke the old key only after confirming the new one is working
Related Articles
API Keys — Sokobuni Learn