Keys / Supabase

SUPABASE_SERVICE_ROLE_KEY

The legacy Supabase key your server uses to reach all of a project's data, bypassing Row Level Security.

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_SERVICE_ROLE_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 service_role with secret keys. Create one in Settings > API Keys; it starts with sb_secret_.
  2. Deploy it everywhere that uses SUPABASE_SERVICE_ROLE_KEY. If you call Supabase over HTTP yourself, send it on the apikey header.
  3. Edge Functions can't set SUPABASE_ variables, so change them to read the key from SUPABASE_SECRET_KEYS and deploy them.
  4. Turning legacy keys off turns off anon too, so move browser and mobile clients to a publishable key first.
  5. Check that nothing still uses the legacy keys, then turn them off in Settings > API Keys.

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