Restrict Supabase Postgres access by IP allowlist and clear network bans through 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. Read current state: GET /v1/projects/{ref}/network-restrictions. The response includes 'entitlement' ('allowed' or 'disallowed') and 'config' with dbAllowedCidrs and dbAllowedCidrsV6.
  2. Replace the entire allowlist: POST /v1/projects/{ref}/network-restrictions/apply with {"dbAllowedCidrs":["203.0.113.0/24"],"dbAllowedCidrsV6":["2001:db8::/32"]}.
  3. For automation, prefer the incremental form: PATCH /v1/projects/{ref}/network-restrictions with {"add":{"dbAllowedCidrs":["203.0.113.0/24"]},"remove":{"dbAllowedCidrs":["198.51.100.0/24"]}} so concurrent changes do not clobber each other.
  4. Before enforcing, enumerate every source that connects directly to Postgres: CI runners, migration jobs, BI tools, pgbouncer clients, your own laptop.
  5. List active IP bans: POST /v1/projects/{ref}/network-bans/retrieve returns {"banned_ipv4_addresses":[...]}; POST /v1/projects/{ref}/network-bans/retrieve/enriched adds detail.
  6. Clear a ban with DELETE /v1/projects/{ref}/network-bans.
  7. Verify the result from both an allowed host and a disallowed host before declaring the lockdown effective.
  8. Official documentation: https://supabase.com/docs/guides/platform/network-restrictions | https://api.supabase.com/api/v1-json

Known gotchas

Related routes

Subscribe to realtime Postgres changes in Supabase
supabase.com · 4 steps · unrated
Run ad-hoc SQL and manage migrations against a Supabase project through the Management API query endpoint
supabase.com · 8 steps · unrated
Set, list, and delete Supabase Edge Function secrets (environment variables) via the Management API
supabase.com · 8 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