A small Go CLI for working with the Pingen API from your terminal. It supports OAuth client-credentials auth, listing organisations, and managing letters.
- Go 1.20+
- A Pingen account and OAuth client credentials
go build -o ./bin/pingen-cli ./cmd/pingen-cliRun without building:
go run ./cmd/pingen-cli --helpBy default the CLI targets staging. To use production credentials, pass
--env production.
./bin/pingen-cli \
--env production \
--client-id YOUR_CLIENT_ID \
--client-secret-file /path/to/secret \
org listFetch a token and save it (plus credentials) in the local config:
./bin/pingen-cli \
--env production \
--client-id YOUR_CLIENT_ID \
--client-secret-file /path/to/secret \
auth token --save --save-credentialsThe CLI uses the OAuth client_credentials grant. The default scope is:
letter batch webhook organisation_read
Override it with --scope on auth token if needed.
Config file location:
$XDG_CONFIG_HOME/pingen/config.json, or~/.config/pingen/config.json
You can set values via the CLI:
./bin/pingen-cli config set env production
./bin/pingen-cli config set organisation_id YOUR_ORG_UUIDEnvironment variable overrides:
PINGEN_ENVPINGEN_API_BASEPINGEN_IDENTITY_BASEPINGEN_ORG_IDPINGEN_ACCESS_TOKENPINGEN_CLIENT_IDPINGEN_CLIENT_SECRET
List organisations:
./bin/pingen-cli org listList letters for a specific organisation:
./bin/pingen-cli --org YOUR_ORG_UUID letters listCreate a letter (upload PDF, optional auto-send):
./bin/pingen-cli --org YOUR_ORG_UUID letters create \
--file ./letter.pdf \
--address-position left \
--auto-sendSend a letter (requires delivery options):
./bin/pingen-cli --org YOUR_ORG_UUID letters send LETTER_UUID \
--delivery-product fast \
--print-mode simplex \
--print-spectrum colorUse --json for raw JSON output or --plain for human-friendly output. The
CLI defaults to plain text.
- Avoid passing secrets directly on the command line (shell history). Prefer
--client-secret-fileor environment variables. - Rotate credentials if they were exposed.
- Staging and production are separate environments with separate credentials.
Run tests (none currently, but keep this wired in):
go test ./...