Customer.io CLI reference
UpdatedWhile 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:
- Find
skillsto learn more about how to do things in Customer.io - Find the right
schemafor the endpoint you want to call - Use
apito 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
| Flag | Environment variable | Description |
|---|---|---|
--token | CIO_TOKEN | Service account token override |
-X, --method | HTTP method override | |
--json | JSON request body (or @filename) | |
--params | Path and query parameters as JSON | |
--jq | jq expression filter | |
--dry-run | Preview request without executing | |
--page | Page number | |
--limit | Page size | |
--page-all | Auto-paginate, output NDJSON | |
--timeout | CIO_TIMEOUT | Request timeout (default: 30s) |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Validation or input error |
| 3 | Authentication error |
| 4 | Authorization error |
| 5 | API error (4xx/5xx) |
