// troubleshooting guide · supabase
Supabase 'Invalid API Key' Error (New Publishable and Secret Keys)
- Status
- Ongoing
- platforms:
- All clients, Edge Functions
- updated:
- November 22, 2026
- reports:
- 3
- Method
- how we research
RUNBOOK · supabase/invalid-api-key4 FIXES
// quick answer
Usually a disabled legacy key, a key from another project, or a secret key sent from the wrong place. Use the sb_publishable_ key in the apikey header and update Edge Function env vars.
Most likely fix: Use the new keys
How to fix it
// try these in order, the most common fix is first
FIX 1Use the new keys
- 01Open Project Settings > API Keys
- 02Copy the publishable key (sb_publishable_...) for client code
- 03Copy a secret key (sb_secret_...) for servers only
- 04Send them in the apikey header
Did this fix it?FIX 2Update Edge Functions
- 01Read SUPABASE_PUBLISHABLE_KEYS and SUPABASE_SECRET_KEYS instead of the old variables
- 02Redeploy the function
Did this fix it?FIX 3Temporary fallback
- 01Re-enable the legacy keys if the project still has them
- 02Migrate before the end-of-2026 deprecation
Did this fix it?FIX 4Check project match
- 01Confirm the URL ref and the key come from the same project
- 02Check the environment variables in your host (Vercel, Netlify) were redeployed
Did this fix it?
SANDBOX · supabase RUNS IN YOUR BROWSER
Try it: edit a table, call it from your app, run SQL
A hands-on Supabase-style sandbox, including the spots where users get stuck. See where problems like this one start. 1-2 minutes, nothing is saved.
Symptoms
Requests return 401 'Invalid API key', often after migrating to new keys or restoring a paused project.
Why it happens
- C-01Legacy anon/service_role key disabled during migration
- C-02Key copied from a different project
- C-03Restored paused project without legacy keys
- C-04Edge Function still reads SUPABASE_SERVICE_ROLE_KEY
- C-05Secret key used in browser code
// this guide also covers
- supabase invalid api key
- supabase publishable key
- supabase service_role deprecated
Still not working?
If Supabase keeps failing, you're not alone. See every Supabase problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usThe same problem in other apps
Other Supabase errors
- Supabase Project Paused
- Supabase Max Client Connections Reached
- Supabase 'New Row Violates Row-Level Security Policy' Error
- Supabase Confirmation Email Not Sending
- Supabase Auth Redirects to Localhost
- Supabase 'Invalid Refresh Token: Refresh Token Not Found'
- Supabase Edge Function 546 WORKER_LIMIT Error
- Supabase Storage Upload Failed