netlify / netlify/cli

"TextHTTPError: Not Found" when calling API method getSiteEnvVars

Open
#7,709 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
1.9k
Forks
474
Avg merge
23h 30m
Merged PRs (30d)
53

Description

Describe the bug

I am trying to retrieve information on site environment variables via getEnvVars and getSiteEnvVars using curl and the Netlify CLI. The combination of getSiteEnvVars with Netlify CLI fails for me with TextHTTPError: Not Found. Maybe it's just a typo in my commands, but I don't see it.

I have noticed that in the documentation when clicking on
GET /api/v1/sites/{site_id}/env
it shows
https://api.netlify.com/api/v1/api/v1/sites/{site_id}/env
This is wrong (duplicate /api/v1). Might be unrelated, but if I try with that path I get a Not Found error with curl too.

Steps to reproduce
  • make sure Netlify CLI and curl are installed and variables MY_TOKEN, MY_ACCOUNT_ID and MY_SITE_ID are set and point to an existing account / site.
  • run the following commands
# getEnvVars via curl
curl -s -H "Authorization: Bearer ${MY_TOKEN}" "https://api.netlify.com/api/v1/accounts/${MY_ACCOUNT_ID}/env?site_id=${MY_SITE_ID}"
# getSiteEnvVars via curl
curl -s -H "Authorization: Bearer ${MY_TOKEN}" "https://api.netlify.com/api/v1/sites/${MY_SITE_ID}/env"
# getEnvVars via CLI
netlify api getEnvVars --data '{ "account_id": "'${MY_ACCOUNT_ID}'", "site_id": "'${MY_SITE_ID}'" }'
# getSiteEnvVars via CLI
netlify api getSiteEnvVars --data '{ "site_id": "'${MY_SITE_ID}'" }'
  • see that the last command fails with exit code 1 and error message → › TextHTTPError: Not Found
Configuration

(no local project needed)

Environment

System:
OS: macOS 26.0.1
Shell: 5.9 - /opt/homebrew/bin/zsh
Binaries:
Node: 22.20.0 - /Users/johndoe/.nvm/versions/node/v22.20.0/bin/node
npm: 11.6.2 - /Users/johndoe/.nvm/versions/node/v22.20.0/bin/npm
npmGlobalPackages:
netlify-cli: 23.9.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented getSiteEnvVars command with the Netlify CLI and curl, then compare the requested path with the OpenAPI operation at the linked documentation URL. Trace how the CLI builds the getSiteEnvVars request and verify that the endpoint and documentation use the intended path without a duplicated /api/v1; done means the command succeeds against an existing site.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.