supabase link / projects api-keys: 403 insufficient privileges, but identical token succeeds via direct API call
@7ttp is already working on this.
Since Aug 31, 2026.
Assessment
This issue has not been assessed yet.
Description
supabase link / supabase projects api-keys fail with "insufficient privileges" while the identical token succeeds via direct API call
Bug report
supabase link (and supabase projects api-keys) fail with an "insufficient privileges" error, while the exact same personal access token, hitting the equivalent Management API endpoint, succeeds via a plain curl call.
Environment
- CLI version:
2.116.0(also reproduced on2.107.0before upgrading) - OS: macOS (Darwin 25.6.0)
- Install method: Homebrew
- Org plan: Pro, Owner role, billing/payment method on file
Steps to reproduce
supabase link --project-ref <ref>
Output:
{"_tag":"Error","error":{"code":"LegacyLinkProjectStatusError","message":"Unexpected error retrieving remote project status: {\"message\":\"Your account does not have the necessary privileges to access this endpoint. For more details, refer to our documentation https://supabase.com/docs/guides/platform/access-control\"}"}}
supabase projects api-keys --project-ref <ref> fails the same way.
Proof the token itself is fine
Using the same SUPABASE_ACCESS_TOKEN the CLI is resolving (verified via env var, not --profile, see below), a direct call to the Management API succeeds:
curl -s -o /dev/null -w "%{http_code}\n" -X GET \
"https://api.supabase.com/v1/projects/<ref>" \
-H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN"
# => 200
Same token, same project, same account — CLI rejects it, raw REST call accepts it.
What we ruled out
- Token scope — token has full scope, confirmed via the dashboard.
- Org role — Owner.
- Billing — payment method on file, no past-due invoices.
- Plan tier — Pro.
- CLI version — reproduced on both 2.107.0 and the latest 2.116.0 at time of filing.
- Local CLI state/cache — deleted
~/.supabase/profileand other local CLI state, re-authenticated from scratch, still reproduces. --profileisolation — also found that--profiledoesn't appear to isolate credentials as expected (logging a token under an unrelated profile name still authenticated as the real account), so we're resolving the token viaSUPABASE_ACCESS_TOKENenv var instead, not--profile. Not certain this is related to the 403, flagging in case it's the same root cause (e.g. profile/account resolution picking the wrong context internally before the privilege check).
Impact
Can't use supabase link / supabase db push / supabase projects api-keys at all against this project. Working around it by scripting equivalent calls directly against the Management API (POST /v1/projects/{ref}/database/query), which work fine and confirms the backend/account itself has no permission issue — this looks CLI-internal.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 523
- Avg merge
- 21h 33m
- Merged PRs (30d)
- 258
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/cli
-
🐛 Bug supabase/cli
-
🐛 Bug supabase/cli
-
Local Kong keeps idle upstream connections longer than PostgREST, causing sporadic 502 on POST/PATCH Open🐛 Bug supabase/cli
-
✨ Feature supabase/cli
-
🐛 Bug supabase/cli
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·