Skip to main content

Authentication

The CloudX CLI supports two authentication methods:
  • Browser OAuth with cloudx auth login
  • API-key authentication with the CLOUDX_API_KEY environment variable
Use browser OAuth for interactive local work. Use an API key for CI, scheduled jobs, scripts, and other non-interactive environments.

Browser OAuth

cloudx auth login starts the browser-based OAuth sign-in flow and stores the resulting session locally.

Sign In

Run:
Follow the browser prompt, then return to your terminal.

Check Status

Run:
This command exits 0 when logged in and 1 when logged out or when the current sign-in session can’t be used. When the provisioning service is reachable, it also shows the active organization, account, role, and expiration details.

Sign Out

Run:
This signs out the current OAuth session stored by the CLI.

API Key

API-key authentication lets the CLI run without an interactive browser session. The CLI reads the key from CLOUDX_API_KEY and sends it to CloudX as a bearer token. When CLOUDX_API_KEY is set, the CLI uses it instead of any stored OAuth session. Only administrators can create, manage, and revoke API keys.

Create An API Key

  1. Open https://app.cloudx.io/settings/api-keys.
  2. Sign in as an administrator if prompted.
  3. Confirm you are on Settings > API Keys.
  4. Create an API key for your CLI workflow.
  5. Copy the key value when it is shown.
Choose permissions based on the commands the key needs to run:

Use The API Key

Set the key in your shell:
Then run CLI commands normally:
For CI or scheduled jobs, store the key in your secret manager and expose it to the job as CLOUDX_API_KEY.

Verify The API Key

Run:
With CLOUDX_API_KEY configured, the command validates the key with CloudX and prints API-key details such as key name, key ID, organization ID, account ID, account type, and permissions. If verification fails, check that CLOUDX_API_KEY is set to the full key value and that the key has not been deleted or revoked in CloudX.

Stop Using An API Key

Unset the environment variable:
After unsetting it, the CLI returns to using the stored OAuth session, if one exists. To revoke the key itself, an administrator must delete it from Settings > API Keys. cloudx auth logout only signs out the stored OAuth session. It does not revoke API keys.