# Dench API Guide

Use the Dench CLI first. This API guide is the backup path for agents when the CLI is unavailable, cannot be installed, or cannot run in the current environment.

Base URL:

```bash
export DENCH_API_BASE="https://www.dench.com/api/v1"
export DENCH_API_KEY="<workspace API key or dch_agent_* session token>"
```

Authentication:

```http
Authorization: Bearer <DENCH_API_KEY or dch_agent_* session token>
```

Every parameter, request body, and response is documented interactively in the OpenAPI playground. This curl guide is generated from the same registry.

Machine-readable spec:

```bash
curl -sS "$DENCH_API_BASE/openapi.json"
```

## Important Notes

- Prefer the CLI when it works; it handles local session selection, prompts, streaming display, and file staging ergonomics.
- Gateway-backed operations (search, dench web, images, apps, tools, enrichment) accept either a Dench API key or an agent session; agent sessions are exchanged for the workspace gateway key server-side.
- Dench web (page read, brand, sitemap, crawl, screenshot, extract) is `POST /context/{op}`, proxied to `$DENCH_GATEWAY_URL/v1/context/{op}`. Prefer `dench web` / `fetch_url` over writing your own scraper. Search stays `POST /search`.
- Local-only commands are listed for completeness but operate on the caller's machine and cannot run remotely.
- For chat operations authenticated with an API key, include `x-dench-run-id: <run_id>` when acting from inside a running agent turn.

## Agent Config

### dench context --sections identity

Read IDENTITY.md.

- API: `GET /agent-config/identity`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench identity show`

```bash
curl -sS "$DENCH_API_BASE/agent-config/identity" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench context set identity

Update IDENTITY.md.

- API: `PUT /agent-config/identity`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench identity edit`

```bash
curl -sS -X PUT "$DENCH_API_BASE/agent-config/identity" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "content": "string"
  }'
```

### dench context --sections organisation

Read ORGANISATION.md.

- API: `GET /agent-config/organisation`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench organisation show`

```bash
curl -sS "$DENCH_API_BASE/agent-config/organisation" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench context set organisation

Update ORGANISATION.md.

- API: `PUT /agent-config/organisation`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench organisation edit`

```bash
curl -sS -X PUT "$DENCH_API_BASE/agent-config/organisation" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "content": "string"
  }'
```

### dench context --sections user

Read USER.md.

- API: `GET /agent-config/user`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench user show`

```bash
curl -sS "$DENCH_API_BASE/agent-config/user" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench context set user

Update USER.md.

- API: `PUT /agent-config/user`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench user edit`

```bash
curl -sS -X PUT "$DENCH_API_BASE/agent-config/user" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "content": "string"
  }'
```

### dench context --sections tools

Read tool notes.

- API: `GET /agent-config/tools`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench tools show`

```bash
curl -sS "$DENCH_API_BASE/agent-config/tools" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench context set tools

Update tool notes.

- API: `PUT /agent-config/tools`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench tools edit`

```bash
curl -sS -X PUT "$DENCH_API_BASE/agent-config/tools" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "content": "string"
  }'
```

### dench mem show

Read aggregate memory.

- API: `GET /agent-config/mem`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/agent-config/mem" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench mem set

Update aggregate memory.

- API: `PUT /agent-config/mem`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/agent-config/mem" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "content": "string"
  }'
```

### dench bootstrap status

Read bootstrap state.

- API: `GET /agent-config/bootstrap`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/agent-config/bootstrap" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench bootstrap complete

Complete bootstrap.

- API: `POST /agent-config/bootstrap/complete`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/agent-config/bootstrap/complete" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench bootstrap template

Update bootstrap template.

- API: `PUT /agent-config/bootstrap/template`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/agent-config/bootstrap/template" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "content": "string"
  }'
```

### dench model default

Not available: Dench runs one chat model, so this always fails.

- API: `PUT /agent-config/model/default`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/agent-config/model/default" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "modelId": "string"
  }'
```

### dench model thread

Not available: Dench runs one chat model, so this always fails.

- API: `PUT /agent-config/model/threads/{threadId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/agent-config/model/threads/{threadId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "modelId": "string"
  }'
```

### dench daily today

Read today's daily activity path.

- API: `GET /agent-config/daily/today`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/agent-config/daily/today" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench daily show

Read a daily activity path.

- API: `GET /agent-config/daily/{date}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/agent-config/daily/{date}" -H "Authorization: Bearer $DENCH_API_KEY"
```

## Apps

### dench apps list

List installed App Store apps in the workspace.

- API: `GET /apps`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/apps" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench apps gallery

List Discover listings — Official (Dench) + Community shelves.

- API: `GET /apps/gallery`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/apps/gallery" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench apps create

Scaffold and register a new App Store app.

- API: `POST /apps`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/apps" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "slug": "string",
    "name": "string"
  }'
```

### dench apps install

Install an App Store listing into the workspace.

- API: `POST /apps/install`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/apps/install" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "listingId": "string"
  }'
```

### dench apps publish

Publish an app's files as a versioned App Store listing.

- API: `POST /apps/publish`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/apps/publish" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "appPath": "string",
    "slug": "string",
    "name": "string"
  }'
```

### dench apps uninstall

Uninstall an app from the workspace.

- API: `DELETE /apps/{slug}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/apps/{slug}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench apps enable

Enable or disable an installed app.

- API: `PATCH /apps/{slug}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/apps/{slug}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "enabled": true
  }'
```

### dench apps pin

Pin or unpin an installed app in the rail.

- API: `POST /apps/{slug}/pin`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/apps/{slug}/pin" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "pinned": true
  }'
```

### dench apps share

Share an app you added with the workspace (shared) or make it private to you again (private). Owner only.

- API: `POST /apps/{slug}/visibility`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/apps/{slug}/visibility" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench apps validate

Validate a .dench.app folder: manifest, permissions, and every window.dench call it makes.

- API: `POST /local/apps/validate`
- Auth: No bearer token required.

```bash
# dench apps validate
# Local-only: Validation reads the app folder on the caller's disk. In the browser, the same catalog is window.dench.api.operations().
```

### dench apps webhooks register

Register an inbound webhook for an app. Returns the URL and signing secret ONCE.

- API: `POST /apps/{slug}/webhooks`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/apps/{slug}/webhooks" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "hookName": "string"
  }'
```

### dench apps webhooks list

List an app's registered webhooks (URLs, never secrets).

- API: `GET /apps/{slug}/webhooks`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/apps/{slug}/webhooks" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench apps webhooks poll

Read events an app webhook received since a timestamp.

- API: `GET /apps/{slug}/webhooks/{hookName}/events`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/apps/{slug}/webhooks/{hookName}/events" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench apps webhooks delete

Remove an app webhook and every event it stored.

- API: `DELETE /apps/{slug}/webhooks/{hookName}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/apps/{slug}/webhooks/{hookName}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

## Auth

### dench signin

Create an agent sign-in request.

- API: `POST /auth/signin-requests`
- Auth: No bearer token required.

```bash
curl -sS -X POST "$DENCH_API_BASE/auth/signin-requests" \
  -H "Content-Type: application/json" \
  --data '{
    "codeHash": "string",
    "sessionTokenHash": "string",
    "agentName": "string",
    "agentKind": "string",
    "intent": "join_existing"
  }'
```

### dench signin

Poll an agent sign-in request until approval.

- API: `POST /auth/signin-requests/{requestId}/poll`
- Auth: No bearer token required.

```bash
curl -sS -X POST "$DENCH_API_BASE/auth/signin-requests/{requestId}/poll" \
  -H "Content-Type: application/json" \
  --data '{
    "codeHash": "string",
    "sessionTokenHash": "string"
  }'
```

### dench signin --email

Start the email OTP sign-in flow.

- API: `POST /auth/otp/start`
- Auth: No bearer token required.

```bash
curl -sS -X POST "$DENCH_API_BASE/auth/otp/start" \
  -H "Content-Type: application/json" \
  --data '{
    "email": "string"
  }'
```

### dench signin --email

Verify an email OTP sign-in code.

- API: `POST /auth/otp/verify`
- Auth: No bearer token required.

```bash
curl -sS -X POST "$DENCH_API_BASE/auth/otp/verify" \
  -H "Content-Type: application/json" \
  --data '{
    "email": "string",
    "code": "string",
    "agentName": "string",
    "agentKind": "string",
    "sessionTokenHash": "string",
    "intent": "join_existing"
  }'
```

### dench signin --email

Finalize an email OTP sign-in session.

- API: `POST /auth/otp/finalize`
- Auth: No bearer token required.

```bash
curl -sS -X POST "$DENCH_API_BASE/auth/otp/finalize" \
  -H "Content-Type: application/json" \
  --data '{
    "authToken": "string"
  }'
```

## Billing

### dench billing status

Get billing and AI credit status.

- API: `GET /billing/status`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/billing/status" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench billing topup

Create an AI credit top-up checkout link.

- API: `POST /billing/topup`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/billing/topup" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "requestId": "string",
    "amountUsd": 0
  }'
```

### dench upgrade

Create a workspace upgrade checkout link.

- API: `POST /billing/upgrade`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/billing/upgrade" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

## Browser

### dench browser

Drive Dench Browser with a single interactive action (open, inspect, click, fill, type, screenshot, stop). Pass the step in `action` plus its arguments.

- API: `POST /browser/cli`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/browser/cli" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "action": "open",
    "url": "https://example.com"
  }'
```

### dench browser session create

Create a Dench Browser session and return a CDP connect URL for Playwright (chromium.connectOverCDP) plus a live-view URL. Use for durable scripts run from the sandbox.

- API: `POST /browser/sessions`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/browser/sessions" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "viewport": {
      "width": 1280,
      "height": 800
    }
  }'
```

### dench browser session status

Get the status, connect URL, and live-view URL for a Dench Browser session.

- API: `GET /browser/sessions/{sessionId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/browser/sessions/{sessionId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench browser session stop

Stop a Dench Browser session and release the remote browser.

- API: `DELETE /browser/sessions/{sessionId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/browser/sessions/{sessionId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

## Campaigns

### dench campaign draft

Create an idempotent empty campaign draft with the caller's available sender pools. Does not launch or send.

- API: `POST /campaigns/drafts`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/drafts" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "clientRequestId": "string"
  }'
```

### dench campaign search

Search people by filters without adding CRM records or campaign recipients. Search credits apply; this is not a free provider preview.

- API: `POST /campaigns/audience/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/audience/search" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "filters": {}
  }'
```

### dench campaign add --search

Search and add up to 50 people to an existing campaign. New identities become Leads. Search credits apply; use nextPageToken for another page.

- API: `POST /campaigns/{sequenceId}/people/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/people/search" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "filters": {}
  }'
```

### dench campaign add --people-file

Add up to 50 selected recipients without another search. Deduplicates, applies suppression, and preserves the campaign's launch state.

- API: `POST /campaigns/{sequenceId}/people/batch`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/people/batch" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "recipients": []
  }'
```

### dench campaign sources get

Read a campaign's saved signal source, targeting and schedule.

- API: `GET /campaigns/{sequenceId}/sources`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/sources" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign sources signals

Read signal choices, suggested terms and current source configuration.

- API: `GET /campaigns/{sequenceId}/sources/signals`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/sources/signals" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign sources set

Update source cadence, pause/resume, targeting, signals or terms. Active sources may perform billable future work.

- API: `PATCH /campaigns/{sequenceId}/sources`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/campaigns/{sequenceId}/sources" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign sources preview

Preview a signal source using its current audience. Provider credits may apply; does not enroll people.

- API: `POST /campaigns/{sequenceId}/sources/preview`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/sources/preview" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "signal": "post_engagement"
  }'
```

### dench campaign sources run

Run a live campaign's signals now instead of waiting for the schedule (Run now). Provider credits apply; limited to 6 runs an hour.

- API: `POST /campaigns/{sequenceId}/sources/run`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/sources/run" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign sources overview

Read the Sources tab: each signal's status, last and next run, people found and anything needing attention.

- API: `GET /campaigns/{sequenceId}/sources/overview`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/sources/overview" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign sources pending

List people a signal found who are waiting for approval (manual approval mode).

- API: `GET /campaigns/{sequenceId}/sources/pending`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/sources/pending" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign sources approve|reject

Approve people waiting for review (they start the sequence) or reject them.

- API: `POST /campaigns/{sequenceId}/sources/review`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/sources/review" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "enrollmentIds": [],
    "decision": "approve"
  }'
```

### dench campaign queue

Today's queue: who the campaign plans to contact today, warmest first, within the senders' limits.

- API: `GET /campaigns/{sequenceId}/queue`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/queue" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder profile

Read the company profile and suggested campaign audience.

- API: `GET /campaigns/builder/profile`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/builder/profile" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder save

Save a signal campaign's audience, signals and terms idempotently. Does not start a build.

- API: `POST /campaigns/builder/drafts`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/builder/drafts" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "clientRequestId": "string",
    "targeting": {},
    "signals": []
  }'
```

### dench campaign builder get

Read signal build progress, preview people, messages and errors.

- API: `GET /campaigns/builder/drafts/{draftId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/builder/drafts/{draftId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder leads

Read every lead a signal build kept (not just the five previewed): person, company, LinkedIn URL and the signal's evidence.

- API: `GET /campaigns/builder/drafts/{draftId}/leads`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/builder/drafts/{draftId}/leads" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder build

Start the same billable signal/audience/message build used by the UI; poll the draft for progress.

- API: `POST /campaigns/builder/drafts/{draftId}/build`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/builder/drafts/{draftId}/build" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder create

Create a campaign from a reviewed signal draft. Does not launch the campaign.

- API: `POST /campaigns/builder/drafts/{draftId}/create`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/builder/drafts/{draftId}/create" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder opener

Edit or reset one preview person's opening line before creating the campaign.

- API: `PUT /campaigns/builder/drafts/{draftId}/people/{leadId}/opener`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/campaigns/builder/drafts/{draftId}/people/{leadId}/opener" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "opener": "string"
  }'
```

### dench campaign builder drafts

List saved, unfinished campaign drafts that can be resumed.

- API: `GET /campaigns/builder/drafts`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/builder/drafts" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder resume

Read a saved draft's setup (source, name, targeting, signals, terms, lookalike) to resume it.

- API: `GET /campaigns/builder/drafts/{draftId}/setup`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/builder/drafts/{draftId}/setup" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder discard

Discard a saved draft that has not become a campaign.

- API: `DELETE /campaigns/builder/drafts/{draftId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/campaigns/builder/drafts/{draftId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder outreach

Save a draft's Outreach and Review choices: AI or manual steps, the brief, the steps, who sends and when, and auto or manual approval.

- API: `PATCH /campaigns/builder/drafts/{draftId}/outreach`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/campaigns/builder/drafts/{draftId}/outreach" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder sequence

Generate the draft's sequence from a brief (goal, problem, tone, channels), as Generate sequence does. AI credits apply.

- API: `POST /campaigns/builder/drafts/{draftId}/sequence`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/builder/drafts/{draftId}/sequence" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "brief": {}
  }'
```

### dench campaign builder lookalike

Set up a lookalike from the best lead's LinkedIn URL (role, similar roles, place, industry, similar companies), suggest roles again, or re-scope to a company. Nothing is saved. Provider credits apply.

- API: `POST /campaigns/builder/lookalike`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/builder/lookalike" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder voices

Suggest market voices (LinkedIn experts) for the campaign's topics, to watch with voice_engagement. AI credits apply.

- API: `POST /campaigns/builder/voices`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/builder/voices" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign builder autofill

Turn an audience description into targeting filters. AI credits apply.

- API: `POST /campaigns/builder/autofill`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/builder/autofill" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "description": "string"
  }'
```

### dench campaign builder estimate

Estimate audience or weekly signal volume using the UI's cached estimator. Provider credits may apply.

- API: `POST /campaigns/builder/estimate`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/builder/estimate" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "kind": "people",
    "targeting": {}
  }'
```

### dench campaign accounts

Discover LinkedIn sender ids, labels, availability and remaining capacity visible to the acting workspace member. Never returns provider credentials.

- API: `GET /campaigns/accounts/linkedin`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/accounts/linkedin" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign linkedin send

Send one LinkedIn message now as the acting member, like the Inbox's Send button: not paced, 1st-degree connections only. Only use for an explicit send request.

- API: `POST /campaigns/linkedin/messages`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/linkedin/messages" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "profileUrl": "https://www.linkedin.com/in/ada-lovelace",
    "text": "Hi Ada, great meeting you at the summit!"
  }'
```

### dench campaign accounts

Discover the mailboxes the acting workspace member can send campaign email from: ids for emailMailboxAccountIds, status, warm-up state and when it is done, the daily cold-email cap and what is left today. Never returns provider credentials.

- API: `GET /campaigns/accounts/email`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/accounts/email" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign list [--with-references]

List outreach campaigns of every kind on the Campaigns page, each with its kind (archived ones on request).

- API: `GET /campaigns`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign create

Create a draft outreach campaign with email and LinkedIn sender pools and a business-hours send window in the given timezone.

- API: `POST /campaigns`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "Founder outreach",
    "timezone": "America/Los_Angeles",
    "emailMailboxAccountIds": [
      "<emailMailboxAccountId>"
    ],
    "linkedinAccountIds": [
      "<linkedinAccountId>"
    ]
  }'
```

### dench campaign duplicate

Copy a campaign into a new draft named "<name> copy": the same steps, schedule, sender pools and personalized lines, its lead source paused, and no people. To reach more than 300 people, duplicate and add the next page of the search to the copy.

- API: `POST /campaigns/{sequenceId}/duplicate`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/duplicate" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign get

Read a campaign: settings, steps, people, their current step and hold, last touches, linked leads.

- API: `GET /campaigns/{sequenceId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign get

Campaign funnel: enrolled, contacted, invited, accepted, messaged, replied, opens and clicks, and for a workflow how many people took each If / else and Wait for them to accept path (branchStats).

- API: `GET /campaigns/{sequenceId}/analytics`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/analytics" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign get

What the campaign is doing now, what comes next and when, and why it is holding.

- API: `GET /campaigns/{sequenceId}/live`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/live" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign pipeline

Where a campaign's people sit in the workspace's lead pipeline right now: each lead Status in order with how many enrolled leads are at it, and how many have no lead or a status outside the pipeline.

- API: `GET /campaigns/{sequenceId}/pipeline`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/pipeline" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign set

Change a campaign's name, sender pools, send windows, daily email cap, stop-on-reply, start or end. Works until archived; existing conversations keep their assigned sender.

- API: `PATCH /campaigns/{sequenceId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/campaigns/{sequenceId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "sequenceId": "<sequenceId>",
    "emailMailboxAccountIds": [
      "<emailMailboxAccountId>"
    ],
    "linkedinAccountIds": [
      "<linkedinAccountId>"
    ],
    "dailySendCap": 30,
    "sendSchedules": [
      {
        "name": "Mon-Fri 9-18",
        "timezone": "America/Los_Angeles",
        "startHour": 9,
        "endHour": 18,
        "weekdays": [
          1,
          2,
          3,
          4,
          5
        ]
      }
    ]
  }'
```

### dench campaign steps set

Replace every step of a draft campaign (email, wait, LinkedIn visit, connection request, message, post reaction, InMail, If / else, Wait for them to accept). A workflow (stepModel workflow, or steps with key, next, yesNext or noNext) branches: condition and wait_for_connection steps continue on yesNext or noNext, other steps on next; each points at another step's key or end. Steps are checked first: a field the step type would drop, missing text, {TOKEN} single braces or paths that don't hold together are rejected, not saved. Configure sender pools on the campaign; step sender ids are legacy-only.

- API: `PUT /campaigns/{sequenceId}/steps`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/campaigns/{sequenceId}/steps" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "sequenceId": "<sequenceId>",
    "stepModel": "workflow",
    "steps": [
      {
        "key": "connected",
        "type": "condition",
        "check": "linkedin_connected",
        "yesNext": "message",
        "noNext": "invite"
      },
      {
        "key": "invite",
        "type": "linkedin_connection",
        "linkedinMessageBody": "Hi {{First name}}, enjoyed your post on {{Topic}}.",
        "next": "accept"
      },
      {
        "key": "accept",
        "type": "wait_for_connection",
        "connectionTimeoutHours": 240,
        "yesNext": "message",
        "noNext": "email"
      },
      {
        "key": "email",
        "type": "email",
        "emailSubject": "Quick question, {{First name}}",
        "emailTextBody": "Hi {{First name}}, ...",
        "next": "end"
      },
      {
        "key": "message",
        "type": "linkedin_message",
        "linkedinMessageBody": "Thanks for connecting, {{First name}}. ...",
        "next": "end"
      }
    ]
  }'
```

### dench campaign steps edit

Edit the text, waits and conditions of a launched (or paused) campaign's steps in place. Each step keeps its id, type and place; pass the stepId and the updatedAt you read, and only the fields you change. A workflow keeps its paths and what each If / else checks (key, next, yesNext, noNext, check, conditionField, conditionOperator); conditionValue and acceptance waits stay editable. Messages already sent or being prepared keep their text; drafts use campaigns.steps.replace.

- API: `PATCH /campaigns/{sequenceId}/steps`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/campaigns/{sequenceId}/steps" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "sequenceId": "<sequenceId>",
    "steps": [
      {
        "stepId": "<stepId>",
        "expectedUpdatedAt": 1765526400000,
        "type": "email",
        "emailSubject": "A quicker question, {{First name}}"
      },
      {
        "stepId": "<waitStepId>",
        "expectedUpdatedAt": 1765526400000,
        "type": "wait",
        "waitHours": 96
      },
      {
        "stepId": "<waitForConnectionStepId>",
        "expectedUpdatedAt": 1765526400000,
        "type": "wait_for_connection",
        "connectionTimeoutHours": 336
      }
    ]
  }'
```

### dench campaign personalize get

Read a campaign's personalized lines (written for each person): their {{keys}} for steps, instructions and fallbacks, how many people have them, and the cost per person.

- API: `GET /campaigns/{sequenceId}/personalization`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/personalization" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign personalize set

Define up to 5 personalized lines (each used as {{key}} in steps) and what you sell. Saving starts writing missing lines for up to 100 people, about 3 cents a person; for more it returns needsConfirm and writes nothing until campaigns.personalization.write is confirmed.

- API: `PUT /campaigns/{sequenceId}/personalization`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/campaigns/{sequenceId}/personalization" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "sequenceId": "<sequenceId>",
    "template": {
      "variables": [
        {
          "key": "companyHook",
          "label": "Company hook",
          "prompt": "One sentence about something specific their company does or recently did. 8 to 18 words.",
          "fallback": "Your team caught my eye.",
          "maxChars": 160
        }
      ],
      "context": {
        "sells": "Senior engineers who join your team in your time zone."
      }
    }
  }'
```

### dench campaign personalize clear

Turn off a campaign's personalized lines and cancel the ones not yet written. Refused while a step still uses one of the {{keys}}.

- API: `DELETE /campaigns/{sequenceId}/personalization`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/campaigns/{sequenceId}/personalization" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign personalize write

Write personalized lines for the people missing them (mode missing) or rewrite everyone's (mode all). Rewriting everyone or more than 100 people returns needsConfirm and the estimate until called with confirmed: true.

- API: `POST /campaigns/{sequenceId}/personalization/write`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/personalization/write" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign personalize edit

Set one person's personalized line by hand; an empty value undoes the edit. Braces are removed and text past the line's length is cut.

- API: `PUT /campaigns/people/{enrollmentId}/personalization`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/campaigns/people/{enrollmentId}/personalization" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "key": "string",
    "value": "string"
  }'
```

### dench campaign personalize rewrite

Write a fresh personalized line for one person: one key, or all of their lines when key is left out. About 3 cents.

- API: `POST /campaigns/people/{enrollmentId}/personalization/rewrite`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/people/{enrollmentId}/personalization/rewrite" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign add

Add CRM records (up to 100 ids per call) to a campaign; returns how many were added and why others were skipped.

- API: `POST /campaigns/{sequenceId}/people`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/people" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "sequenceId": "<sequenceId>",
    "objectName": "lead",
    "entryIds": [
      "<entryId1>",
      "<entryId2>"
    ]
  }'
```

### dench campaign add --name

Add one person by email and/or LinkedIn profile URL.

- API: `POST /campaigns/{sequenceId}/person`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/person" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "sequenceId": "<sequenceId>",
    "displayName": "Ada Lovelace",
    "email": "ada@example.com",
    "linkedinProfileUrl": "https://linkedin.com/in/ada"
  }'
```

### dench campaign preview

Show the message one person gets at one email or LinkedIn step, with their fields and personalized lines filled in: subject, body, sender, recipient, merge fields still missing, warnings, and why the step would be skipped. Nothing is sent, prepared or charged.

- API: `GET /campaigns/{sequenceId}/preview`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/preview?enrollmentId=string&stepId=string" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign launch --check

Launch readiness without launching: blockers grouped by problem, warnings, and the fingerprint `launch` requires.

- API: `GET /campaigns/{sequenceId}/launch`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/launch" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign launch

Launch a ready draft. Pass the fingerprint from the preview and acknowledge the LinkedIn notice when LinkedIn steps exist.

- API: `POST /campaigns/{sequenceId}/launch`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/launch" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "sequenceId": "<sequenceId>",
    "fingerprint": "<fingerprint from the launch preview>",
    "linkedinRiskAcknowledged": true
  }'
```

### dench campaign pause

Pause an active campaign.

- API: `POST /campaigns/{sequenceId}/pause`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/pause" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign resume

Resume a paused campaign.

- API: `POST /campaigns/{sequenceId}/resume`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/resume" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign archive

Archive a campaign and stop everyone still in flight. This is the app's Delete: campaigns are never erased, and their people, leads and activity stay.

- API: `POST /campaigns/{sequenceId}/archive`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench campaign delete`

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/archive" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign events

The campaign's activity log, newest first (sent, accepted, replied, skipped, failed, paused, stopped).

- API: `GET /campaigns/{sequenceId}/events`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/{sequenceId}/events" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign stop

Stop one person: nothing more is sent to them from this campaign.

- API: `POST /campaigns/people/{enrollmentId}/stop`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/people/{enrollmentId}/stop" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign resume-person

Resume one paused person in an active campaign.

- API: `POST /campaigns/people/{enrollmentId}/resume`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/people/{enrollmentId}/resume" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign person set --email

Give a person in a draft campaign a new or corrected email address; their linked CRM record gets it too. Only before launch; another person in the campaign can't share it.

- API: `PUT /campaigns/people/{enrollmentId}/email`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/campaigns/people/{enrollmentId}/email" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "email": "string"
  }'
```

### dench campaign person set --linkedin-url

Give a person in a draft campaign a new or corrected LinkedIn profile URL; their linked CRM record gets it too. Only before launch.

- API: `PUT /campaigns/people/{enrollmentId}/linkedin`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/campaigns/people/{enrollmentId}/linkedin" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "linkedinProfileUrl": "string"
  }'
```

### dench campaign person set --field

Fill or fix one {{merge field}} for a person in a draft campaign, e.g. a missing Company that blocks launch; a matching column on their CRM record is updated too. Only before launch; written personalized lines are not merge fields and can't be set here.

- API: `PUT /campaigns/people/{enrollmentId}/fields`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/campaigns/people/{enrollmentId}/fields" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "key": "string",
    "value": "string"
  }'
```

### dench campaign resume-person --all

Resume every paused person in an active campaign at once, e.g. after a sending account is reconnected. Returns how many were resumed.

- API: `POST /campaigns/{sequenceId}/people/resume`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/people/resume" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign sync

Fill each unfinished person's empty email, LinkedIn URL, name and merge fields from their linked CRM record, e.g. after enriching the records. Never overwrites a value the campaign already has; returns how many people changed.

- API: `POST /campaigns/{sequenceId}/people/sync`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/campaigns/{sequenceId}/people/sync" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign where

The campaigns a CRM record (a person or a lead) is in, newest first, with the person's status in each and the accounts that send to them.

- API: `GET /campaigns/by-record/{entryId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/by-record/{entryId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign person show

Everything a campaign did for one person, step by step: what was sent (subject and text), whether it was opened or clicked, what was skipped and why, waits, failures and retries.

- API: `GET /campaigns/people/{enrollmentId}/timeline`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/campaigns/people/{enrollmentId}/timeline" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench campaign remove

Remove a person who was never contacted from a draft campaign. Frees their place in the 300-person cap and keeps the draft launchable; stop anyone already contacted instead.

- API: `DELETE /campaigns/people/{enrollmentId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/campaigns/people/{enrollmentId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

## Chat

### dench chat list

List past chat threads.

- API: `GET /chat/threads`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/chat/threads" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench chat search

Search past chat messages.

- API: `GET /chat/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/chat/search?query=string" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench chat read

Read a past chat thread.

- API: `GET /chat/threads/{threadId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/chat/threads/{threadId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench chat tree

Read the parent-child chat thread hierarchy.

- API: `GET /chat/tree`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/chat/tree" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench chat rename

Rename one or more chat threads.

- API: `PATCH /chat/threads`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/chat/threads" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "items": [
      {
        "threadId": "th_abc123",
        "title": "Deploy checklist"
      }
    ]
  }'
```

### dench chat delete

Delete one or more chat threads.

- API: `DELETE /chat/threads`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/chat/threads" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "threadIds": [
      "th_abc123"
    ]
  }'
```

### dench chat new

Start a new chat-turn workflow.

- API: `POST /chat/threads`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench agent new`

```bash
curl -sS -X POST "$DENCH_API_BASE/chat/threads" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "prompt": "Summarize the latest CRM changes."
  }'
```

### dench chat send

Send a message to an existing chat thread.

- API: `POST /chat/threads/{threadId}/messages`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench agent send`

```bash
curl -sS -X POST "$DENCH_API_BASE/chat/threads/{threadId}/messages" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "prompt": "string"
  }'
```

### dench chat follow

Follow a live chat response stream.

- API: `GET /chat/threads/{threadId}/stream`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench agent follow`

```bash
curl -sS "$DENCH_API_BASE/chat/threads/{threadId}/stream" -H "Authorization: Bearer $DENCH_API_KEY"
```

## Crm

### dench crm objects list [--with-references]

List CRM objects.

- API: `GET /crm/objects`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm objects list --compact

List names, display labels, visibility and workspace counts without internal state.

- API: `GET /crm/catalog/objects`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/catalog/objects" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm objects get

Get a CRM object.

- API: `GET /crm/objects/{name}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{name}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm objects create

Create a CRM object.

- API: `POST /crm/objects`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "lead",
    "description": "Sales leads",
    "defaultView": "kanban",
    "icon": "target"
  }'
```

### dench crm objects update

Update a CRM object.

- API: `PATCH /crm/objects/{name}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/crm/objects/{name}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm objects rename

Rename a CRM object.

- API: `POST /crm/objects/{from}/rename`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{from}/rename" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "to": "string"
  }'
```

### dench crm objects delete

Delete a CRM object.

- API: `DELETE /crm/objects/{name}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/objects/{name}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm objects archive

Hide a CRM object's workspace sidebar row for the whole workspace. Not a delete — the table keeps working. Admin-only.

- API: `POST /crm/objects/{name}/archive`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{name}/archive" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm objects unarchive

Restore a CRM object's workspace sidebar row. Admin-only.

- API: `POST /crm/objects/{name}/unarchive`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{name}/unarchive" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm views list

List the saved views on a CRM object (plus the active view).

- API: `GET /crm/objects/{objectName}/views`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/views" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm views get

Get one saved view's definition by name.

- API: `GET /crm/objects/{objectName}/views/{viewName}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/views/{viewName}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm views entries

Materialize a saved view's rows (applies its filters/sort/pins), paginated.

- API: `GET /crm/objects/{objectName}/views/{viewName}/entries`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/views/{viewName}/entries" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm views create

Create a saved view (named filters/sort/columns combo) on a CRM object.

- API: `POST /crm/objects/{objectName}/views`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/views" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "view": {
      "name": "Hot leads",
      "view_type": "table",
      "filters": {
        "id": "g1",
        "conjunction": "and",
        "rules": [
          {
            "id": "r1",
            "field": "Status",
            "operator": "is",
            "value": "Hot"
          }
        ]
      },
      "sort": [
        {
          "field": "created_at",
          "direction": "desc"
        }
      ]
    },
    "setActive": true
  }'
```

### dench crm views update

Replace a saved view's definition (upsert by name).

- API: `PATCH /crm/objects/{objectName}/views/{viewName}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/crm/objects/{objectName}/views/{viewName}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "view": {
      "sort": [
        {
          "field": "Score",
          "direction": "desc"
        }
      ],
      "columns": [
        "Name",
        "Email",
        "Status",
        "Score"
      ]
    }
  }'
```

### dench crm views rename

Rename a saved view in place — keeps its filters, pins, and sidebar slot.

- API: `POST /crm/objects/{objectName}/views/{viewName}/rename`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/views/{viewName}/rename" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm views delete

Delete a saved view by name (idempotent).

- API: `DELETE /crm/objects/{objectName}/views/{viewName}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/objects/{objectName}/views/{viewName}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm views archive

Move a pinned view's sidebar row into the Archived flyout. Admin-only.

- API: `POST /crm/objects/{objectName}/views/{viewName}/archive`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/views/{viewName}/archive" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm views unarchive

Restore a view's sidebar row (re-asserts its pin). Admin-only.

- API: `POST /crm/objects/{objectName}/views/{viewName}/unarchive`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/views/{viewName}/unarchive" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm sidebar list

Describe the workspace sidebar: Library rows in tree order (with their groups), the home-level Pinned strip, what is hidden and why, and whether the caller is an admin.

- API: `GET /crm/sidebar`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/sidebar" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm sidebar move

Reposition one Library row (or group) among the Library's top-level slots. Does not add a home-level Pinned tab. Workspace-shared; admin-only.

- API: `POST /crm/sidebar/move`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/sidebar/move" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "navId": "string",
    "position": "string"
  }'
```

### dench crm sidebar group create

Create a named sidebar group (e.g. "Hiring") in the workspace-shared Library. Open to any member.

- API: `POST /crm/sidebar/groups`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/sidebar/groups" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm sidebar group rename

Rename a sidebar group. Open to any member.

- API: `POST /crm/sidebar/groups/rename`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/sidebar/groups/rename" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm sidebar group delete

Dissolve a sidebar group; its rows return to the top level in its slot. Open to any member.

- API: `POST /crm/sidebar/groups/delete`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/sidebar/groups/delete" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm sidebar group add

Move a sidebar row into a group (groupId set) or back to the top level (groupId null). Open to any member.

- API: `POST /crm/sidebar/groups/move`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench crm sidebar group remove`

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/sidebar/groups/move" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm sidebar pin

Pin (pinned true) or unpin a Library row — or a whole group — on the home-level Pinned shortcut strip (the "tab on the left"). Does not move the row inside Library. Workspace-shared; open to any member.

- API: `POST /crm/sidebar/pins`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench crm sidebar unpin`

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/sidebar/pins" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm fields list

List fields for a CRM object, including read-only calculation metadata.

- API: `GET /crm/objects/{objectName}/fields`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/fields" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm fields list --compact

List field names, types and effective constraints without indexing or enrichment internals.

- API: `GET /crm/catalog/objects/{objectName}/fields`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/catalog/objects/{objectName}/fields" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm fields create

Create a CRM field or read-only campaign activity boolean column.

- API: `POST /crm/objects/{objectName}/fields`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/fields" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "Status",
    "type": "enum",
    "enumValues": [
      "New",
      "Working",
      "Qualified",
      "Lost"
    ],
    "enumColors": [
      "#94a3b8",
      "#3b82f6",
      "#22c55e",
      "#ef4444"
    ],
    "indexed": true
  }'
```

### dench crm fields update

Update a CRM field or change/explicitly clear an existing campaign calculation.

- API: `PATCH /crm/objects/{objectName}/fields/{fieldName}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/crm/objects/{objectName}/fields/{fieldName}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm fields delete

Delete a CRM field.

- API: `DELETE /crm/objects/{objectName}/fields/{fieldName}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/objects/{objectName}/fields/{fieldName}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm fields reorder

Reorder CRM fields.

- API: `POST /crm/objects/{objectName}/fields/reorder`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/fields/reorder" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "orderedFieldNames": []
  }'
```

### dench crm fields enum-reorder

Reorder enum values.

- API: `POST /crm/objects/{objectName}/fields/{fieldName}/enum/reorder`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/fields/{fieldName}/enum/reorder" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "orderedValues": []
  }'
```

### dench crm fields enum-add

Add an enum value.

- API: `POST /crm/objects/{objectName}/fields/{fieldName}/enum`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/fields/{fieldName}/enum" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "value": "Nurturing",
    "color": "#eab308",
    "position": 2
  }'
```

### dench crm fields enum-remove

Remove an enum value.

- API: `DELETE /crm/objects/{objectName}/fields/{fieldName}/enum/{value}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/objects/{objectName}/fields/{fieldName}/enum/{value}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm fields enum-rename

Rename an enum value.

- API: `POST /crm/objects/{objectName}/fields/{fieldName}/enum/{oldValue}/rename`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/fields/{fieldName}/enum/{oldValue}/rename" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "newValue": "string"
  }'
```

### dench crm fields enum-set-color

Set an enum color.

- API: `POST /crm/objects/{objectName}/fields/{fieldName}/enum/{value}/color`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/fields/{fieldName}/enum/{value}/color" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "color": "#22c55e"
  }'
```

### dench crm entries list [--with-references]

List CRM entries.

- API: `GET /crm/objects/{objectName}/entries`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm entries get

Get a CRM entry.

- API: `GET /crm/objects/{objectName}/entries/{entryId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm entries sync-history

Queue a full, paged pull of the record's email history from every connected mailbox; the ledger fills as pages land.

- API: `POST /crm/objects/{objectName}/entries/{entryId}/sync-history`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/sync-history" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm entries sync-history --status

Has Dench read this record's email history? One row per address per mailbox.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/sync-history`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/sync-history" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm entries dossier

Status of the account's research dossier — the delimited `dench:dossier` section Dench keeps in the record's Notes: status, when it was written, how many dated updates followed, the last error.

- API: `GET /crm/entries/{entryId}/dossier`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/entries/{entryId}/dossier" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm entries dossier --regenerate

Research the account again and append a fresh dossier section to its Notes (needs a Website / Domain on the record).

- API: `POST /crm/entries/{entryId}/dossier/regenerate`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/entries/{entryId}/dossier/regenerate" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm privacy status

Whether the caller hides their own emails / messages with this record from the workspace (directly, or through its account), and whether they own a connection the toggle applies to.

- API: `GET /crm/entries/{entryId}/privacy`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/entries/{entryId}/privacy" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm privacy hide|show

Hide (`hidden: true`) or show the caller's own emails / messages with this record to the workspace. An account covers every contact and opportunity linked to it; existing ledger rows are restamped and the shared Brief regenerates.

- API: `PUT /crm/entries/{entryId}/privacy`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/entries/{entryId}/privacy" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "hidden": true
  }'
```

### dench crm detections list

List account-detection verdicts — why a domain (or personal address) did or did not become an account: verdict, counterparty type, probabilities, evidence threads, the rows created. `kind` picks the creator: `detections` (email + sweep), `linkedin` (the LinkedIn resolver's rows) or `all` (default). Newest first.

- API: `GET /crm/detections`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/detections" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm detections undo

Undo what the ingestion jobs created since a timestamp (admin): `kind` = `detections` (accounts + contacts from the email detector and the sweep), `linkedin` (the LinkedIn resolver's contacts + accounts; their conversations are unlinked and parked), `email-tasks` (auto-created tasks and cases) or `all` (default). Deletes only rows no human has touched and marks the verdicts / decisions rolled_back so they are never re-created. `dryRun` lists what would go; per-kind counts in `kinds`.

- API: `POST /crm/detections/undo`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/detections/undo" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "since": 0
  }'
```

### dench crm history

List a CRM entry's audit history.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/history`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/history" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm activity

List a CRM entry's activity ledger (comments, notes, field changes, emails, meetings, Slack, LinkedIn) in one timeline, newest first by default.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/activity`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/activity" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm brief

The record's generated Brief: health, who owes the next move, open threads, commitments, risks, next step. Read this before the ledger.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/brief`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/brief" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm context

Read-only source diagnostics: accessible evidence, association reasons, last Brief source manifest, generation queue, and your mailbox delivery health. Bounded, cursor-paged snapshot; does not certify complete history.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/context`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/context" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm brief --regenerate

Rebuild a record's Brief from the current timeline.

- API: `POST /crm/objects/{objectName}/entries/{entryId}/brief/regenerate`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/brief/regenerate" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm activity

Bounded per-source counts of a CRM entry's activity ledger.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/activity/count`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/activity/count" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm notes list

List a CRM entry's notes (titled, document-style comments), newest first.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/notes`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/notes" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm notes create

Add a titled note to a CRM entry's activity timeline (markdown body). Research goes here, never into the Notes document.

- API: `POST /crm/objects/{objectName}/entries/{entryId}/notes`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/notes" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm comments list

List comments on a CRM entry (roots newest first, with preview replies).

- API: `GET /crm/objects/{objectName}/entries/{entryId}/comments`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/comments" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm comments replies

List every reply under a root comment, oldest first.

- API: `GET /crm/comments/{commentId}/replies`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/comments/{commentId}/replies" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm comments get

Get one comment with its entry label.

- API: `GET /crm/comments/{commentId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/comments/{commentId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm comments create

Comment on a CRM entry (markdown). Mention members with [@Name](/?member=<userId>); mention Dench with [@Dench](/?member=dench) or mentionDench.

- API: `POST /crm/objects/{objectName}/entries/{entryId}/comments`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/comments" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "body": "Kickoff went well — [@Bob](/?member=user_bob) can you send the proposal? [@Dench](/?member=dench) what's the ARR here?"
  }'
```

### dench crm comments update

Edit a comment you wrote.

- API: `PATCH /crm/comments/{commentId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/crm/comments/{commentId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "body": "Kickoff went well — proposal sent."
  }'
```

### dench crm comments delete

Delete a comment (kept as a tombstone when it has replies).

- API: `DELETE /crm/comments/{commentId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/comments/{commentId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm comments react

Toggle an emoji reaction on a comment.

- API: `PUT /crm/comments/{commentId}/reactions/{emoji}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/comments/{commentId}/reactions/{emoji}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm watch status

Whether you follow a CRM entry's activity.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/watch`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/watch" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm watch

Follow or unfollow a CRM entry's activity.

- API: `PUT /crm/objects/{objectName}/entries/{entryId}/watch`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/watch" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "watching": true
  }'
```

### dench crm tasks mine --page

Page assigned tasks in priority order (or completed tasks by recency).

- API: `POST /crm/tasks/assigned/page`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/tasks/assigned/page" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks list --page

Page all tasks linked to a record, including subtasks.

- API: `POST /crm/objects/{objectName}/entries/{entryId}/tasks/page`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/tasks/page" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks prepare

Start or resume preparation of exact task ordering and progress.

- API: `POST /crm/tasks/prepare`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/tasks/prepare" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks mine

Your open tasks (plus ones completed today).

- API: `GET /crm/tasks/mine`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/tasks/mine" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks list

Tasks linked to a CRM entry.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/tasks`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/tasks" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks create

Create a task linked to a CRM entry.

- API: `POST /crm/objects/{objectName}/entries/{entryId}/tasks`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/tasks" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "Send proposal",
    "assigneeUserId": "user_bob",
    "dueDateKey": "2026-09-05"
  }'
```

### dench crm tasks complete

Mark a task done.

- API: `POST /crm/tasks/{entryId}/complete`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/tasks/{entryId}/complete" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks reopen

Reopen a completed task.

- API: `POST /crm/tasks/{entryId}/reopen`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/tasks/{entryId}/reopen" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks priority

Set or clear a task's priority.

- API: `PUT /crm/tasks/{entryId}/priority`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/tasks/{entryId}/priority" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "priority": "string"
  }'
```

### dench crm tasks subtasks

A task's subtasks.

- API: `GET /crm/tasks/{entryId}/subtasks`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/tasks/{entryId}/subtasks" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks create-subtask

Create a subtask under a task (inherits the parent's record relations).

- API: `POST /crm/tasks/{entryId}/subtasks`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/tasks/{entryId}/subtasks" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "string"
  }'
```

### dench crm tasks parent

Nest a task under a parent, or promote it (parentEntryId: null).

- API: `PUT /crm/tasks/{entryId}/parent`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/tasks/{entryId}/parent" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "parentEntryId": "string"
  }'
```

### dench crm tasks delete

Delete a task and its subtasks, or keep them as tasks.

- API: `DELETE /crm/tasks/{entryId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/tasks/{entryId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks repeat

How a task repeats (rule, RRULE, trigger, ends, next due).

- API: `GET /crm/tasks/{entryId}/repeat`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/tasks/{entryId}/repeat" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks repeat

Make a task repeat, or change how it repeats (JSON rule or RRULE). An undated task gets its due date anchored on the first matching day from today.

- API: `PUT /crm/tasks/{entryId}/repeat`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/tasks/{entryId}/repeat" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks repeat --off

Stop a task repeating (past occurrences are kept).

- API: `DELETE /crm/tasks/{entryId}/repeat`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/tasks/{entryId}/repeat" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks repeat --skip

Skip the current occurrence: the next one is created now.

- API: `POST /crm/tasks/{entryId}/repeat/skip`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/tasks/{entryId}/repeat/skip" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks repeat --pause

Pause a repeating task.

- API: `POST /crm/tasks/{entryId}/repeat/pause`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/tasks/{entryId}/repeat/pause" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks repeat --resume

Resume a paused repeating task.

- API: `POST /crm/tasks/{entryId}/repeat/resume`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/tasks/{entryId}/repeat/resume" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks series

Every repeating-task series in the workspace.

- API: `GET /crm/tasks/series`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/tasks/series" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm tasks series <seriesId> --occurrences

Every occurrence (task) of one series.

- API: `GET /crm/tasks/series/{seriesId}/occurrences`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/tasks/series/{seriesId}/occurrences" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm entries create

Create a CRM entry.

- API: `POST /crm/objects/{objectName}/entries`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "data": {
      "Name": "Joint review",
      "Assignee": [
        "user_kumar",
        "user_mark"
      ],
      "Status": "New"
    }
  }'
```

### dench crm entries create-many

Create many CRM entries.

- API: `POST /crm/objects/{objectName}/entries/batch`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries/batch" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "entries": [
      {
        "Name": "Jane",
        "Email": "jane@example.com"
      },
      {
        "Name": "Bob",
        "Email": "bob@example.com"
      }
    ]
  }'
```

### dench crm entries update

Update a CRM entry.

- API: `PATCH /crm/objects/{objectName}/entries/{entryId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "data": {}
  }'
```

### dench crm entries update-many

Update many CRM entries.

- API: `PATCH /crm/objects/{objectName}/entries/batch`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/crm/objects/{objectName}/entries/batch" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "updates": []
  }'
```

### dench crm entries delete

Delete a CRM entry.

- API: `DELETE /crm/objects/{objectName}/entries/{entryId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm entries bulk-delete

Bulk delete CRM entries.

- API: `POST /crm/objects/{objectName}/entries/delete`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries/delete" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "entryIds": []
  }'
```

### dench crm cells get

Get a CRM cell value.

- API: `GET /crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm cells set

Set a CRM cell value.

- API: `PUT /crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "value": [
      "user_kumar",
      "user_mark"
    ]
  }'
```

### dench crm cells set-many

Set many CRM cell values.

- API: `POST /crm/cells/batch`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/cells/batch" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "cells": []
  }'
```

### dench crm cells append

Append to a CRM cell.

- API: `POST /crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}/append`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/entries/{entryId}/fields/{fieldName}/append" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "value": "value"
  }'
```

### dench crm query [--with-references]

Query CRM entries.

- API: `POST /crm/query`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/query" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "lead",
    "dslJson": "{\"filter\":{\"Status\":\"Qualified\",\"Score\":{\"$gt\":50}},\"sort\":\"-Score\",\"limit\":50}"
  }'
```

### dench crm query --page

Scan CRM entries with a resumable cursor. Empty filtered pages can have more results.

- API: `POST /crm/query/page`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/query/page" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string",
    "paginationOpts": {}
  }'
```

### dench crm sql

Run CRM SQL-compatible query.

- API: `POST /crm/sql`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/sql" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string"
  }'
```

### dench crm aggregate

Aggregate CRM entries.

- API: `POST /crm/aggregate`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/aggregate" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string",
    "fieldName": "string"
  }'
```

### dench crm search [--with-references]

Search CRM entries.

- API: `GET /crm/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/search?text=string" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm search --page

Search bounded pages of readable CRM entries, optionally projecting cells. Always follow continueCursor until isDone.

- API: `GET /crm/search/page`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/search/page?text=string" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm statuses list

List CRM statuses.

- API: `GET /crm/objects/{objectName}/statuses`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/statuses" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm statuses set

Set CRM statuses.

- API: `PUT /crm/objects/{objectName}/statuses`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/objects/{objectName}/statuses" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "statuses": [
      {
        "name": "New",
        "color": "#94a3b8"
      },
      {
        "name": "Working",
        "color": "#3b82f6"
      },
      {
        "name": "Qualified",
        "color": "#22c55e",
        "isDefault": true
      }
    ]
  }'
```

### dench crm batch

Apply a CRM batch.

- API: `POST /crm/batch`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/batch" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "ops": [
      {
        "type": "entries.create",
        "objectName": "people",
        "data": {
          "Name": "Jane"
        }
      }
    ],
    "idempotencyKey": "import-2026-06-01"
  }'
```

### dench crm transaction begin

Begin a CRM transaction.

- API: `POST /crm/transactions`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/transactions" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm transaction add

Add an operation to a CRM transaction.

- API: `POST /crm/transactions/{txnId}/operations`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/transactions/{txnId}/operations" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "op": {
      "type": "entries.update",
      "entryId": "ent_lead99",
      "data": {
        "Status": "Qualified"
      }
    }
  }'
```

### dench crm transaction commit

Commit a CRM transaction.

- API: `POST /crm/transactions/{txnId}/commit`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/transactions/{txnId}/commit" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm transaction abort

Abort a CRM transaction.

- API: `POST /crm/transactions/{txnId}/abort`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/transactions/{txnId}/abort" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm transaction inspect

Inspect a CRM transaction.

- API: `GET /crm/transactions/{txnId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/transactions/{txnId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm docs list

List CRM documents.

- API: `GET /crm/docs`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/docs" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm docs create

Create a CRM document.

- API: `POST /crm/docs`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/docs" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "title": "string",
    "filePath": "string"
  }'
```

### dench crm docs link

Link a CRM document.

- API: `POST /crm/docs/link`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/docs/link" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "filePath": "string"
  }'
```

### dench crm docs delete

Delete a CRM document page; its workspace file stays and nested pages move up.

- API: `DELETE /crm/docs/{documentId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/docs/{documentId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm actions list

List CRM actions.

- API: `GET /crm/actions`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/actions?entryId=string" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm actions create

Create or upsert an action button on a named action column (fieldName is the column header; a column can hold multiple buttons — reuse fieldName to add more).

- API: `POST /crm/actions`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/actions" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string",
    "fieldName": "string"
  }'
```

### dench crm actions edit

Update an action button on a CRM field.

- API: `PATCH /crm/actions/{actionId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/crm/actions/{actionId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string",
    "fieldName": "string"
  }'
```

### dench crm actions delete

Delete an action button from a CRM field.

- API: `DELETE /crm/actions/{actionId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/actions/{actionId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string"
  }'
```

### dench crm actions run

Run a CRM action on one or more entries.

- API: `POST /crm/actions/{actionId}/runs`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/actions/{actionId}/runs" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string",
    "fieldId": "string",
    "entryIds": []
  }'
```

### dench members list

List workspace members for CRM user fields.

- API: `GET /members`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/members" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm reports generate

Generate a CRM report.

- API: `POST /crm/reports`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/reports" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string",
    "type": "pie",
    "groupByField": "string"
  }'
```

### dench crm analytics get

Read an object's analytics dashboard: panels, field roles, the strip's collapsed flag, the named view's own dashboard (if any), and the fields panels may bucket on (synthetic $createdAt / $location last).

- API: `GET /crm/objects/{objectName}/analytics`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/objects/{objectName}/analytics" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm analytics compute

Compute chart-ready results (buckets / series / values) for the stored dashboard, a subset of its panels, or ad-hoc panel definitions — optionally scoped to a saved view, a period preset (with the previous interval as previousValue) and extra filters. Same query the strip renders from.

- API: `POST /crm/objects/{objectName}/analytics/compute`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/analytics/compute" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "period": "this_month",
    "panels": [
      {
        "id": "adhoc:leads-by-source",
        "title": "New leads by source",
        "type": "donut",
        "metric": "count",
        "groupBy": "Source",
        "sortOrder": 0
      }
    ]
  }'
```

### dench crm analytics save

Create or update one panel (upsert by id). With viewName the write lands on that saved view's own dashboard, forking a copy if it was still inheriting the object's.

- API: `PUT /crm/objects/{objectName}/analytics/panels/{panelId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/objects/{objectName}/analytics/panels/{panelId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "panel": {
      "title": "Open pipeline",
      "type": "stat",
      "metric": "sum",
      "derived": "open_pipeline",
      "sortOrder": 10
    }
  }'
```

### dench crm analytics update

Edit part of one stored panel: only the keys in `patch` change (title, type, metric, metricField, groupBy, dateField, dateBucket, filters, derived, span, hidden, sortOrder); null clears an optional key. What the card's ⋮ menu writes.

- API: `PATCH /crm/objects/{objectName}/analytics/panels/{panelId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/crm/objects/{objectName}/analytics/panels/{panelId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "patch": {}
  }'
```

### dench crm analytics hide

Take a chart off the strip above the table (hidden: true). It stays in the full analytics view, counted by the strip's “+N more”.

- API: `POST /crm/objects/{objectName}/analytics/panels/{panelId}/hide`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/analytics/panels/{panelId}/hide" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm analytics show

Bring a hidden chart back onto the strip (hidden: false).

- API: `POST /crm/objects/{objectName}/analytics/panels/{panelId}/show`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/analytics/panels/{panelId}/show" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm analytics resize

Set a card's width on the 6-track dashboard grid: span 2 (third), 3 (half), 4 (two thirds), 6 (full), or null for the chart kind's default.

- API: `POST /crm/objects/{objectName}/analytics/panels/{panelId}/resize`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/analytics/panels/{panelId}/resize" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "span": 0
  }'
```

### dench crm analytics delete

Delete one panel (idempotent). Template panels are tombstoned so a re-install never resurrects them.

- API: `DELETE /crm/objects/{objectName}/analytics/panels/{panelId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/crm/objects/{objectName}/analytics/panels/{panelId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm analytics reorder

Persist the full panel order. panelIds must name every stored panel of the targeted dashboard.

- API: `POST /crm/objects/{objectName}/analytics/reorder`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/analytics/reorder" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "panelIds": [
      "tpl:sales:total-leads",
      "tpl:sales:leads-by-source"
    ]
  }'
```

### dench crm analytics roles

Set the object's analytics setup — the field roles shared by every chart and view (amount, stage, won/lost/converted values, stageProbabilities, closeDate, recurrence, owner, location). Replaces the mapping; with merge: true only the keys given change and null clears one.

- API: `PUT /crm/objects/{objectName}/analytics/roles`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/crm/objects/{objectName}/analytics/roles" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "fieldRoles": {
      "amount": "Amount",
      "stage": "Stage",
      "wonValues": [
        "Closed Won"
      ],
      "lostValues": [
        "Closed Lost"
      ],
      "closeDate": "Close Date",
      "owner": "Owner",
      "location": "Account.HQ Location",
      "recurrence": "annual"
    }
  }'
```

### dench crm analytics collapse

Collapse the analytics strip above the object's table (team-shared, like saved views).

- API: `POST /crm/objects/{objectName}/analytics/collapse`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/analytics/collapse" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm analytics expand

Expand the analytics strip above the object's table.

- API: `POST /crm/objects/{objectName}/analytics/expand`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/analytics/expand" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm analytics scope

Give a saved view its own dashboard (mode "own": starts as a copy of the object's panels) or hand it back to the object's shared one (mode "shared").

- API: `POST /crm/objects/{objectName}/views/{viewName}/analytics/scope`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/objects/{objectName}/views/{viewName}/analytics/scope" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "mode": "own"
  }'
```

### dench crm enrich cell

Request enrichment for one CRM cell.

- API: `POST /crm/enrich/cell`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/enrich/cell" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string",
    "entryId": "string",
    "fieldName": "string"
  }'
```

### dench crm enrich object

Request enrichment for a CRM object.

- API: `POST /crm/enrich/object`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/enrich/object" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "string",
    "fieldName": "string"
  }'
```

### dench crm people search

Search for people through the enrichment gateway. `companyDomains` takes up to 1000 domains (e.g. a resolved company list; `dench leads find --company-list <id|view>` resolves one for you) — the gateway fans large lists out as sequential vendor-safe chunks behind one `nextPageToken` stream.

- API: `POST /enrichment/people/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/enrichment/people/search" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "titles": [
      "Head of Sales"
    ],
    "industries": [
      "SaaS"
    ],
    "companyDomains": [
      "acme.com",
      "globex.com"
    ],
    "limit": 10
  }'
```

### dench crm companies search

Search for companies through the enrichment gateway (also `dench companies find`).

- API: `POST /enrichment/company/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench companies find`

```bash
curl -sS -X POST "$DENCH_API_BASE/enrichment/company/search" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "domain": "example.com"
  }'
```

### dench jobs find

Search job postings through Dench find. `companyDomains` takes up to 1000 domains (chunked automatically); `dench jobs find --company-list <id|view>` resolves a saved company list into it.

- API: `POST /enrichment/jobs/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/enrichment/jobs/search" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "titles": [
      "Account Executive"
    ],
    "locations": [
      "San Francisco"
    ],
    "companyDomains": [
      "acme.com",
      "globex.com"
    ],
    "limit": 50
  }'
```

### dench crm enrich cell

Look up one person profile.

- API: `POST /enrichment/person`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/enrichment/person" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "linkedinURL": "https://www.linkedin.com/in/janedoe"
  }'
```

### dench crm enrich cell

Look up one company profile.

- API: `POST /enrichment/company`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/enrichment/company" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "website": "acme.com"
  }'
```

### dench crm enrich cell

Look up verified emails and phones for people.

- API: `POST /enrichment/person/contact`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/enrichment/person/contact" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "contacts": [
      {
        "linkedinUrl": "https://www.linkedin.com/in/janedoe"
      }
    ]
  }'
```

### dench crm enrich profiles

Look up up to 100 people or company profiles without buying emails or phones. Pass kind (people|companies) and lookups; results preserve inputIndex. People require linkedinUrl or email; companies require domain or linkedinUrl.

- API: `POST /enrichment/profiles/bulk`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/enrichment/profiles/bulk" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "kind": "companies",
    "lookups": [
      {
        "domain": "acme.com"
      }
    ]
  }'
```

### dench companies related

Read company employees, founders, funding, investors, acquisitions, or investments. Pass domain or linkedinUrl, kind, limit (1–100), and optional pageToken. Does not import CRM records or buy contacts.

- API: `POST /enrichment/company/related`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/enrichment/company/related" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "domain": "acme.com",
    "kind": "founders",
    "limit": 10
  }'
```

### dench leads find --limit 1

Preview how many records a find would return.

- API: `POST /enrichment/search/preview`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/enrichment/search/preview" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "kind": "people",
    "titles": [
      "VP Sales"
    ]
  }'
```

### dench leads filters

List Lead Finder filter vocabularies: exact enum values (seniorities, functions, industries, headcount, company types, languages) and curated suggestions (titles, locations, company HQ, universities, skills, keywords).

- API: `GET /local/enrichment/filter-options`
- Auth: No bearer token required.

```bash
# dench leads filters
# Local-only: Catalogs are bundled with the CLI. Over HTTPS, fetch https://dench.com/references/find-filter-options.json instead.
```

### dench crm templates list

List one-click CRM templates (objects + automations + sample rows) with per-workspace installed flags.

- API: `GET /crm/templates`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/templates" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm templates install

Install a CRM template. Idempotent: re-installs top up missing pieces and never duplicate objects, automations, or sample rows.

- API: `POST /crm/templates/{templateId}/install`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/templates/{templateId}/install" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm templates remove-sample-data

Delete a CRM template's sample rows (tagged "Sample"); schema, views, and automations stay.

- API: `POST /crm/templates/{templateId}/remove-sample-data`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/templates/{templateId}/remove-sample-data" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm automations list

List deterministic CRM automations (rules that fire inside entry writes, e.g. qualified prospect → opportunity).

- API: `GET /crm/automations`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/automations" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm automations enable|disable

Enable or disable a CRM automation.

- API: `PATCH /crm/automations/{automationId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/crm/automations/{automationId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench crm exports start

Start a server-side CSV export of a CRM object into the workspace files (/exports). Returns at once; one export runs per workspace, and a second start returns the running one.

- API: `POST /crm/exports`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/crm/exports" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "objectName": "people",
    "columns": [
      "Name",
      "Email",
      "Status"
    ],
    "where": {
      "Status": "Customer"
    }
  }'
```

### dench crm exports get

Read a CRM CSV export's progress, and its file path and download link once done.

- API: `GET /crm/exports/{jobId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/crm/exports/{jobId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

## Email

### dench email identity verify

Start Dench Emailing Service sender verification.

- API: `POST /email/identities/verify`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/identities/verify" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "type": "email",
    "identity": "founder@example.com"
  }'
```

### dench email identity verify

Create a durable Dench email sending identity record.

- API: `POST /email/sending-identities`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sending-identities" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "type": "domain",
    "domain": "example.com",
    "fromEmail": "founder@example.com",
    "fromName": "Ada at Example"
  }'
```

### dench email identity status --identity-id

Refresh a Dench Emailing Service sender verification status.

- API: `POST /email/sending-identities/{identityId}/status`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sending-identities/{identityId}/status" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email identity verify

Begin the full Dench sender verification flow for a sending identity.

- API: `POST /email/sending-identities/{identityId}/verify`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sending-identities/{identityId}/verify" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email identity status

Read Dench Emailing Service sender verification status.

- API: `GET /email/identities/{identity}/status`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/identities/{identity}/status" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email identity list

List the workspace's email sending identities.

- API: `GET /email/sending-identities`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/sending-identities" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email identity dns

Fetch DNS records (DKIM/SPF/DMARC) for a pending domain sender verification.

- API: `GET /email/sending-identities/{identityId}/dns`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/sending-identities/{identityId}/dns" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email identity disable

Soft-disable a sender (or every sender on a domain) for the workspace; sends are blocked until restored.

- API: `POST /email/sending-identities/{identity}/disable`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sending-identities/{identity}/disable" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email identity restore

Restore a previously disabled sender for the workspace.

- API: `POST /email/sending-identities/{identity}/restore`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sending-identities/{identity}/restore" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email identity delete

Permanently delete a sender (or every sender on a domain) from the workspace; re-adding it requires verification from scratch.

- API: `DELETE /email/sending-identities/{identity}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/email/sending-identities/{identity}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email inbox search

Search authorized synced mailbox headers with bounded cursor pagination. isDone covers stored records, not provider completeness.

- API: `GET /email/inbox/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/inbox/search" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email inbox thread

Read a bounded page of synced headers using an exact thread handle from inbox search; bodies remain on demand.

- API: `GET /email/inbox/threads/{threadHandle}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/inbox/threads/{threadHandle}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email inbox message

Read a bounded stored body using an exact message handle from inbox search; rechecks mailbox and record privacy.

- API: `GET /email/inbox/messages/{messageHandle}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/inbox/messages/{messageHandle}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email draft create

Create an editable Dench email draft and synchronize its selected native mailbox asynchronously. Use a stable requestId for retries.

- API: `POST /email/drafts`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/drafts" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "requestId": "string"
  }'
```

### dench email draft show

Read an email draft, eligible senders and provider sync status.

- API: `GET /email/drafts/{draftId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/drafts/{draftId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email draft senders

List native mailboxes this caller may use.

- API: `GET /email/drafts/senders`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/drafts/senders" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email draft update

Save draft content using expectedRevision; sender changes require a new draft after provider binding.

- API: `PATCH /email/drafts/{draftId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/email/drafts/{draftId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "expectedRevision": 0,
    "patch": {}
  }'
```

### dench email draft send

Send the current Dench draft revision through its native mailbox. Repeated requests share a durable receipt.

- API: `POST /email/drafts/{draftId}/send`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/drafts/{draftId}/send" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "expectedRevision": 0
  }'
```

### dench email draft attach

Upload attachment bytes authorized against this draft before adding its storage reference.

- API: `POST /email/drafts/{draftId}/attachments`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/drafts/{draftId}/attachments" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "string",
    "contentType": "string",
    "contentBase64": "string"
  }'
```

### dench email draft signature

Load the selected mailbox signature for explicit visible insertion.

- API: `GET /email/drafts/{draftId}/signature`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/drafts/{draftId}/signature" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email send [--mailbox <id/email>]

Send through a native Gmail or Outlook mailbox with a durable request receipt. Only use for an explicit send request.

- API: `POST /email/native/send`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/native/send" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "requestId": "send-intro-001",
    "to": [
      {
        "email": "ada@example.com",
        "name": "Ada"
      }
    ],
    "subject": "Introduction",
    "textBody": "Hello Ada"
  }'
```

### dench email send --from <verified-email>

Send one raw email (no campaign): to/cc/bcc, custom from-name and reply-to, optional reply threading via replyToMessageId.

- API: `POST /email/send`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/send" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "fromEmail": "founder@example.com",
    "to": [
      {
        "email": "ada@lovelace.dev",
        "name": "Ada"
      }
    ],
    "subject": "Quick intro",
    "htmlBody": "<p>Hi Ada — great meeting you!</p>"
  }'
```

### dench email message status

Read a raw email message's status and open/click counters.

- API: `GET /email/messages/{messageId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/messages/{messageId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email message list

List recent raw email messages for the workspace.

- API: `GET /email/messages`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/messages" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email template create

Create a managed email campaign template.

- API: `POST /email/templates`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/templates" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "Intro outreach",
    "subject": "Hi {{firstName}}",
    "htmlBody": "<p>Hi {{firstName}}, saw your work at {{company}}.</p>"
  }'
```

### dench email template preview

Preview a managed email campaign template.

- API: `POST /email/templates/{templateId}/preview`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/templates/{templateId}/preview" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "data": {
      "firstName": "Ada",
      "company": "Lovelace Labs"
    }
  }'
```

### dench email campaign create

Create a managed email campaign draft from a connected inbox or verified sender.

- API: `POST /email/campaigns`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/campaigns" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "Q2 outreach",
    "identityId": "founder@example.com",
    "templateId": "etpl_abc123"
  }'
```

### dench email campaign status

Read campaign status and counters.

- API: `GET /email/campaigns/{campaignId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/campaigns/{campaignId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email campaign recipients add

Add recipients to a managed email campaign.

- API: `POST /email/campaigns/{campaignId}/recipients`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/campaigns/{campaignId}/recipients" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "recipients": [
      {
        "email": "ada@lovelace.dev",
        "displayName": "Ada Lovelace",
        "personalization": {
          "firstName": "Ada",
          "company": "Lovelace Labs"
        }
      }
    ]
  }'
```

### dench email campaign preview

Preview rendered messages for a campaign sample.

- API: `POST /email/campaigns/{campaignId}/preview`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/campaigns/{campaignId}/preview" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "sample": 5
  }'
```

### dench email campaign submit

Submit a campaign for approval or sending.

- API: `POST /email/campaigns/{campaignId}/submit`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/campaigns/{campaignId}/submit" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email campaign pause

Pause a sending email campaign.

- API: `POST /email/campaigns/{campaignId}/pause`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/campaigns/{campaignId}/pause" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email campaign resume

Resume a paused email campaign.

- API: `POST /email/campaigns/{campaignId}/resume`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/campaigns/{campaignId}/resume" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email campaign cancel

Cancel an email campaign.

- API: `POST /email/campaigns/{campaignId}/cancel`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/campaigns/{campaignId}/cancel" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email campaign list

List managed email campaigns (paginated, optional status filter).

- API: `GET /email/campaigns`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/campaigns" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email campaign recipients list

List a campaign's recipients (paginated, optional status filter).

- API: `GET /email/campaigns/{campaignId}/recipients`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/campaigns/{campaignId}/recipients" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email campaign recipients add-from-object

Add campaign recipients from a CRM object: pick the object, the email field, and the entry ids.

- API: `POST /email/campaigns/{campaignId}/recipients/from-object`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/campaigns/{campaignId}/recipients/from-object" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence create

Create a follow-up sequence from a connected inbox or verified sender.

- API: `POST /email/sequences`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence update

Update a sequence's name, sender, or reply/stop settings.

- API: `POST /email/sequences/{sequenceId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/{sequenceId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence activate

Activate a sequence so its enrollments begin sending.

- API: `POST /email/sequences/{sequenceId}/activate`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/{sequenceId}/activate" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence deactivate

Deactivate a sequence (pause sending, revert to draft).

- API: `POST /email/sequences/{sequenceId}/deactivate`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/{sequenceId}/deactivate" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence archive

Archive a sequence (stops all sending).

- API: `POST /email/sequences/{sequenceId}/archive`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/{sequenceId}/archive" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence list

List the workspace's follow-up sequences.

- API: `GET /email/sequences`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/sequences" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence status

Read a sequence with its ordered steps.

- API: `GET /email/sequences/{sequenceId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/sequences/{sequenceId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence steps add

Add a step (subject, body, and wait delay) to a sequence.

- API: `POST /email/sequences/{sequenceId}/steps`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/{sequenceId}/steps" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence steps update

Update a sequence step's subject, body, or delay.

- API: `POST /email/sequences/steps/{stepId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/steps/{stepId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence steps remove

Remove a step from a sequence.

- API: `POST /email/sequences/steps/{stepId}/remove`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/steps/{stepId}/remove" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence steps reorder

Reorder a sequence's steps.

- API: `POST /email/sequences/{sequenceId}/steps/reorder`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/{sequenceId}/steps/reorder" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence enroll

Enroll explicit recipients into a sequence.

- API: `POST /email/sequences/{sequenceId}/enroll`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/{sequenceId}/enroll" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence enroll-from-object

Enroll people from a CRM object: pick the object, the email field, and the entry ids.

- API: `POST /email/sequences/{sequenceId}/enroll/from-object`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/{sequenceId}/enroll/from-object" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence enrollments list

List a sequence's enrollments (paginated, optional status filter).

- API: `GET /email/sequences/{sequenceId}/enrollments`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/email/sequences/{sequenceId}/enrollments" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence enrollment pause

Pause one enrollment.

- API: `POST /email/sequences/enrollments/{enrollmentId}/pause`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/enrollments/{enrollmentId}/pause" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence enrollment resume

Resume one paused enrollment.

- API: `POST /email/sequences/enrollments/{enrollmentId}/resume`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/enrollments/{enrollmentId}/resume" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench email sequence enrollment stop

Stop one enrollment (no further steps send).

- API: `POST /email/sequences/enrollments/{enrollmentId}/stop`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/email/sequences/enrollments/{enrollmentId}/stop" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

## Environments

### dench env list

List workspace-shared reusable setups and ready revisions (metadata only).

- API: `GET /environments`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/environments" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench env show

Inspect a saved setup, its manifest, and an optional immutable revision.

- API: `GET /environments/{name}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/environments/{name}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench env save

Reserve an owner-bound source upload. Prefix the uploaded bytes with the returned proof before saving.

- API: `POST /environments/uploads`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/environments/uploads" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "kind": "string",
    "size": 0,
    "sha256": "string"
  }'
```

### dench env save

Publish an explicitly saved source and manifest for one-time preparation. Returns pending/building until verified; does not run the task.

- API: `POST /environments/{name}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/environments/{name}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "manifest": {},
    "uploadId": "string",
    "storageId": "string",
    "sha256": "string"
  }'
```

### dench env delete

Retire a saved setup from new selection; retain immutable revisions and active job evidence.

- API: `DELETE /environments/{name}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/environments/{name}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench env run

Run a command with prepared dependencies and declared credentials, saving declared state with a revision check.

- API: `POST /local/environments/run`
- Auth: No bearer token required.

```bash
# dench env run
# Local-only: Execution occurs in the CLI process. Use dench env run NAME -- COMMAND; secret-bearing execution resolution is not a general REST read endpoint.
```

## Files

### dench files ls

List workspace files.

- API: `GET /files`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/files" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench files cat

Read a workspace file's text.

- API: `GET /files/content`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/files/content?path=string" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench files write

Write a workspace file's text.

- API: `PUT /files/content`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/files/content" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "path": "string",
    "content": "string"
  }'
```

### dench files download

Get a signed file download URL.

- API: `GET /files/download-url`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/files/download-url?path=string" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench files rm

Remove a workspace file or directory.

- API: `DELETE /files`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/files" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "path": "string"
  }'
```

### dench files mv

Move a workspace file or directory.

- API: `POST /files/move`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/files/move" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "from": "string",
    "to": "string"
  }'
```

### dench files mkdir

Create a workspace directory (and any missing parents). Idempotent.

- API: `POST /files/mkdir`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/files/mkdir" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "path": "string"
  }'
```

### dench stage

Stage uploaded content into the workspace.

- API: `POST /files/stage`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/files/stage" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

## Gateway

### dench search

Search the web through the Dench gateway.

- API: `POST /search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/search" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "query": "latest AI CRM workflows",
    "numResults": 5
  }'
```

### dench search contents

Fetch page contents through the Dench gateway.

- API: `POST /search/contents`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/search/contents" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "urls": []
  }'
```

### dench search answer

Answer a question with web search.

- API: `POST /search/answer`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/search/answer" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "query": "string"
  }'
```

### dench web scrape

Read a page as clean Markdown through Dench web.

- API: `POST /context/web-scrape-markdown`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/web-scrape-markdown" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "url": "https://example.com",
      "useMainContentOnly": true
    }
  }'
```

### dench web brand

Look up a brand kit from a domain or email.

- API: `POST /context/brand-retrieve`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/brand-retrieve" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "domain": "stripe.com"
    }
  }'
```

### dench web sitemap

List sitemap URLs for a domain.

- API: `POST /context/web-sitemap`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/web-sitemap" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "domain": "example.com",
      "maxLinks": 1000
    }
  }'
```

### dench web crawl

Crawl a site to Markdown (capped).

- API: `POST /context/web-crawl`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/web-crawl" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "url": "https://example.com",
      "maxPages": 15,
      "useMainContentOnly": true
    }
  }'
```

### dench web screenshot

Capture a rendered page screenshot.

- API: `POST /context/web-screenshot`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/web-screenshot" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "directUrl": "https://example.com",
      "fullScreenshot": false
    }
  }'
```

### dench web extract

Extract typed fields from a page using a JSON Schema.

- API: `POST /context/web-extract`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/web-extract" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "url": "https://example.com",
      "schema": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          }
        }
      }
    }
  }'
```

### dench web product

Extract a product listing from a URL.

- API: `POST /context/web-product`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/web-product" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "url": "https://example.com/product"
    }
  }'
```

### dench web competitors

Find competitors of a domain.

- API: `POST /context/web-competitors`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/web-competitors" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "domain": "stripe.com",
      "numCompetitors": 5
    }
  }'
```

### dench web styleguide

Read a brand styleguide from a domain.

- API: `POST /context/brand-styleguide`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/brand-styleguide" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "domain": "stripe.com"
    }
  }'
```

### dench web fonts

Read site fonts from a domain.

- API: `POST /context/brand-fonts`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/brand-fonts" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "domain": "stripe.com"
    }
  }'
```

### dench web classify

Classify a domain with NAICS or SIC.

- API: `POST /context/classify-naics`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/classify-naics" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "input": "stripe.com"
    }
  }'
```

### dench web brand-search

Autocomplete brand names.

- API: `POST /context/brand-search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/context/brand-search" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "input": {
      "query": "stripe"
    }
  }'
```

### dench image generate

Generate an image through the Dench gateway.

- API: `POST /images/generations`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/images/generations" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "prompt": "A minimal flat-vector app icon",
    "size": "1024x1024"
  }'
```

### dench image edit

Edit an image through the Dench gateway.

- API: `POST /images/edits`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/images/edits" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "prompt": "Make the background transparent",
    "input_images_base64": [
      "iVBORw0KGgoAAAANSUhEUg..."
    ]
  }'
```

### dench integrations

List every connected integration — connected apps plus the Gmail, Outlook, Calendar, LinkedIn and Slack connections Dench provides itself (Slack rows report source: dench).

- API: `GET /integrations`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/integrations" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench tool status

List connected tool accounts.

- API: `GET /tools/status`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/tools/status" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench tool connect

Create a tool OAuth connection link. Slack is in-house, never a third-party connection: for toolkit slack the CLI prints the first-party install URL (/api/slack/install?slug=<workspace>, org admin) instead of calling this endpoint.

- API: `POST /tools/connections`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/tools/connections" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench tool search

Search for external tool actions.

- API: `POST /tools/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/tools/search" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "queries": [
      {
        "use_case": "list Slack channels"
      }
    ]
  }'
```

### dench tool run

Run an external tool action. SLACK_* slugs (SLACK_SEND_MESSAGE with Block Kit blocks/buttons, SLACK_FETCH_HISTORY, SLACK_LIST_CHANNELS, …) run through Dench's in-house Slack app install — any channel in the connected workspace — and are always preferred over any third-party Slack connection. Slack writes (send, react, upload, edit, delete) are shared-only: they act as the shared Dench bot, so a personal CLI session or chat is refused with `slack_shared_only`; ask Dench in Slack, or create a shared Slack automation there.

- API: `POST /tools/run`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/tools/run" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "tool_slug": "SLACK_LIST_CHANNELS",
    "arguments": {
      "limit": 10
    }
  }'
```

### dench tool disconnect

Disconnect an external tool account.

- API: `DELETE /tools/connections/{connectionId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/tools/connections/{connectionId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench tool labels

List human names given to connected accounts.

- API: `GET /tools/labels`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/tools/labels" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench tool label

Name a connected account, or clear its name with an empty string.

- API: `PUT /tools/connections/{connectionId}/label`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/tools/connections/{connectionId}/label" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "displayName": "string"
  }'
```

## Lists

### dench lists

List saved searches (find-result lists) in the workspace, newest first.

- API: `GET /lists`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench lists list`

```bash
curl -sS "$DENCH_API_BASE/lists" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench lists rows

Read saved rows with current enrichment results and original indices; cursor-paged, without repeating a search.

- API: `GET /lists/{artifactId}/rows`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/lists/{artifactId}/rows" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench lists enrich

Buy contact details for 1–100 saved profiles and save them to the list. Skips fields already found, looked up empty, or in flight. Requires a signed-in member or their personal agent.

- API: `POST /lists/{artifactId}/enrich`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/lists/{artifactId}/enrich" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "rows": [],
    "fields": []
  }'
```

### dench artifacts import

Explicitly import selected saved profiles, optionally filtered by enrichment, with a configured Lead status. Reuses CRM records; never sends outreach or triggers conversion.

- API: `POST /lists/{artifactId}/import`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/lists/{artifactId}/import" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "to": "lead"
  }'
```

### dench lists show

Get one saved search / list by artifact id.

- API: `GET /lists/{artifactId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/lists/{artifactId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench lists save

Save find results as a named list (rows + filters become a workspace artifact).

- API: `POST /lists`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench leads find --save-as "Name"`

```bash
curl -sS -X POST "$DENCH_API_BASE/lists" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "createdFrom": "find_people",
    "title": "string"
  }'
```

### dench lists update

Update a saved list in place (title, filters, and/or replacement rows).

- API: `PATCH /lists/{artifactId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/lists/{artifactId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench lists rename

Rename a saved search / list.

- API: `POST /lists/{artifactId}/rename`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/lists/{artifactId}/rename" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench lists delete

Delete a saved search / list, its exported CSV/JSONL files, and any linked watch.

- API: `DELETE /lists/{artifactId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/lists/{artifactId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench lists reviews

Read durable enrichment activity (legacy review metadata remains readable). Use lists rows for current saved profiles and contacts.

- API: `GET /lists/{artifactId}/reviews`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/lists/{artifactId}/reviews" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench lists assess

Suggest ICP fit for one profile. Never changes a human review decision.

- API: `POST /lists/{artifactId}/assess`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/lists/{artifactId}/assess" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "row": {},
    "suggestion": {}
  }'
```

## Local

### dench sessions

List local CLI sessions.

- API: `GET /local/sessions`
- Auth: No bearer token required.

```bash
# dench sessions
# Local-only: CLI sessions live in the caller's ~/.dench/config.json.
```

### dench use <session-key-or-workspace-slug>

Select a local CLI session.

- API: `POST /local/sessions/use`
- Auth: No bearer token required.

```bash
# dench use <session-key-or-workspace-slug>
# Local-only: The server cannot mutate the caller's local CLI config.
```

### dench logout

Sign out: end CLI sessions on the server and remove them locally.

- API: `POST /local/logout`
- Auth: No bearer token required.

```bash
# dench logout
# Local-only: The server cannot mutate the caller's local CLI config.
```

### dench backend show|set|clear

Configure the CLI backend target.

- API: `POST /local/backend`
- Auth: No bearer token required.

```bash
# dench backend show|set|clear
# Local-only: Backend selection is local CLI state.
```

### dench crm import

Import a local CSV into a CRM object.

- API: `POST /local/crm/import`
- Auth: No bearer token required.

```bash
# dench crm import
# Local-only: Reads a CSV from the caller's local filesystem. Over the API, parse the CSV client-side and POST rows to /crm/objects/{objectName}/entries/batch.
```

### dench crm export

Export a CRM object to a local CSV.

- API: `POST /local/crm/export`
- Auth: No bearer token required.

```bash
# dench crm export
# Local-only: Writes a CSV to the caller's local filesystem. Over the API, call POST /crm/query and format CSV client-side.
```

### dench meetings import

Import calls from a local CSV/JSONL: meeting fields plus transcript, action items and attendees per row.

- API: `POST /local/meetings/import`
- Auth: No bearer token required.

```bash
# dench meetings import
# Local-only: Reads a CSV/JSONL from the caller's local filesystem. Over the API: POST /crm/objects/meeting/entries/batch with seedKey per row, then POST /meetings/{meetingEntryId}/transcript, POST …/action-items and PUT …/participants for each created meeting.
```

### dench fs

Run the local file sync daemon.

- API: `POST /local/fs`
- Auth: No bearer token required.

```bash
# dench fs
# Local-only: The fs daemon watches the caller's local /workspace mount.
```

## Meetings

### dench meetings list

List meetings, newest first, with status and participants.

- API: `GET /meetings`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/meetings" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench meetings transcript get

Read a meeting's transcript, in order, one page at a time.

- API: `GET /meetings/{meetingEntryId}/transcript`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/meetings/{meetingEntryId}/transcript" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench meetings transcript set

Append up to 500 transcript segments to a meeting (speakers with an email link to existing people).

- API: `POST /meetings/{meetingEntryId}/transcript`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/meetings/{meetingEntryId}/transcript" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "segments": []
  }'
```

### dench meetings transcript clear

Delete a batch of a meeting's transcript segments; repeat until `done` before re-appending.

- API: `DELETE /meetings/{meetingEntryId}/transcript`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/meetings/{meetingEntryId}/transcript" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench meetings action-items list

List a meeting's action items.

- API: `GET /meetings/{meetingEntryId}/action-items`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/meetings/{meetingEntryId}/action-items" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench meetings action-items set

Add action items to a meeting; `replace: true` swaps the whole list.

- API: `POST /meetings/{meetingEntryId}/action-items`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/meetings/{meetingEntryId}/action-items" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "items": []
  }'
```

### dench meetings action-items done

Tick or untick one action item.

- API: `PATCH /meetings/action-items/{itemId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/meetings/action-items/{itemId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "done": true
  }'
```

### dench meetings action-items delete

Delete one action item.

- API: `DELETE /meetings/action-items/{itemId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/meetings/action-items/{itemId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench meetings participants list

Who was in the meeting, merged with the linked calendar invite.

- API: `GET /meetings/{meetingEntryId}/participants`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/meetings/{meetingEntryId}/participants" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench meetings participants set

Record attendees by name/email; known members and existing people are linked, nobody is created.

- API: `PUT /meetings/{meetingEntryId}/participants`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/meetings/{meetingEntryId}/participants" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "participants": []
  }'
```

### dench meetings share

Whether a meeting is shared with the whole workspace, and whether you may change that.

- API: `GET /meetings/{meetingEntryId}/sharing`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/meetings/{meetingEntryId}/sharing" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench meetings share --workspace

Share one meeting with the workspace, or take it back to owner + invitees.

- API: `PUT /meetings/{meetingEntryId}/sharing`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/meetings/{meetingEntryId}/sharing" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "shared": true
  }'
```

## Members

### dench members presence

Live presence (online / away / offline) for workspace members.

- API: `GET /members/presence`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/members/presence" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench members get

A member's profile: name, email, tagline, role, timezone, presence, open task count.

- API: `GET /members/{userId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/members/{userId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench members activity

A member's recent comments and record changes across the CRM, newest first.

- API: `GET /members/{userId}/activity`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/members/{userId}/activity" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench members tasks

Open tasks assigned to a member (plus ones completed today).

- API: `GET /members/{userId}/tasks`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/members/{userId}/tasks" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench members me

Your own member profile.

- API: `GET /me/profile`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/me/profile" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench members me --name … --tagline … --timezone …

Update your name, tagline, avatar URL, or timezone.

- API: `PATCH /me/profile`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/me/profile" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "tagline": "Head of Ops",
    "timezone": "America/New_York"
  }'
```

### dench members me --avatar <file>

Get a one-time URL to POST an avatar image to; then PUT /me/avatar with the returned storageId.

- API: `POST /me/avatar/upload-url`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/me/avatar/upload-url" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench members me --avatar <file>

Set your avatar from an uploaded storageId.

- API: `PUT /me/avatar`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/me/avatar" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "storageId": "kg2abc123def456"
  }'
```

### dench members me --clear-avatar

Remove your avatar.

- API: `DELETE /me/avatar`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/me/avatar" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

## Memory

### dench memory search

Search durable workspace memory.

- API: `GET /memory/search`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/memory/search?query=string" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench memory save

Save a durable workspace memory fact.

- API: `POST /memory`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/memory" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "key": "deployment-policy",
    "kind": "decision",
    "text": "Never deploy without human approval.",
    "tags": [
      "deployment",
      "policy"
    ]
  }'
```

## Meta

### dench help

List all CLI/API operations and parity classifications.

- API: `GET /commands`
- Auth: No bearer token required.

```bash
curl -sS "$DENCH_API_BASE/commands"
```

## Notifications

### dench notifications list

List your notifications (inbox, unread, archived, or all).

- API: `GET /notifications`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/notifications" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench notifications count

How many unread notifications you have.

- API: `GET /notifications/unread-count`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/notifications/unread-count" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench notifications read

Mark a notification read (or unread).

- API: `PATCH /notifications/{notificationId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/notifications/{notificationId}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "read": true
  }'
```

### dench notifications read-all

Mark every inbox notification read.

- API: `POST /notifications/read-all`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/notifications/read-all" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench notifications archive

Archive a notification.

- API: `POST /notifications/{notificationId}/archive`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/notifications/{notificationId}/archive" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench notifications prefs

Read your notification preferences.

- API: `GET /notifications/preferences`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/notifications/preferences" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench notifications prefs --set

Update your notification preferences.

- API: `PATCH /notifications/preferences`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/notifications/preferences" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "emailEnabled": true,
    "perKind": {
      "entry_activity": {
        "email": false
      }
    }
  }'
```

## Routines

### dench cron list

List routines.

- API: `GET /routines`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.
- Aliases: `dench routine list`, `dench routines list`

```bash
curl -sS "$DENCH_API_BASE/routines" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench cron history

List routine run history.

- API: `GET /routines/history`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/routines/history" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench cron get

Get a routine.

- API: `GET /routines/{jobId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/routines/{jobId}" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench cron create

Create a routine.

- API: `POST /routines`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/routines" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "Daily digest",
    "prompt": "Summarize open CRM tasks.",
    "schedule": {
      "kind": "every",
      "everyMs": 86400000
    }
  }'
```

### dench cron update

Update a routine.

- API: `PATCH /routines/{jobId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/routines/{jobId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench cron delete

Delete a routine.

- API: `DELETE /routines/{jobId}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/routines/{jobId}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench cron enable

Enable a routine.

- API: `POST /routines/{jobId}/enable`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/routines/{jobId}/enable" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench cron disable

Disable a routine.

- API: `POST /routines/{jobId}/disable`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/routines/{jobId}/disable" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench cron run

Run a routine now.

- API: `POST /routines/{jobId}/run`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X POST "$DENCH_API_BASE/routines/{jobId}/run" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench cron runs

List runs for a routine.

- API: `GET /routines/{jobId}/runs`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/routines/{jobId}/runs" -H "Authorization: Bearer $DENCH_API_KEY"
```

## Secrets

### dench secrets list

List workspace-shared credential names, kinds and versions; never values.

- API: `GET /secrets`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/secrets" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench secrets set

Encrypt a workspace credential. Use CLI stdin or the secure chat form; return metadata only. Do not put values in chat, manifests or scripts.

- API: `PUT /secrets/{name}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/secrets/{name}" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "kind": "env",
    "value": "string"
  }'
```

### dench secrets delete

Revoke a workspace credential for future resolution, optionally checking its version.

- API: `DELETE /secrets/{name}`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X DELETE "$DENCH_API_BASE/secrets/{name}" \
 -H "Authorization: Bearer $DENCH_API_KEY"
```

## Settings

### dench settings sync

Read the workspace's Sync switches (accounts from email, contacts from LinkedIn, Slack Connect, calendar, dossier, tasks from email, lead auto-qualify, summaries and Brief). All on by default.

- API: `GET /settings/sync`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/settings/sync" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench settings sync set

Flip Sync switches (admin). Partial patch: only the keys sent change. Off stops new work; nothing already created is removed.

- API: `PATCH /settings/sync`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PATCH "$DENCH_API_BASE/settings/sync" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "linkedinContacts": false
  }'
```

## Workspace

### dench context --sections

Read selected scoped workspace documents and a compact context index without writes.

- API: `GET /context/sections`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/context/sections" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench context

Return the current Dench workspace context for the bearer.

- API: `GET /context`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/context" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench context --instructions

Return the current workspace's standing instructions for external agents.

- API: `GET /context/instructions`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/context/instructions" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench status

Return workspace and agent status.

- API: `GET /status`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/status" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench agents

List agents visible in the workspace status payload.

- API: `GET /agents`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/agents" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench artifacts

List artifacts for the authenticated workspace.

- API: `GET /artifacts`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/artifacts" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench suggested-work

List draft suggested-work artifacts.

- API: `GET /suggested-work`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS "$DENCH_API_BASE/suggested-work" -H "Authorization: Bearer $DENCH_API_KEY"
```

### dench context set rules

Update standing workspace rules; credentials belong in secrets and runnable setup in environments.

- API: `PUT /context/rules`
- Auth: Requires `Authorization: Bearer $DENCH_API_KEY` or an approved `dch_agent_*` session token.

```bash
curl -sS -X PUT "$DENCH_API_BASE/context/rules" \
 -H "Authorization: Bearer $DENCH_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "content": "string"
  }'
```
