Prerequisites
- Python 3.10 or later
- A Charley account with Org Admin role
- An API key (see API Keys)
Install
The SDK is distributed as a Python wheel. Downloadcharley_policy-*.whl from Settings → API Keys → Download SDK in the Charley dashboard, then:
Set Your API Key
.env file in your working directory — the CLI loads it automatically:
Your First Policy File
Createpolicies/global.yaml:
Preview Changes
Before applying anything, run a plan to see what would change:Apply
-y:
Download Existing Policies
If your org already has policies configured in the dashboard, pull them down as a starting point:plan to see what your edits would change.
Add Group Policies
Creategroups.yaml alongside your policies:
Recommended File Layout
Troubleshooting
Add--verbose to any command to see the base URL and key prefix being used:
| Error | Cause |
|---|---|
401 Unauthorized | API key is missing, invalid, or expired |
403 Forbidden | Using a read_only key for a write operation |
Connection refused | Wrong --base-url or --env |
Failed to load policies | YAML parse error — check indentation |
Next Steps
- API Keys — key types, rotation, CI secrets
- Policy Reference — all fields for each policy type
- Groups — manage device groups via CLI and YAML
- CLI Reference — all commands and flags
- Examples — copy-paste templates
- End-to-End Testing Guide — verify your setup against a real device