A powerful CLI for the Mercury Banking API. Manage accounts, transactions, recipients, webhooks, and more from your terminal.
- 🏦 Full Mercury API coverage — accounts, transactions, transfers, recipients, webhooks, and more
- 📊 Multiple output formats — human-readable tables or JSON for scripting
- 🔐 Secure token storage — credentials stored safely in
~/.mercury/ - ⚡ Fast — lightweight with minimal dependencies
- 🤖 Scriptable — no interactive prompts, perfect for CI/CD and automation
npm install -g mercury-cli# 1. Get your API token from Mercury Dashboard
# https://app.mercury.com/settings/api
# 2. Authenticate
mercury login --token <YOUR_API_TOKEN>
# 3. List your accounts
mercury accounts
# 4. View transactions
mercury transactions <account-id>All commands support these global options:
| Option | Description |
|---|---|
--json |
Output as JSON instead of human-readable tables |
-h, --help |
Show help for the command |
-v, --version |
Show CLI version |
Mercury CLI uses API tokens for authentication. Tokens are stored locally in ~/.mercury/token with restricted permissions (mode 600).
- Log in to Mercury Dashboard
- Navigate to Settings → API
- Click Create API Token
- Choose token permissions:
- Read-only: Can fetch all data, cannot initiate transactions
- Read-write: Full access including payments
- Custom: Fine-grained scope control
- Copy the token (format:
secret-token:mercury_production_...)
| Scope | Permissions |
|---|---|
read |
View accounts, transactions, recipients |
offline_access |
Refresh token access |
SendMoney |
Initiate transfers and payments |
RequestCards |
Create debit cards |
Store an API token for authentication.
Syntax:
mercury login --token <TOKEN>
mercury login --token-stdin
Flags:
| Flag | Required | Description |
|---|---|---|
--token <TOKEN> |
One of these | API token string |
--token-stdin |
One of these | Read token from stdin |
Examples:
# Direct token input
mercury login --token "secret-token:mercury_production_wma_xxx"
# From environment variable
mercury login --token "$MERCURY_TOKEN"
# From stdin (CI/CD friendly)
echo "$MERCURY_TOKEN" | mercury login --token-stdin
# From file
cat ~/.secrets/mercury | mercury login --token-stdinSuccess Response:
Authenticated successfully. Token saved to ~/.mercury/token
Error Cases:
| Error | Cause | Solution |
|---|---|---|
Missing token |
Neither --token nor --token-stdin provided |
Provide token via one of the methods |
Token cannot be empty |
Empty string provided | Ensure token is not empty |
Use either --token or --token-stdin, not both |
Both flags used | Use only one method |
Remove stored authentication token.
Syntax:
mercury logout
Examples:
mercury logout
# Output: Logged out. Token removed from ~/.mercury/token
# If not logged in:
mercury logout
# Output: Not currently authenticated.Show current authentication and configuration status.
Syntax:
mercury status
Example Output:
Mercury CLI Status
──────────────────
Authenticated: Yes
Token: secret-tok...xxxx
API Base URL: https://api.mercury.com/api/v1
Default Account: abc123-def456-...
Fields:
| Field | Description |
|---|---|
Authenticated |
Yes/No |
Token |
Masked token (first 10 + last 4 chars) |
API Base URL |
API endpoint being used |
Default Account |
If configured in config.json |
| File | Purpose | Permissions |
|---|---|---|
~/.mercury/token |
API token | 600 (owner read/write only) |
~/.mercury/config.json |
Optional configuration | 600 |
Optional configuration at ~/.mercury/config.json:
{
"defaultAccountId": "abc123-def456-...",
"apiBaseUrl": "https://api.mercury.com/api/v1"
}| Field | Type | Default | Description |
|---|---|---|---|
defaultAccountId |
string | none | Account ID to use when not specified |
apiBaseUrl |
string | https://api.mercury.com/api/v1 |
API endpoint |
- Never commit tokens — Add
.mercury/to.gitignore - Use environment variables in CI — Don't hardcode tokens
- Rotate tokens periodically — Regenerate from Mercury Dashboard
- Use read-only tokens when possible — Minimize risk
Manage Mercury bank accounts.
Aliases: account, acc
List all accounts.
Syntax:
mercury accounts [list] [--json]
Example Output:
ID Name Type Status Available Current
────────────────────────────────── ──────────────────── ──────────── ────────── ─────────────── ───────────────
abc123-def456-... Operating Account checking active $125,432.10 $125,432.10
xyz789-uvw012-... Savings savings active $50,000.00 $50,000.00
JSON Response:
[
{
"id": "abc123-def456-...",
"name": "Operating Account",
"status": "active",
"type": "checking",
"accountNumber": "1234567890",
"routingNumber": "021000021",
"currentBalance": 12543210,
"availableBalance": 12543210,
"createdAt": "2024-01-15T10:30:00Z"
}
]Get detailed information about a specific account.
Syntax:
mercury accounts get <account-id> [--json]
Parameters:
| Parameter | Required | Description |
|---|---|---|
account-id |
Yes | The UUID of the account |
Example:
mercury accounts get abc123-def456-789a-bcde-f01234567890Output:
Account Details
───────────────
ID: abc123-def456-789a-bcde-f01234567890
Name: Operating Account
Type: checking
Status: active
Account Number: 1234567890
Routing Number: 021000021
Available: $125,432.10
Current: $125,432.10
Created: Jan 15, 2024
Account Types:
checking— Standard business checking accountsavings— Business savings accountmercury_treasury— Mercury Treasury account
Account Statuses:
active— Account is open and operationalpending— Account is being set upclosed— Account has been closed
View and send transactions.
Aliases: tx, txn
List transactions for an account.
Syntax:
mercury transactions <account-id> [options] [--json]
Parameters:
| Parameter | Required | Description |
|---|---|---|
account-id |
Yes | The UUID of the account |
Options:
| Option | Type | Default | Description |
|---|---|---|---|
--limit <N> |
integer | 25 | Maximum number of transactions to return |
--offset <N> |
integer | 0 | Number of transactions to skip (for pagination) |
--status <status> |
string | all | Filter by status: pending, sent, cancelled, failed |
--start <date> |
ISO date | none | Filter transactions on or after this date |
--end <date> |
ISO date | none | Filter transactions on or before this date |
--search <query> |
string | none | Search by counterparty name |
Examples:
# List recent transactions
mercury transactions abc123-def456-...
# With pagination
mercury transactions abc123-def456-... --limit 50 --offset 100
# Filter by status
mercury transactions abc123-def456-... --status pending
# Filter by date range
mercury transactions abc123-def456-... --start 2024-01-01 --end 2024-12-31
# Search by counterparty
mercury transactions abc123-def456-... --search "Acme Corp"Transaction Statuses:
pending— Transaction is being processedsent— Transaction completed successfullycancelled— Transaction was cancelledfailed— Transaction failed
Transaction Kinds:
externalTransfer— ACH or wire transfer to external accountinternalTransfer— Transfer between Mercury accountsoutgoingPayment— Check or other outgoing paymentincomingPayment— Received payment
Get detailed information about a specific transaction.
Syntax:
mercury transactions get <account-id> <transaction-id> [--json]
Parameters:
| Parameter | Required | Description |
|---|---|---|
account-id |
Yes | The UUID of the account |
transaction-id |
Yes | The UUID of the transaction |
Send money to a recipient via ACH or wire transfer.
Syntax:
mercury transactions send <account-id> --recipient <id> --amount <cents> --idempotency-key <key> [options] [--json]
Options:
| Option | Required | Type | Description |
|---|---|---|---|
--recipient <id> |
Yes | string | Recipient UUID |
--amount <cents> |
Yes | integer | Amount in cents (e.g., 10000 = $100.00) |
--idempotency-key <key> |
Yes | string | Unique key to prevent duplicate transactions |
--method <method> |
No | string | Transfer method: ach (default) or wire |
--note <note> |
No | string | Internal note for the transaction |
Examples:
# Send $100 via ACH
mercury transactions send abc123-def456-... \
--recipient recip-123 \
--amount 10000 \
--idempotency-key "invoice-2024-001"
# Send $500 via Wire with note
mercury transactions send abc123-def456-... \
--recipient recip-123 \
--amount 50000 \
--idempotency-key "wire-2024-001" \
--method wire \
--note "Urgent payment"Important Notes:
- Amounts are always in cents (smallest currency unit)
- Idempotency keys prevent duplicate transactions if the request is retried
- Wire transfers typically have higher fees but faster delivery
- ACH transfers take 1-3 business days
Transfer funds between two Mercury accounts you own.
Syntax:
mercury transfer --from <account-id> --to <account-id> --amount <cents> --idempotency-key <key> [options] [--json]
Options:
| Option | Required | Type | Description |
|---|---|---|---|
--from <id> |
Yes | string | Source account UUID |
--to <id> |
Yes | string | Destination account UUID |
--amount <cents> |
Yes | integer | Amount in cents |
--idempotency-key <key> |
Yes | string | Unique key to prevent duplicates |
--note <note> |
No | string | Internal note |
Manage payment recipients (external bank accounts).
Aliases: recipient, recip
List all recipients.
Syntax:
mercury recipients [list] [--limit <N>] [--offset <N>] [--json]
Get detailed information about a recipient.
Syntax:
mercury recipients get <recipient-id> [--json]
Add a new payment recipient.
Syntax:
mercury recipients add --name <name> --account <number> --routing <number> [options] [--json]
Options:
| Option | Required | Type | Description |
|---|---|---|---|
--name <name> |
Yes | string | Recipient name |
--account <number> |
Yes | string | Bank account number |
--routing <number> |
Yes | string | Bank routing number (9 digits) |
--bank-name <name> |
No | string | Name of the bank |
--account-type <type> |
No | string | Account type |
--email <email> |
No | string | Contact email (repeatable) |
Account Types: businessChecking, businessSavings, personalChecking, personalSavings
Delete a recipient.
Syntax:
mercury recipients delete <recipient-id>
Aliases: card
List cards for an account.
Syntax:
mercury cards <account-id> [--json]
Card Statuses: active, frozen, cancelled
Aliases: statement
List statements for an account.
Syntax:
mercury statements <account-id> [--json]
Get a specific statement.
Syntax:
mercury statements get <account-id> <statement-id> [--json]
Aliases: webhook, wh
List all webhook endpoints.
Syntax:
mercury webhooks [list] [--json]
Get details about a webhook.
Syntax:
mercury webhooks get <webhook-id> [--json]
Create a new webhook endpoint.
Syntax:
mercury webhooks create --url <url> [--events <event1,event2>] [--secret <secret>] [--json]
Event Types: transaction.created, transaction.updated, account.created, recipient.created, * (wildcard)
Update an existing webhook.
Syntax:
mercury webhooks update <webhook-id> [--url <url>] [--events <events>] [--status <status>] [--json]
Delete a webhook endpoint.
Syntax:
mercury webhooks delete <webhook-id>
Send a test event to verify webhook connectivity.
Syntax:
mercury webhooks verify <webhook-id>
Aliases: event
List API events (audit trail).
Syntax:
mercury events [list] [--limit <N>] [--offset <N>] [--type <type>] [--json]
Get details about a specific event.
Syntax:
mercury events get <event-id> [--json]
Aliases: org
Get organization information (legal name, EIN, address).
Syntax:
mercury organization [--json]
Aliases: user
List all users in the organization.
Syntax:
mercury users [list] [--json]
Get details about a specific user.
Syntax:
mercury users get <user-id> [--json]
Aliases: category, cat
List available transaction categories.
Syntax:
mercury categories [--json]
| HTTP Code | Error | Cause | Solution |
|---|---|---|---|
| 401 | Not authenticated |
Missing or invalid token | Run mercury login |
| 403 | Forbidden |
Token lacks required scope | Get token with appropriate permissions |
| 404 | Not found |
Resource doesn't exist | Verify the ID |
| 422 | Validation error |
Invalid parameters | Check format and values |
| 429 | Rate limited |
Too many requests | Wait and retry |
mercury transactions "$ACCOUNT_ID" --limit 1000 --json | \
jq -r '.transactions[] | [.id, .status, .amount, .counterpartyName] | @csv'balance=$(mercury accounts get "$ACCOUNT_ID" --json | jq -r '.availableBalance')
echo "Balance: $((balance / 100)) dollars"- Base URL:
https://api.mercury.com/api/v1 - Authentication: Bearer token
- Rate Limits: 100 requests per minute
- Documentation: docs.mercury.com/reference
| CLI Command | HTTP Method | API Endpoint |
|---|---|---|
accounts list |
GET | /accounts |
accounts get <id> |
GET | /account/{id} |
transactions list |
GET | /account/{id}/transactions |
transactions send |
POST | /account/{id}/transactions |
transfer |
POST | /transfer |
recipients list |
GET | /recipients |
recipients add |
POST | /recipients |
recipients delete <id> |
DELETE | /recipient/{id} |
cards |
GET | /account/{id}/cards |
statements list |
GET | /account/{id}/statements |
webhooks list |
GET | /webhooks |
webhooks create |
POST | /webhooks |
events list |
GET | /events |
organization |
GET | /organization |
users list |
GET | /users |
categories |
GET | /categories |
MIT License. See LICENSE for details.
