Skip to main content

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. Download charley_policy-*.whl from Settings → API Keys → Download SDK in the Charley dashboard, then:
Verify:

Set Your API Key

Or create a .env file in your working directory — the CLI loads it automatically:

Your First Policy File

Create policies/global.yaml:

Preview Changes

Before applying anything, run a plan to see what would change:
Sample output:

Apply

You’ll see a diff and be prompted to confirm. Skip the prompt with -y:

Download Existing Policies

If your org already has policies configured in the dashboard, pull them down as a starting point:
Edit the output, then run plan to see what your edits would change.

Add Group Policies

Create groups.yaml alongside your policies:
Add a group-scoped policy:
Apply both together:

Troubleshooting

Add --verbose to any command to see the base URL and key prefix being used:
For the dev environment:
Common errors:

Next Steps