Skip to main content
Early Access - The Dcycle CLI is currently available for enterprise customers. Contact us to learn more about access.

Logging In

The CLI uses the same credentials as the Dcycle web application.

Browser Login (Default)

This opens your default browser to the Dcycle sign-in page. You complete the full authentication flow in the browser (email, password, MFA, SSO) and the CLI receives the session automatically. Output:
If you have access to multiple organizations, the CLI prompts you to choose:
Browser login handles all authentication methods including SSO and MFA — no extra steps needed in the terminal.
If the browser can’t be opened automatically, the CLI prints a URL for you to open manually.

Terminal Login

Use --no-browser to authenticate directly in the terminal:
This prompts for email and password interactively. If your account has MFA enabled, the CLI also prompts for your TOTP code.
Terminal mode is used automatically when --email or --password flags are provided, or when stdin is not a TTY (e.g. in CI/CD pipelines).

Non-Interactive Login

For automation and scripting:

Login Flags

Avoid storing passwords in scripts. Consider using environment variables or secure secret management.

API Key Authentication

For CI/CD pipelines, scripts, and non-interactive environments, use API key authentication instead of browser login.

Setting Up an API Key

Store an API key in your local config:
Output:
If no organization is set yet, the CLI shows a tip:
If no host is configured yet, specify it with --host:

Using Environment Variables

You can also authenticate entirely via environment variables — no config file needed:
When DCYCLE_API_KEY is set, the CLI uses x-api-key header authentication instead of Bearer tokens. This is the recommended approach for CI/CD pipelines.

CI/CD Example (GitHub Actions)

Auth Method Priority

When both an API key and a login token are available, the API key takes precedence:
  1. API key (DCYCLE_API_KEY env var or api_key in config) — uses x-api-key header
  2. Login token (dcy auth login) — uses Authorization: Bearer header

Config File with API Key

Checking Session Status

View your current authentication state:
Output:
When using an API key, Auth method shows api_key instead of token. When not authenticated:

Verifying Credentials

Use --check to verify your stored credentials are still valid by calling the API:
When the session is valid:
When the session has expired (exit code 2):
Use --check in CI/CD pipelines to validate credentials before running commands:

JSON Response

With --check, the JSON response includes valid and check_error fields:

Logging Out

Output:
If not currently logged in:
This removes your stored credentials from the local configuration.

Configuring Environments

The CLI can connect to different Dcycle environments.

List Available Hosts

Output:
Each row shows: alias, URL, environment, and yes if it’s the current host.

JSON Response

Switch Environment

Output:
Both prod and production resolve to the same URL. Use whichever you prefer.
Development and staging environments automatically disable SSL verification for self-signed certificates.

Configuration Management

Show Current Configuration

List Config Values

Quick summary of host, environment, user, and organization:
Output:

JSON Response

Get / Set Individual Values

Reset Configuration

Remove all stored credentials, tokens, and settings:
Confirmation prompt:
Output:

Import from Legacy CLI

If you previously used the Python dc CLI, import your configuration:

Configuration File

The CLI stores configuration in ~/.config/dcycle/v2/config.yaml:

Configuration Priority

  1. Command-line flags (highest priority)
  2. Environment variables (DCYCLE_API_KEY, DCYCLE_HOST)
  3. Configuration file (~/.config/dcycle/v2/config.yaml)
  4. Defaults (lowest priority)

Environment Variables

For CI/CD and automation:

CLI Health Check

Run dcy doctor to verify your CLI setup:
Output:
When issues are found:
Icons: = ok, ! = warning, = failure. Use --format json for machine-readable output.

Troubleshooting

Permission Errors (403/404)

  1. Verify your session is valid:
  2. Check you’re in the correct organization:
  3. Run the health check:

Token Expired

Check and re-authenticate:

SSL Certificate Errors

For staging/development environments:

Reset Everything

If the config is corrupted, start fresh:

Next Steps

Organizations

Learn how to manage organization context

Configuration

Advanced configuration and environment setup

Examples

See common workflow examples

Overview

Full command reference