Privacy CLI
The Privacy CLI helps you create and manage your Privacy Virtual Cards directly from the terminal.
You must be subscribed to a paid Privacy Plan in order to access the Privacy API and CLI. You can upgrade your account at app.privacy.com/subscriptions .
Global flags
These flags work with any command.
| Flag | Description |
|---|---|
--json | Force JSON output |
--wide | Show all fields in table mode |
--version | Print the installed CLI version |
--help | Show help for a command |
Install the CLI
npm install -g @privacy-com/privacy-cli
privacyVerify the installation:
privacy --versionOn first run, the CLI will prompt for your API key and save it to ~/.privacy/config for future use.
Authentication
The CLI resolves your API key in this order:
PRIVACY_API_KEYenvironment variable~/.privacy/configfile (JSON withapi_keyfield)- Interactive prompt (saves to
~/.privacy/configwith0600permissions)
Using the CLI
Create Card
privacy cards create --type <type> [options]| Option | Required | Description |
|---|---|---|
--type <type> | Yes | Card type. One of: SINGLE_USE, MERCHANT_LOCKED |
--memo <memo> | No | A label for the card (max 200 characters) |
--spend-limit <dollars> | No | Spend limit in whole dollars (e.g. 25 or $25) |
--spend-limit-duration <duration> | No | How the spend limit resets. One of: TRANSACTION, MONTHLY, ANNUALLY, FOREVER |
Card types:
| Type | Description |
|---|---|
SINGLE_USE | Closes automatically after the first transaction |
MERCHANT_LOCKED | Locked to the first merchant it's used with |
# Create a single-use card with a $10 limit
privacy cards create --type SINGLE_USE --memo "Trial signup" --spend-limit 10 --spend-limit-duration TRANSACTIONList Cards
Returns a paginated list of your virtual cards.
privacy cards list [options]| Option | Description |
|---|---|
--page <number> | Page number to retrieve |
--page-size <number> | Number of results per page (default: 20) |
Default fields: token, last_four, type, state, memo, spend_limit
Use --wide to include spend_limit_duration, exp_month, exp_year, and created.
Examples
# List the first page of cards
privacy cards list
# Fetch page 3 with 50 results per page
privacy cards list --page 3 --page-size 50
# Output as JSON and filter with jq
privacy cards list --json | jq '[.[] | select(.state == "OPEN")]'Get Card Details
Fetches details for a specific card by its token.
privacy cards get <token>Update Card Details
Updates the card name, spend limit, or card state on an existing card. Only the fields you pass will be changed.
privacy cards update <token> [options]| Option | Description |
|---|---|
--memo <memo> | Update the card name (max 200 characters) |
--spend-limit <dollars> | Update the spend limit in whole dollars, ie. 100 |
--spend-limit-duration <duration> | One of: TRANSACTION, MONTHLY, ANNUALLY, FOREVER |
--state <state> | Set card state: OPEN, PAUSED, CLOSED |
Examples
# Update the memo and lower the spend limit
privacy cards update abc*******xyz --memo "Updated Card Name" --spend-limit 25
# Pause a card
privacy cards update abc*******xyz --state PAUSEDPause or Unpause a Card
Pauses a card, preventing it from being charged. The card can be unpaused at any time.
privacy cards pause <token>privacy cards unpause <token>Close a Card
Permanently closes a card. This action cannot be undone. A closed card cannot be reopened or charged.
privacy cards close <token>Get a Card's Full PAN
Retrieves the sensitive card details needed to make a purchase: the full card number (PAN), CVV, and expiry date.
privacy cards pan <token>Security note: Treat PAN data carefully. Avoid logging or storing the output of this command.
Transactions
Review transaction history across your cards.
Transactions List
Returns a paginated list of transactions across all cards, with optional filters for date range, card, and result.
privacy transactions list [options]| Option | Description |
|---|---|
--begin <date> | Return transactions on or after this date (YYYY-MM-DD or ISO 8601) |
--end <date> | Return transactions on or before this date (YYYY-MM-DD or ISO 8601) |
--card-token <token> | Filter to transactions for a specific card |
--result <result> | Filter by outcome: APPROVED or DECLINED |
--page <number> | Page number to retrieve |
--page-size <number> | Number of results per page (default: 20, max: 1000) |
Default fields: token, card_token, amount, result, merchant, created
Examples
# List recent transactions
privacy transactions list
# Filter by date range
privacy transactions list --begin 2025-01-01 --end 2025-03-31
# Show only declined transactions for a specific card
privacy transactions list --card-token abc*******xyz --result DECLINED
# Export a full month as JSON
privacy transactions list --begin 2025-03-01 --end 2025-03-31 --page-size 1000 --json > march.jsonList transactions for a specific card
privacy transactions list --card-token <token>
Interactive Mode
Launches an interactive REPL (read-eval-print loop) for running multiple commands in a single session without re-authenticating or repeating the privacy prefix. Running privacy with no arguments also opens the REPL.
privacy #start REPL (default when no command given)
privacy interactive # explicit REPL modeInside the REPL, enter commands without the privacy prefix:
privacy> cards list
privacy> cards create --type SINGLE_USE --memo "Coffee" --spend-limit 10
privacy> transactions list --begin 2025-01-01
privacy> help
privacy> exit
Built-in REPL commands:
| Command | Description |
|---|---|
help | List available commands |
exit or quit | Close the REPL |
The REPL also provides fuzzy suggestions if you mistype a command name.
Note: Shell operators such as
|,>, and&&are not supported inside the REPL. For pipelines and redirects, use the CLI in non-interactive mode.
Output Modes
| Mode | When | Description |
|---|---|---|
| Table | TTY terminal (defualt) | Aligned columns, right-aligned monetary values, pagination footer |
| JSON | Non-TTY / --json flag | Compact JSON, monetary values formatted as $x.xx |
| Wide | --wide flag | Table mode with all fields shown |
Updated 6 days ago