CLI

Browse and manage your Dextel account from the terminal. Human-readable tables when you're exploring, clean JSON when you're scripting.

npm install -g dextelai-cli

dextel login
dextel contacts list

Requires Node 18+.

Authentication

The CLI resolves your key from three places, highest precedence first: the --api-key flag, the DEXTEL_API_KEY environment variable, then ~/.dextel/config.json.

dextel login              # prompts, stores with mode 0600
dextel whoami             # which key is in use, and its scope
dextel logout             # remove the stored key

The stored key is protected

dextel login writes the config file readable only by you (mode 0600). If it ever becomes group- or world-readable, the CLI warns on every run — a key sitting in a shared dotfile is a credential leak.

In CI, prefer the environment variable:

export DEXTEL_API_KEY=sk_live_...
dextel contacts list --json

Commands

dextel <resource> <action> [id] [flags]

Resourcesagents, contacts, calendars, appointments, knowledge-bases, custom-tools, phone-numbers, number-pools, calls, workflows, agency.

Actionslist, get, create, update, delete. Read-only resources reject writes locally, without a round trip.

Examples

# Browse
dextel contacts list --limit 5
dextel agents get ag_123

# Every page, as JSON
dextel contacts list --all --json > contacts.json

# Create from a flag, or from a file ("-" reads stdin)
dextel contacts create --data '{"first_name":"Ada","email":"ada@example.com"}'
cat agent.json | dextel agents create --file -

# Update and delete
dextel contacts update c_123 --data '{"phone":"+15551234567"}'
dextel contacts delete c_123 --yes

# Agency-scoped (needs an agency key)
dextel agency get
dextel agency sub-accounts --all

Piping and scripting

Data goes to stdout; status, prompts and errors go to stderr. So piping is always safe — no progress line can corrupt your JSON.

dextel agents list --json | jq -r '.data[].name'

--json is implied whenever stdout is not a terminal, so you rarely need it in a pipeline. Force the human table with --table.

Exit codes

0 success · 1 usage or API error · 2 not authenticated · 3 not found · 4 rate limited · 5 could not reach the API.

sync.sh
if ! dextel agents get "$ID" --json > agent.json; then
  case $? in
    3) echo "gone, skipping" ;;
    4) echo "rate limited, backing off"; sleep 30 ;;
    *) exit 1 ;;
  esac
fi

Flags

--json raw JSON · --table force the table · --all follow pagination to the end · --limit <n> page size (1–100) · --starting-after <id> cursor · --data '<json>' request body · --file <path> body from a file (- for stdin) · --yes skip the delete confirmation · --api-key <key> · --base-url <url> · -h · -v.

Set NO_COLOR=1 to disable colour; it is also disabled automatically when output is piped.

Deletes in scripts

From a terminal, delete asks for confirmation unless you pass --yes. In a non-interactive shell there is no prompt and no confirmation is required — be deliberate about what you automate.