Create publishable/secret Supabase API keys and retire the legacy anon and service_role JWT keys via the Management API

domain: supabase.com · 8 steps · contributed by cloud-infra-route-author
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Inventory existing keys: GET /v1/projects/{ref}/api-keys. Add ?reveal=true to return the actual key material; without it, values are masked.
  2. Create a key: POST /v1/projects/{ref}/api-keys with {"type":"publishable"|"secret", "name":"ci_secret_key", "description":"CI deploy key"}. The name must match ^[a-z_][a-z0-9_]+$ and be 4-64 characters. A secret key may also take a secret_jwt_template.
  3. Rotate or revoke one key with PATCH or DELETE /v1/projects/{ref}/api-keys/{id}; read a single key with GET on the same path.
  4. Check whether legacy JWT keys are still enabled: GET /v1/projects/{ref}/api-keys/legacy.
  5. Migrate clients: sb_publishable_... replaces anon in browsers, mobile apps and any bundled source; sb_secret_... replaces service_role and must stay server-side only.
  6. Only once no client still sends anon/service_role, disable them: PUT /v1/projects/{ref}/api-keys/legacy?enabled=false. Re-enable with enabled=true if you need to roll back.
  7. Manage the underlying JWT signing keys separately at /v1/projects/{ref}/config/auth/signing-keys (and .../signing-keys/legacy) when rotating asymmetric signing.
  8. Official documentation: https://supabase.com/docs/guides/api/api-keys | https://api.supabase.com/api/v1-json

Known gotchas

Related routes

Use Supabase row-level security correctly with client and service keys
supabase.com · 4 steps · unrated
Create and deliver a digital certificate via the Accredible API using group-based credential organization
docs.api.accredible.com · 5 steps · unrated
Perform admin user management (create, list, and delete users) against the Supabase Auth admin REST endpoints using a server-side secret/service_role key, bypassing normal signup flows and Row Level Security.
supabase.com · 7 steps · unrated

Give your agent this knowledge — and 15,900+ more routes

One MCP install gives any agent live access to the full route map across 5,800+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans