- JSON you can pipe
- The response goes to stdout as JSON, ready for
jq. Errors go to stderr as one JSON object. Add --output table to read a list yourself. An answer over 200 KB goes to a file and the CLI prints its path.
- A dashboard in your terminal
purchasely dashboard summary --app app_xxx --output table shows the MRR, active subscriptions, paywall viewers and conversions of an app, with a sparkline per metric. Without --output table, the same numbers come as JSON.
- Find a command in plain words
purchasely search "start an a/b test" returns the best matching commands. --help on a command shows its scope, path, options and an example.
- The full command reference
- Every command, option and example is on the CLI reference page, and in
man purchasely. Agents read it as JSON with purchasely reference --format json.
- Raw API calls
purchasely api GET /applications calls any Management endpoint with your key, under the same rules: the limiter, --dry-run, --env on a write and the confirmation.
- Shell completion
source <(purchasely completion zsh) in your ~/.zshrc completes the commands and the options. Bash and fish work too.
- A break between two deploys
purchasely games opens six terminal games: 2048, invaders, minesweeper, pong, snake and tetris. They use no key and send no request.
- A dry run on every write
--dry-run prints the method, URL, headers and body, and sends nothing. The key shows as <redacted>. It works without a key.
- Explicit environment
--env prod or --env staging. Reads use prod by default. A write without --env is refused, also with --dry-run.
- Confirmation for destructive changes
- When the API asks for a confirmation, for example to delete a placement in use, the CLI shows the impact. In a terminal, it asks you first.
--yes confirms. In a script, it stops with exit code 8 and gives a token that you can send back with --confirm-token within 5 minutes.
- Rate limits handled for you
- The API allows 60 requests and 10 writes per minute per key. A built-in limiter, shared by all CLI processes on your machine, stays under it. On a 429, the CLI waits for the time the server gives and slows down.
- API key handling
- The key is never printed. Status shows its last 4 characters, the dry run hides it, and the usage log on your machine keeps no key and no query value.
- What the CLI sends
-
Management commands go to api.purchasely.io, or api-staging.purchasely.io with --env staging, with your key. The User-Agent header carries the CLI version and your --reason value.
Once a day, the CLI asks cli.purchasely.io for the latest version and downloads it from there. purchasely ai downloads the public Purchasely AI plugin from GitHub.
- Exit codes for scripts
-
Exit codes
| 0 | Success |
| 1 | Generic error, network error, server error |
| 2 | Usage error: bad flag or bad JSON in --data |
| 3 | No key, or key not accepted |
| 4 | Forbidden: missing scope or feature |
| 5 | Validation failed |
| 6 | Not found |
| 7 | Rate limited: stop and wait |
| 8 | Confirmation required and not given |
| 10 | Write refused: --env missing |