Authentication
1 min read
Browser Login (Recommended)
Run the login command to authenticate through your browser:
bash
opencx auth login
This opens a browser window where you sign in to your OpenCX account. On success, credentials are saved to ~/.opencx/credentials with 0600 file permissions so only your user can read them.
Environment Variable
For CI/CD or non-interactive environments, set the OPENCX_API_KEY environment variable:
bash
export OPENCX_API_KEY="your-api-key"
You can also override the API URL:
bash
export OPENCX_API_URL="https://api.your-instance.com"
Environment variables take precedence over stored credentials.
Troubleshooting
If you see the error:
Not authenticated. Run `opencx auth login` first.
Either run opencx auth login or set the OPENCX_API_KEY environment variable.