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
- Supabase replaces
service_rolewith secret keys. Create one in Settings > API Keys; it starts withsb_secret_. - Deploy it everywhere that uses
SUPABASE_SERVICE_ROLE_KEY. If you call Supabase over HTTP yourself, send it on theapikeyheader. - Edge Functions can't set
SUPABASE_variables, so change them to read the key fromSUPABASE_SECRET_KEYSand deploy them. - Turning legacy keys off turns off
anontoo, so move browser and mobile clients to a publishable key first. - 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.