Connect to Your Instance
Set the API URL
Tell the CLI where your Kodus API lives. Pick one method:Add this to your shell profile (Priority order:
- Environment Variable (Recommended)
- Config File
- Inline (One-off)
~/.bashrc, ~/.zshrc, etc.) to make it permanent:KODUS_API_URL env var > ~/.kodus/config.json apiUrl > default (https://api.kodus.io).Authenticate
- Team Key (Recommended)
- Personal Login
- CI/CD Token
Generate a team key from your self-hosted Kodus dashboard and configure it:Or use the installer with both API URL and team key:
Cloudflare Access (Zero Trust)
If your self-hosted API is behind Cloudflare Access, the CLI supports service token authentication.- Environment Variables
- Config File
CF-Access-Client-Id and CF-Access-Client-Secret headers on every API request when configured. Priority: env vars > config file.
Config File Reference
The CLI stores configuration in~/.kodus/config.json:
| Field | Required | Description |
|---|---|---|
apiUrl | No | Your self-hosted API URL. Overridden by KODUS_API_URL env var. |
teamKey | No | Team API key (starts with kodus_). Overridden by KODUS_TEAM_KEY env var. |
teamName | No | Display name for the team. |
organizationName | No | Display name for the organization. |
cfAccessClientId | No | Cloudflare Access client ID. Overridden by CF_ACCESS_CLIENT_ID env var. |
cfAccessClientSecret | No | Cloudflare Access client secret. Overridden by CF_ACCESS_CLIENT_SECRET env var. |
The config file is created with
0600 permissions (owner read/write only). The directory ~/.kodus/ is created with 0700 permissions.Environment Variables Summary
| Variable | Description |
|---|---|
KODUS_API_URL | Self-hosted API endpoint (HTTPS required, except localhost) |
KODUS_TEAM_KEY | Team key for shared access |
KODUS_TOKEN | CI/CD token for pipelines |
CF_ACCESS_CLIENT_ID | Cloudflare Access client ID |
CF_ACCESS_CLIENT_SECRET | Cloudflare Access client secret |
KODUS_VERBOSE | Set to true to see the resolved API URL and request details |
CI/CD Integration
For self-hosted instances in CI/CD pipelines, set the API URL and authentication as environment variables:- GitHub Actions
- GitLab CI
- Generic
Distributing to Your Team
To onboard your team in one command, combine the API URL with the skill installer:Troubleshooting
Security Error: API URL must use HTTPS protocol
Security Error: API URL must use HTTPS protocol
The CLI requires HTTPS for all non-localhost URLs. Make sure your self-hosted instance has a valid TLS certificate. If you’re testing locally, use
http://localhost:<port> instead.Connection refused or timeout
Connection refused or timeout
- Verify the URL is reachable:
curl -I https://kodus-api.yourcompany.com - Check if a firewall or VPN is blocking the connection
- If behind Cloudflare Access, ensure
CF_ACCESS_CLIENT_IDandCF_ACCESS_CLIENT_SECRETare set - Use
--verboseto see the exact URL being used
Authentication failed (401)
Authentication failed (401)
- Run
kodus auth statusto check your current auth state - If using a team key, verify it’s valid on your self-hosted dashboard
- If using personal login, tokens expire after 1 hour — the CLI auto-refreshes, but you may need to re-login if the refresh token is also expired
- Make sure
KODUS_API_URLpoints to the correct instance
API returned invalid response (expected JSON, got HTML)
API returned invalid response (expected JSON, got HTML)
This usually means the URL is hitting a reverse proxy, load balancer, or Cloudflare Access page instead of the actual API. Check:
- The URL path is correct (no trailing
/apior similar) - Cloudflare Access credentials are configured if applicable
- The reverse proxy is forwarding requests correctly
Device limit reached
Device limit reached
Your self-hosted instance may enforce device limits per organization. Contact your admin to increase the limit or remove old devices from the dashboard.