Authentication
Sign the CLI in with an API key using the auth command, environment variables or a credentials file.
The CLI needs your server URL and an API key. Pick one of three ways to provide them.
Create an API key
Open dashboard/settings/profile and click Generate New Key in API/CLI Keys. You need the permission to create keys; admins always have it.
Keys never expire by default. Set an expiration date for keys used by scripts, CI jobs or anything off your machine.
Methods
| Method | Use it for | Priority |
|---|---|---|
auth command | Your own machine, once | Lowest |
W3PANEL_URL and W3PANEL_API_KEY | CI jobs and scripts | Above the saved login |
--env-file | A per-command credentials file | Highest; ignores the environment and saved login |
auth command
wtree-cloud-cli auth -u https://panel.example.com -t YOUR_API_KEY| Option | What it does |
|---|---|
-u, --url <url> | URL of your wtree Cloud server. |
-t, --token <token> | API key from your dashboard. |
It validates the credentials, then saves them readable only by you in ~/.config/w3panel/cli.json ($XDG_CONFIG_HOME/w3panel/cli.json if set, %APPDATA%\w3panel\cli.json on Windows). Run it once; the login survives CLI upgrades.
Environment variables
export W3PANEL_URL="https://panel.example.com"
export W3PANEL_API_KEY="YOUR_API_KEY"Set both or neither. If only one is set, the CLI stops and names the missing one instead of pairing it with the saved login.
Credentials file
W3PANEL_URL="https://panel.example.com"
W3PANEL_API_KEY="YOUR_API_KEY"wtree-cloud-cli --env-file ./wtree-cloud.env project allThe CLI never reads a .env file on its own, so a .env in a cloned project can't redirect your key to another server. Bun loads .env from the current directory by itself; when the CLI runs on Bun and that file sets W3PANEL_URL or W3PANEL_API_KEY, the CLI refuses environment credentials. Pass the file with --env-file, or run the CLI with Node.js or bun --no-env-file.
Verify
wtree-cloud-cli project all