Skip to main content
If you’re running Kodus on your own infrastructure, the CLI works the same way — you just need to point it to your API.

Connect to Your Instance

1

Set the API URL

Tell the CLI where your Kodus API lives. Pick one method:
HTTPS is required. The CLI rejects non-HTTPS URLs for security. The only exception is localhost and 127.0.0.1 for local development.
Priority order: KODUS_API_URL env var > ~/.kodus/config.json apiUrl > default (https://api.kodus.io).
2

Authenticate

3

Verify the Connection

kodus status shows the authentication mode detected locally. To check the API URL, add --verbose to a command that calls the API. For example, with a team key that allows repository configuration, run:

Cloudflare Access (Zero Trust)

If your self-hosted API is behind Cloudflare Access, the CLI supports service token authentication.
When both the client ID and the secret are set, the CLI sends CF-Access-Client-Id and CF-Access-Client-Secret headers on every API request. Priority: env vars > config file.

Config File Reference

The CLI stores configuration in ~/.kodus/config.json:
The config file is created with 0600 permissions (owner read/write only). The directory ~/.kodus/ is created with 0700 permissions.

Environment Variables Summary

CI/CD Integration

For self-hosted instances in CI/CD pipelines, set the API URL and a team key as environment variables. A fresh checkout has no uncommitted changes, so review the branch against its base with --branch. The base branch must be available in the checkout, so fetch the full history.
Use --fail-on error or --fail-on critical to fail the pipeline when issues above a severity threshold are found. Pull requests are reviewed by the Git integration, so they need no pipeline job.

Distributing to Your Team

Share the CLI installation instructions and your self-hosted API URL with your team. Each teammate sets KODUS_API_URL in their shell profile or apiUrl in ~/.kodus/config.json. Provide the team key through your secret manager and set it as KODUS_TEAM_KEY before using the CLI.

Troubleshooting

The CLI requires HTTPS for all non-localhost URLs. It then falls back to the default https://api.kodus.io, so read the message before you authenticate. Make sure your self-hosted instance has a valid TLS certificate. If you’re testing locally, use http://localhost:<port> instead.
  • 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_ID and CF_ACCESS_CLIENT_SECRET are set
  • Use --verbose to see the exact URL being used
  • Run kodus status to check your current auth state
  • If using a team key, verify it’s still Active under Organization → CLI keys in your self-hosted web app
  • If using personal login, the CLI refreshes your login automatically; if the refresh fails, run kodus auth login again
  • Make sure KODUS_API_URL points to the correct instance
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 /api or similar)
  • Cloudflare Access credentials are configured if applicable
  • The reverse proxy is forwarding requests correctly
Your self-hosted instance may enforce device limits per organization. The web app has no device list to clean up, so contact your admin to increase the limit (the API’s CLI_DEVICE_LIMIT setting; 0, the default, means no limit).