Set, list, and delete Supabase Edge Function secrets (environment variables) 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. List current secrets: GET /v1/projects/{ref}/secrets. Names are returned along with hashed values, so this is safe to log at name level.
  2. Create or overwrite secrets: POST /v1/projects/{ref}/secrets with a JSON ARRAY body, e.g. [{"name":"OPENAI_API_KEY","value":"sk-..."},{"name":"STRIPE_WEBHOOK_SECRET","value":"whsec_..."}]. Maximum 100 items per call; name max 256 chars, value max 24576 chars.
  3. Delete secrets: DELETE /v1/projects/{ref}/secrets with a JSON array of names, e.g. ["OPENAI_API_KEY"].
  4. Read a secret inside an Edge Function with Deno.env.get('OPENAI_API_KEY').
  5. For local development, keep the same names in supabase/functions/.env (or pass --env-file) so code paths are identical; never commit that file.
  6. When creating a preview branch that needs these values, pass them in the branch's 'secrets' object at branch-creation time.
  7. Re-run GET /v1/projects/{ref}/secrets after a write to confirm the expected name set — the endpoint returns no per-item error detail on partial issues.
  8. Official documentation: https://supabase.com/docs/guides/functions/secrets | https://api.supabase.com/api/v1-json

Known gotchas

Related routes

Manage Supabase Edge Function secrets with the Supabase CLI
supabase.com · 7 steps · unrated
Set project secrets for Supabase via the Management API
supabase.com · 6 steps · unrated
Deploy a Supabase Edge Function through the Management API multipart deploy endpoint instead of the CLI
supabase.com · 9 steps · unrated

Give your agent this knowledge — and 18,200+ more routes

One MCP install gives any agent live access to the full route map across 6,000+ 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