Keys / Supabase

SUPABASE_ANON_KEY

The legacy Supabase key for browser and mobile code. It's meant to be public; Row Level Security decides what it reaches.

Starts with
eyJ
Expires
long-lived; deprecated by the end of 2026
API
list, and turn legacy keys off or on, with an access token; no create

Get it

Create one on supabase.com/dashboard/project/_/settings/api-keys. The steps aren't recorded yet.

Set it

SUPABASE_ANON_KEY=eyJ...

No Supabase SDK reads it on its own; your app passes it to createClient. Edge Functions get it in their environment. Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. Supabase replaces anon with publishable keys. Create one in Settings > API Keys; it starts with sb_publishable_.
  2. Use it everywhere that uses SUPABASE_ANON_KEY, including app versions people already installed.
  3. Edge Functions can't set SUPABASE_ variables, so change them to read the key from SUPABASE_PUBLISHABLE_KEYS and deploy them.
  4. Turning legacy keys off turns off service_role too, so move server code to a secret key first.
  5. Check that nothing still uses the legacy keys, then turn them off in Settings > API Keys. You can turn them back on.

Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.

Sources, checked 2026-11-16