Scripting and configuration
JSON output, stable exit codes, named configurations, and environment overrides.
Output
Every command takes --format json (and yaml), and output auto-switches to JSON when stdout is not a TTY, so pipes and agents always get machine-readable output without asking. --no-input never prompts.
TOKEN=$(privasys auth print-access-token) # pipe a bearer into curl
privasys apps list --format json | jq '.[].name'Exit codes
Exit codes are stable so scripts and agents can branch on the failure class:
| Code | Meaning |
|---|---|
0 | success |
1 | generic error |
3 | not authenticated |
4 | not authorized |
5 | not found |
Choosing an environment
The CLI talks to production by default (https://api.developer.privasys.org). Two flags switch that per command:
| Flag | Environment |
|---|---|
| (none) | Production (default) |
--test | The Privasys test / dev environment |
--endpoint <url> | A custom environment (self-hosted or staging) |
privasys apps list # production
privasys apps list --test # test/dev environment
privasys apps list --endpoint https://api.example.com # custom--endpoint overrides --test. Authentication always uses the production issuer (privasys.id), so your identity is the same in every environment.
Each platform has its own audience, and the CLI asks the issuer for tokens addressed to the platform it talks to:
| Platform | Audience | Roles in the token |
|---|---|---|
| Production | privasys-platform | privasys-platform:app:<id>:owner, privasys-platform:admin, ... |
Test / dev (--test) | privasys-platform-test | privasys-platform-test:app:<id>:owner, privasys-platform-test:admin, ... |
The CLI picks the audience from the endpoint: the test endpoint gets the test audience, every other endpoint gets the production one. Your test roles and production roles therefore stay apart, and a test token only opens the test platform. The CLI keeps a cached token for each audience, so moving between --test and production needs no new sign-in. privasys auth whoami --test shows the test token's audience and roles.
The vaults follow the same split. Each vault constellation accepts one audience, fixed when its vaults first boot: production vaults accept privasys-platform, and the test platform's vaults accept privasys-platform-test. The platform reports each constellation's audience, and the CLI asks for a token of that audience for every vault call, so each vault gets a token for the audience it accepts, and a test token never opens a production vault.
A custom environment with its own audience names it in the configuration (audience) or in PRIVASYS_AUDIENCE.
Configuration
Configuration lives at ~/.privasys/config.yaml (named configurations). Global flags: --endpoint, --test, --issuer, --account, --format, --no-input, --quiet. To make an environment sticky (instead of passing a flag each time), set it in the config:
privasys config set endpoint https://api.developer.privasys.org
privasys config set account <account-id>
privasys config list| Key | Meaning |
|---|---|
endpoint | platform API base URL |
issuer | identity provider issuer URL |
account | account id to act on |
audience | platform audience to request tokens for. Leave it unset to follow the endpoint; set it only for a custom environment with its own audience. privasys config get audience shows the one for the configured endpoint. |
format | output format: table, json or yaml |
--account (or the account key, or PRIVASYS_ACCOUNT) makes every command act in that account, which must be one you belong to. Before the first change it makes there, the CLI names the account on stderr (Acting in account "Acme" (…)), and an MCP tool that changes something says in its result which account it acted in. Without it, commands act in your personal account. Before CLI v0.59.0 the setting was ignored and every command acted in your personal account, so check where anything you created with an older CLI landed (update the CLI).
Environment overrides
| Variable | Overrides |
|---|---|
PRIVASYS_ENDPOINT | platform API base URL |
PRIVASYS_ISSUER | identity provider issuer URL |
PRIVASYS_ACCOUNT | account id to act on |
PRIVASYS_AUDIENCE | platform audience to request tokens for |
PRIVASYS_FORMAT | output format |
PRIVASYS_SERVICE_KEY | service-account key (unattended auth) |
PRIVASYS_ACCESS_TOKEN | a raw bearer, bypassing stored sessions |
PRIVASYS_NO_INPUT | never prompt |
AI agents
The CLI is agent-first. An MCP server with the full command surface, an agent skill, one-command wiring for Claude Code, Codex, Cursor, VS Code and Gemini, and a Claude Code plugin.
Overview
The identity and authentication layer for Privasys, covering the wallet, identity provider, browser SDK, and sealed-session transport for non-RA-TLS-capable clients.