Save your key for the CLI
If you use thecelesto CLI, save your key one time and reuse it for every command:
API key lookup order
The CLI resolves the API key in this order:--api-keyflagCELESTO_API_KEYenvironment variable.envfile in the current directory- Key saved by
celesto auth login
Verify which credential a command uses
Each API key is bound to a single organization. Because the lookup order reads.env from the current working directory, the same command can target a different organization depending on where you run it. Run celesto auth status to see exactly which key and organization CLI commands use from your current directory:
- API URL: the endpoint commands target. Pass
--base-urlto check the credential saved for a different environment. - Credential: the exact source the key came from, such as the
CELESTO_API_KEYenvironment variable, a.envfile, or your saved login. - Organization: the organization the resolved key is bound to.
.env file in the current directory holds a different key than your saved login, celesto auth status names both organizations and tells you how to switch. Every other CLI command prints a one-time warning on stderr in that situation, naming the .env file that overrides the saved login. The warning goes to stderr, so --json output on stdout stays parseable.
To use your saved login instead of the .env key, run the command from another directory or pass --api-key explicitly.
Destructive commands also name the organization they act on: celesto computer delete includes it in the confirmation prompt, and celesto computer stop includes it in the result message. --force and --json skip the organization lookup, so scripted calls make no extra request.
Choose credentials for Python
CloudComputer checks these sources in order:api_key=passed in codeCELESTO_API_KEYin the process environment- The key saved by
celesto auth login
.env file into your environment yourself if you use one; the Python
cloud client reads the process environment directly. An environment key takes
precedence over a successful saved CLI login.Set the required permissions
Named API keys work withCloudComputer. Choose permissions for the actions
your application needs:The key’s owner also needs access to its organization. A valid key can still be
rejected when its permission or the owner’s membership is missing; the
error message identifies the required change.
Use an environment variable
auth.py
Pass the key in code
Passapi_key when you need to select credentials explicitly:auth_explicit.py
