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)

dcy auth login
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.
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:
dcy auth login --no-browser
This prompts for email and password interactively. If your account has MFA enabled, the CLI will also prompt 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:
dcy auth login --email user@example.com --password your_password
Avoid storing passwords in scripts. Consider using environment variables or secure secret management.

Checking Session Status

View your current authentication state:
dcy auth status
Output example:
✓ Authenticated

  User:         John Doe (john@company.com)
  Organization: Acme Corp
  Host:         https://api.dcycle.io
  Token:        eyJhbG...xyz (valid)

Logging Out

dcy auth logout
This removes your stored credentials from the local configuration.

Configuring Environments

The CLI can connect to different Dcycle environments.

List Available Hosts

dcy config host list
Output:
Available hosts:
  * prod      https://api.dcycle.io (current)
    staging   https://api.staging.dcycle.io
    local     http://localhost:8000

Switch Environment

# Production (default)
dcy config host set prod

# Staging environment
dcy config host set staging

# Local development
dcy config host set local
Development and staging environments automatically disable SSL verification for self-signed certificates.

Configuration Management

Show Current Configuration

# Human-readable format
dcy config show

# JSON format
dcy config show --format json

List Config Values

Quick summary of host, environment, user, and organization:
dcy config list
Output:
Host: https://api.dcycle.io
Environment: prod
User: john@company.com
Organization: Acme Corp
Organization ID: ff4adcc7-...
Token: ***

Get / Set Individual Values

# Get a value
dcy config get host
dcy config get organization_id

# Set a value
dcy config set host https://api.dcycle.io
dcy config path

Import from Legacy CLI

If you previously used the Python dc CLI, import your configuration:
# Import (will error if v2 config already exists)
dcy config import-legacy

# Overwrite existing v2 config
dcy config import-legacy --force

Configuration File

The CLI stores configuration in ~/.config/dcycle/v2/config.yaml:
# ~/.config/dcycle/v2/config.yaml
host: https://api.dcycle.io
token: eyJhbGciOiJIUzI1NiIs...
organization_id: ff4adcc7-8172-45fe-9cf1-e90a6de53aa9
organization_name: Acme Corp
user_email: john@company.com
user_name: John Doe

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:
VariableDescription
DCYCLE_API_KEYAPI key for authentication (alternative to login)
DCYCLE_HOSTOverride the API host URL
DCYCLE_ORG_IDOverride the active organization
# Example: Using API key in CI/CD
export DCYCLE_API_KEY=your_api_key
export DCYCLE_ORG_ID=your_org_id
dcy vehicle list

Troubleshooting

Permission Errors (403/404)

  1. Verify your session is valid:
    dcy auth status
    
  2. Check you’re in the correct organization:
    dcy org list
    dcy org set <correct-org-id>
    

Token Expired

Re-authenticate:
dcy auth login

SSL Certificate Errors

For staging/development environments:
dcy config host set staging  # Auto-disables SSL verification

Next Steps

Organizations

Learn how to manage organization context

Examples

See common workflow examples