> ## Documentation Index
> Fetch the complete documentation index at: https://developers.essal.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Essal CLI

> Use the Essal CLI to manage your workspace, trigger API calls, and automate tasks from the terminal.

The Essal CLI is a command-line tool for interacting with the Essal API from your terminal. It supports all six apps and is designed for developer automation and scripting workflows.

## Installation

```bash theme={null}
npm install -g @essal/cli
# or
brew install essal/tap/essal
```

## Authentication

```bash theme={null}
essal login
# Opens browser for OAuth flow and stores credentials locally

# Or authenticate with an API key directly
essal config set api-key esk_live_xxxxxxxxxxxxxxxxxxxx
```

## Command Structure

```
essal <app> <resource> <action> [options]
```

## Examples

```bash theme={null}
# List documents
essal office documents list --limit 10

# Create a Sales contact
essal sales contacts create --display-name "Jane Smith" --email "jane@acmecorp.com"

# Move a deal to a new stage
essal sales deals update deal_01HXYZAAA --stage-id stg_01HXYZ3333

# Create a Project task
essal project tasks create --project proj_01HXYZ9876 --title "Design review" --priority high

# View Guard audit log (last 20 entries)
essal guard audit-logs list --limit 20

# Trigger an immediate directory sync
essal access directories sync dir_01HXYZDIR1
```

## Output Formats

```bash theme={null}
# Default: human-readable table
essal office documents list

# JSON output (for scripting)
essal office documents list --output json

# Quiet mode (IDs only)
essal office documents list --output ids
```

## Scripting with the CLI

```bash theme={null}
#!/bin/bash
# Example: move all qualifying deals to the next stage
essal sales deals list --stage-id stg_01HXYZ2222 --output json | \
  jq -r '.data[].id' | \
  xargs -I {} essal sales deals update {} --stage-id stg_01HXYZ3333
```
