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

Examples & Workflows

Learn how to automate sustainability data management with practical, production-ready examples.

CI/CD Pipeline Integration

Automate uploads with GitHub Actions, GitLab CI, and other CI/CD tools. Includes validation, notifications, and best practices for reliable pipelines.

Multi-Organization Consolidated Reporting

Generate consolidated sustainability reports across holdings, subsidiaries, and business units. Compare performance and track group-wide targets.

Logistics Data Automation

Daily automation for transport companies: upload trip data (viajes) and fuel consumption (consumos). Integration with TMS/ERP systems.

Quick Start

Get up and running in under a minute:
# 1. Login
dcy auth login

# 2. List your organizations
dcy org list

# 3. Set active organization
dcy org set <your-org-id>

# 4. Explore your data
dcy facility list
dcy vehicle list

Automation-Ready Features

The CLI is designed for automation and AI agent integration:

Structured Output

All commands support machine-readable output:
# JSON for programmatic processing
dcy vehicle list --format json

# CSV for spreadsheet tools
dcy facility list --format csv

# Pipe to jq for processing
dcy vehicle list --format json | jq '.[] | {plate, fuel}'

Non-Interactive Mode

Skip confirmation prompts in automated pipelines:
# Delete without confirmation
dcy vehicle delete $VEHICLE_ID --yes

# Upload without prompts
dcy logistics upload data.csv --type requests --yes

Environment-Based Authentication

No credentials in scripts—use environment variables:
export DCYCLE_API_KEY=your_api_key
export DCYCLE_ORG_ID=your_org_id

# Commands use environment automatically
dcy vehicle list

Common Patterns

Export and Process with jq

# Count vehicles by fuel type
dcy vehicle list --format json | jq 'group_by(.fuel) | map({fuel: .[0].fuel, count: length})'

# List facility names
dcy facility list --format json | jq '.[].name'

# Find high-emission vehicles
dcy vehicle list --format json | jq '.[] | select(.emissions_tco2e > 50)'

Bulk Operations

# Generate template
dcy vehicle upload --template > vehicles.csv

# Edit CSV with your data, then upload
dcy vehicle upload vehicles.csv --yes

# Verify upload
dcy vehicle list

Error Handling with Retry

upload_with_retry() {
    local file=$1
    local max_attempts=3

    for attempt in $(seq 1 $max_attempts); do
        echo "Attempt $attempt: Uploading $file..."
        if dc logistics upload "$file" --type requests --yes; then
            echo "✓ Success"
            return 0
        fi
        sleep 30
    done
    return 1
}

Troubleshooting

Check Authentication

dcy auth status

Verify Organization Context

dcy org list
dcy org set <correct-org-id>

Debug API Calls

dcy --verbose vehicle list

More Resources

Automation Guide

Comprehensive automation patterns and strategies

MCP Server

AI-assisted analysis with Claude

API Reference

REST API for custom integrations

Reporting Pipelines

CI/CD and scheduled job patterns