CLI
The khotan CLI is the first-party command-line interface for the Khotan API.
It is a thin adapter over /api/v1, driven by a shared capability catalog.
Adding a command updates khotan help and these pages together.
Start here
npx @khotan/cli --help
Then authenticate once. Never commit a key.
khotan auth set-key --api-url https://app.example.com --api-key khk_live_...
khotan whoami
Pin the repo to its organization so a stray machine-global profile cannot leak another customer's data:
# .env.khotan.local (git-ignored)
KHOTAN_API_URL='https://<workspace>.khotan.com'
KHOTAN_API_KEY='<org-scoped key>'
KHOTAN_ORG_ID='<org id>'
If apps list returns unfamiliar product names, stop. See errors.
What the CLI covers
- Install — npx, global binary, running from source
- Auth — profiles, environment variables,
.env.khotan.local,--assert-org - Workspace — checkout freshness, org monorepo layout, and
khotan status - Output —
--json, stdout vs stderr - Safety — read, write, destructive, secret
- Errors —
org_mismatch,confirmation_required, and the rest - Commands — catalog-generated reference
- Agents — how to read these docs from Claude Code, Cursor, or any coding agent
khotan help and khotan <command> --help are authoritative. If a docs page and the CLI disagree, trust the CLI.