Examples
Help output
Behavior
When you runcontree auth, the CLI:
- Prompts for the token securely via
getpass(no echo, not stored in shell history) - Prompts for the project ID
- Verifies the token with the API (
GET /v1/whoami) - Writes credentials to
~/.config/contree/auth.ini - If the profile already exists, prompts for confirmation (use
-yto skip)
Flags
--token— API token (prompted securely if omitted)--url— API base URL (default:https://api.tokenfactory.nebius.com/sandboxes)--project— Project ID (prompted if omitted)--profile— Profile name (default:default)-y/--force— Overwrite existing profile without confirmation
Environment variable shortcuts
When CLI flags (--token, --url, --project) are not passed,
contree auth checks these environment variables before falling back
to an interactive prompt:
These variables are read only during
contree auth. Other commands
ignore them and read credentials strictly from the saved profile.
If the relevant variables are set, contree auth runs fully
non-interactively (no prompts):
auth list
contree auth list (alias auth ls, profiles) prints every saved
profile from auth.ini and verifies each one against the API with a
2-second timeout, adding a status column that tells you at a glance
which profiles are usable. Pass --offline to suppress the probe
entirely when you only want to inspect what is saved locally.
Possible status values:
ok– probe succeeded and the token has thelistpermissioninactive– probe succeeded but the token lacks thelistpermission, meaning sandboxes are disabled on this projecttimeout– probe did not complete within 2 secondserror– probe failed for another reason, such as a bad token or another network/API erroroffline– you passed--offline, so no probe was attempted
auth switch
contree auth switch NAME rewrites the active pointer in auth.ini
so subsequent commands resolve credentials from that profile. The
profile must already exist (created by contree auth --profile=NAME).
Switching does not touch token data, so it is safe to run as often as
you like to bounce between projects.
auth remove
contree auth remove NAME (aliases rm, del) deletes the profile
from auth.ini and removes its per-profile session database
(sessions-NAME.db). If the deleted profile was the active one, the
CLI promotes the first remaining profile to active (or falls back to
default if none remain). Confirmation is required unless -y is
passed.
Alternative authentication
Runtime commands always read credentials from the saved profile. To authenticate without an interactiveauth flow, either:
CONTREE_TOKEN alone (without first running contree auth)
will not authenticate runtime commands.
See also
- Install & Authenticate – full authentication guide
- Configuration & Profiles – config file format and precedence