📄 SKILL.md

← Vault

name: supabase-cli-link-database-password

description: How to link a Supabase Cloud project with the CLI when you don't have the database password visible

category: devops


Supabase CLI Link — When You Don't Have the DB Password

The Problem

supabase link --project-ref --password requires the Postgres database password. Supabase Cloud shows this password only once at project creation in the Dashboard (Settings → Database). It is NOT retrievable via the Management API (api.supabase.com/v1/projects).

Attempted Approaches & Why They Failed

1. Management API — Cannot get DB password. Only returns: project id, ref, region, DB host, version.

2. Browser Dashboard — Session doesn't persist reliably in automation contexts.

3. Supabase CLI link — Requires password upfront.

4. /etc/supabase/config.toml — No local config since project was created in the cloud.

What DOES Work

Option A: Dashboard SQL Editor (zero CLI)

1. Go to https://supabase.com/dashboard/project//sql/new

2. Paste and run your migration SQL directly

3. Works without any password

Option B: If you have a local Supabase project linked

If you've previously cloned a Supabase project with supabase init && supabase link, the local supabase/config.toml contains the password. Check:

`bash

cat supabase/config.toml | grep -i password

`

Option C: Reset the database password

In Dashboard → Settings → Database → Reset password. This gives you a new password you can use with the CLI. WARNING: breaks any existing connections.

Verified API Endpoints (Management API)

`bash

List your projects

curl "https://api.supabase.com/v1/projects" \

-H "Authorization: Bearer "

Get project info (no password)

curl "https://api.supabase.com/v1/projects/" \

-H "Authorization: Bearer "

Returns: id, ref, organization_id, name, region, status, database{host, version}

Get API keys

curl "https://api.supabase.com/v1/projects//api-keys" \

-H "Authorization: Bearer "

Returns: anon key, service_role key (both work for REST API)

Update auth providers (Google OAuth, etc.)

curl -X PATCH "https://api.supabase.com/v1/projects//config/auth" \

-H "Authorization: Bearer " \

-H "Content-Type: application/json" \

-d '{"external_google_enabled": true, "external_google_client_id": "...", "external_google_secret": "..."}'

`

Key Limitation

The Management API cannot configure database-level settings (like resetting the password, viewing connection string, or running migrations). For that you need either: