Command-line interface
@centerfy/cli puts a `centerfy` command on your PATH that covers every endpoint, as an interactive shell or one-shot commands for scripts.
Every endpoint page has a CLI tab showing the exact command, and CLI commands lists all of them in one place. This page covers setup.
Install
npm install -g @centerfy/cli
# or run on demand
npx @centerfy/cli
Node.js 18 or newer. The SDK is installed as a dependency.
Authenticate
export CENTERFY_API_KEY="cfy_…" # sub-account key
export CENTERFY_AGENCY_API_KEY="cfy_…" # optional: agency key, used with --agency
export CENTERFY_BASE_URL="https://api.centerfy.ai" # optional override
If CENTERFY_API_KEY isn’t set, the interactive shell prompts for it (input hidden). One-shot commands require the variable.
Commands
Commands follow centerfy <resource> <command> [ids…] ['<json params>']:
centerfy contacts list '{"limit": 5}'
centerfy contacts get 3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f
centerfy pipelines create-stage <pipelineId> '{"name": "Qualified"}'
centerfy --agency subAccounts list
- resource: a namespace such as
contacts,pipelines,knowledgeBases(case-insensitive). - command: the action. Multi-word SDK methods are kebab-cased:
createStage→create-stage. - ids: path ids, as plain arguments, in the order shown on the endpoint page.
- json params: the body or query as one JSON object.
Run centerfy with no arguments for the interactive shell, then help <resource> to list a resource’s commands, or resources to list every namespace.
Special commands
| Command | Behaviour |
|---|---|
voices preview '{"name":"…"}' | Saves the returned MP3 to the current directory. |
knowledgeBases add-file <kbId> '{"path":"./faq.pdf"}' | Uploads a local file (.pdf .docx .xlsx .txt .csv). |
phoneProvisioning purchase '{"phone_number":"+1…"}' | Generates the required Idempotency-Key for you. |
Agency mode
centerfy --agency … (or setting only CENTERFY_AGENCY_API_KEY) switches to the agency key and the agency namespaces: subAccounts, subAccountUsers, subAccountApiKeys, wallet.