Customer.io CLI reference

Updated

While the CLI is optimized for AI agents, you can also use it directly in your terminal. Understanding how the CLI works can also help you structure prompts (or skills) to do the right things in Customer.io.

In general, LLMs will use the CLI in the following order:

  1. Find skills to learn more about how to do things in Customer.io
  2. Find the right schema for the endpoint you want to call
  3. Use api to make the API call

Skills

The CLI has a set of skills that can be used to learn more about how to do things in Customer.io. You can list the available skills with cio skills list.

# List all skills
cio skills list

# Read a specific skill
cio skills read <skill_name>

Discover endpoints

Use cio schema to explore what’s available without leaving the terminal:

# List all resources
cio schema

# List endpoints for a resource
cio schema campaigns

# Get full details for a specific endpoint
cio schema campaigns.list

Make API calls

Use cio api <path> for any endpoint. You’ll resolve path placeholders like {environment_id} from --params:

# List campaigns in a workspace
cio api /v1/environments/{environment_id}/campaigns \
  --params '{"environment_id": "123"}'

# Get a specific campaign
cio api /v1/environments/{environment_id}/campaigns/{campaign_id} \
  --params '{"environment_id": "123", "campaign_id": "456"}'

The CLI defaults to GET requests. Pass --json to send a POST, or override with -X:

# Create a campaign (POST inferred from --json)
cio api /v1/environments/{environment_id}/campaigns \
  --params '{"environment_id": "123"}' \
  --json '{"campaign": {"name": "Welcome Flow", "type": "none"}}'

# Delete a campaign
cio api /v1/environments/{environment_id}/campaigns/{campaign_id} \
  --params '{"environment_id": "123", "campaign_id": "456"}' -X DELETE

Filter and format output

Use --jq to filter responses with jq expressions:

# Only active campaigns
cio api /v1/environments/{environment_id}/campaigns \
  --params '{"environment_id": "123"}' \
  --jq '.campaigns[] | select(.state == "active") | {id, name}'

Paginate results

# Manual pagination
cio api /v1/environments/{environment_id}/campaigns \
  --params '{"environment_id": "123"}' --page 2 --limit 50

# Auto-paginate (outputs NDJSON — one JSON object per line)
cio api /v1/environments/{environment_id}/campaigns \
  --params '{"environment_id": "123"}' --page-all

Dry run: make sure requests are valid

Use --dry-run to validate a request without executing it:

cio api /v1/environments/{environment_id}/campaigns \
  --params '{"environment_id": "123"}' \
  --json '{"campaign": {"name": "Welcome Flow", "type": "none"}}' --dry-run

CLI reference

FlagEnvironment variableDescription
--tokenCIO_TOKENService account token override
-X, --methodHTTP method override
--jsonJSON request body (or @filename)
--paramsPath and query parameters as JSON
--jqjq expression filter
--dry-runPreview request without executing
--pagePage number
--limitPage size
--page-allAuto-paginate, output NDJSON
--timeoutCIO_TIMEOUTRequest timeout (default: 30s)

Exit codes

CodeMeaning
0Success
1General error
2Validation or input error
3Authentication error
4Authorization error
5API error (4xx/5xx)
Copied to clipboard!
  Contents