Skip to content

CLI

The Cohera CLI provides a powerful command-line interface for managing your Cohera resources, running agents, and automating workflows.

npm versionLicense
Terminal window
npm install -g @cohera/cli

Or with other package managers:

Terminal window
# Yarn
yarn global add @cohera/cli
# pnpm
pnpm add -g @cohera/cli
# Homebrew (macOS/Linux)
brew install cohera-io/tap/cohera

Verify the installation:

Terminal window
cohera --version
  1. Configure your API key:

    Terminal window
    cohera config set api-key ck_live_...
  2. Verify the connection:

    Terminal window
    cohera whoami
  3. List your certificates:

    Terminal window
    cohera certificates list
Terminal window
# Set API key
cohera config set api-key ck_live_...
# Set organization (for multi-org accounts)
cohera config set org-id org_abc123
# Set default output format
cohera config set format json
# View current configuration
cohera config list

The CLI stores configuration in ~/.cohera/config.yaml:

api-key: ck_live_...
org-id: org_abc123
format: table
base-url: https://api.cohera.io

You can also use environment variables:

Terminal window
export COHERA_API_KEY=ck_live_...
export COHERA_ORG_ID=org_abc123
export COHERA_FORMAT=json
Terminal window
# List all certificates
cohera certificates list
# List with filters
cohera certificates list --status active --supplier sup_abc123
# Get a specific certificate
cohera certificates get cert_abc123
# Get with relationships
cohera certificates get cert_abc123 --include supplier,components
# Create a certificate
cohera certificates create \
--name "CoA - Batch 2024-001" \
--supplier sup_abc123 \
--type coa \
--expiry 2025-06-30
# Update a certificate
cohera certificates update cert_abc123 --status expired
# Delete a certificate
cohera certificates delete cert_abc123
# Export to file
cohera certificates list --format json > certificates.json
cohera certificates list --format csv > certificates.csv
Terminal window
# List suppliers
cohera suppliers list
# Search suppliers
cohera suppliers search "Acme"
# Get supplier details
cohera suppliers get sup_abc123
# Create supplier
cohera suppliers create \
--name "Acme Chemicals" \
--email contact@acme.com \
--status approved
# Update supplier
cohera suppliers update sup_abc123 --status inactive
Terminal window
# List components
cohera components list
# Get component with graph
cohera components get comp_abc123 --include supplier,certificates,products
# List by supplier
cohera components list --supplier sup_abc123
Terminal window
# List products
cohera products list
# Get product with BOM
cohera products get prod_abc123 --include bom,components
# Impact analysis
cohera products affected-by --certificate cert_abc123
Terminal window
# List available agents
cohera agents list
# Run the certificate intake agent
cohera agents run certificate-intake \
--input document.pdf \
--supplier sup_abc123
# Run impact analysis
cohera agents run impact-analysis \
--certificate cert_abc123
# Run expiry check
cohera agents run expiry-check \
--days 30 \
--notify
# Check agent status
cohera agents status job_abc123
# View agent logs
cohera agents logs job_abc123
Terminal window
# List workflows
cohera workflows list
# Trigger a workflow
cohera workflows trigger certificate-renewal \
--certificate cert_abc123
# Check workflow status
cohera workflows status wf_abc123
Terminal window
cohera certificates list --format table
ID NAME STATUS EXPIRY
cert_abc123 CoA - Batch 2024-001 active 2025-06-30
cert_def456 CoC - Material X active 2025-03-15
cert_ghi789 GMP Certificate expired 2024-01-01
Terminal window
cohera certificates list --format json
[
{
"id": "cert_abc123",
"name": "CoA - Batch 2024-001",
"status": "active",
"expiryDate": "2025-06-30T00:00:00Z"
}
]
Terminal window
cohera certificates list --format csv
id,name,status,expiryDate
cert_abc123,CoA - Batch 2024-001,active,2025-06-30
cert_def456,CoC - Material X,active,2025-03-15
Terminal window
cohera certificates list --format yaml
- id: cert_abc123
name: CoA - Batch 2024-001
status: active
expiryDate: 2025-06-30
Terminal window
# Get certificate names
cohera certificates list --format json | jq '.[].name'
# Filter expiring certificates
cohera certificates list --format json | jq '[.[] | select(.daysUntilExpiry < 30)]'
# Count by status
cohera certificates list --format json | jq 'group_by(.status) | map({status: .[0].status, count: length})'
#!/bin/bash
# Check for expiring certificates and send notifications
expiring=$(cohera certificates list --status active --expires-within 30d --format json)
if [ "$(echo $expiring | jq length)" -gt 0 ]; then
echo "Found expiring certificates:"
echo $expiring | jq -r '.[] | "\(.name) expires on \(.expiryDate)"'
# Send notification (example with Slack)
curl -X POST $SLACK_WEBHOOK -d "{
\"text\": \"Warning: $(echo $expiring | jq length) certificates expiring soon\"
}"
fi
.github/workflows/certificate-check.yml
name: Certificate Check
on:
schedule:
- cron: '0 8 * * *' # Daily at 8 AM
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Install Cohera CLI
run: npm install -g @cohera/cli
- name: Check expiring certificates
env:
COHERA_API_KEY: ${{ secrets.COHERA_API_KEY }}
run: |
cohera certificates list \
--status active \
--expires-within 30d \
--format json > expiring.json
if [ $(jq length expiring.json) -gt 0 ]; then
echo "::warning::Found expiring certificates"
jq -r '.[] | "- \(.name) expires \(.expiryDate)"' expiring.json
fi

Start an interactive session:

Terminal window
cohera interactive
Welcome to Cohera CLI Interactive Mode
Type 'help' for available commands, 'exit' to quit
cohera> certificates list --status active
ID NAME STATUS EXPIRY
cert_abc123 CoA - Batch 2024-001 active 2025-06-30
cohera> certificates get cert_abc123 --include supplier
{
"id": "cert_abc123",
"name": "CoA - Batch 2024-001",
"supplier": {
"id": "sup_abc123",
"name": "Acme Chemicals"
}
}
cohera> exit

Extend the CLI with plugins:

Terminal window
# Install a plugin
cohera plugins install @cohera/cli-plugin-veeva
# List installed plugins
cohera plugins list
# Use plugin commands
cohera veeva sync --vault prod
Terminal window
# Enable verbose logging
cohera certificates list --debug
# Show HTTP requests/responses
cohera certificates list --verbose
Terminal window
# General help
cohera --help
# Command-specific help
cohera certificates --help
cohera certificates list --help
# Version info
cohera --version

Enable shell autocompletion:

Terminal window
# Bash
cohera completion bash >> ~/.bashrc
# Zsh
cohera completion zsh >> ~/.zshrc
# Fish
cohera completion fish > ~/.config/fish/completions/cohera.fish
# PowerShell
cohera completion powershell >> $PROFILE

For complete documentation, see: