CLI: Install, Authenticate, and Start
Use the ContentStudio CLI
The ContentStudio CLI provides terminal-first access to ContentStudio workflows. Use it for local automation, scripts, CI jobs, and agent-assisted command execution.
Install
Install the CLI globally with npm or pnpm:
npm install -g contentstudio-cli
# or
pnpm install -g contentstudio-cli
Confirm that the command is available:
contentstudio --version
contentstudio --help
Authenticate
Create an API key in ContentStudio → Settings → API Keys, then authenticate the CLI:
contentstudio auth:login --api-key cs_your_api_key_here
The CLI stores the local configuration and verifies the key. Check status at any time:
contentstudio auth:status
contentstudio --json auth:whoami
Do not commit keys to scripts or configuration files. For CI and services, use a secure environment variable instead of interactive local login.
Select a workspace
List available workspaces:
contentstudio --json workspaces:list
Set the workspace used by subsequent commands:
contentstudio workspaces:use <workspace_id>
First safe workflow
Start with read-only discovery:
contentstudio --json workspaces:current
contentstudio --json accounts:list
Once you confirm the active workspace and accounts, use the CLI’s post commands to create a draft rather than publishing directly.
Use JSON output in scripts
Use --json when a script or agent needs structured output. Treat returned IDs as data, not display text, and validate command outcomes before running a dependent write action.
What the CLI supports
The current CLI documentation covers workspace discovery, connected accounts, social-account connection flows, post creation and management, comments/internal notes, media-library operations, automation workflows, error handling, and API endpoint mapping.
Troubleshooting
Authentication fails: verify that the API key is current and begins with the expected
cs_prefix.No workspace is active: list workspaces, then run
contentstudio workspaces:use <workspace_id>.A service cannot find the key: configure
CONTENTSTUDIO_API_KEYin the service environment and restart the service; a shell export alone does not update an already-running service.
Before automating a workflow, run
contentstudio --helpand the relevant command’s--helpoutput in your installed CLI version. Commands and options can evolve between releases.
Was this article helpful?

