# afpay CLI reference

<!-- Generated by `afpay --docs`. Do not edit by hand. -->

One payment interface for AI agents across Cashu, Lightning, Solana, EVM, and Bitcoin — with two-step plan-and-confirm sends, server-enforced spend limits, idempotency, and CLI, pipe, and HTTP API access.

`afpay` is compiled from a closed `cli-spec-v1` registry: one source for argv parsing, typed invocation values, which parameter combinations are legal, output contracts, and help. An invocation runs only when it matches exactly one registered combination.

## Global arguments

AFDATA registers these itself, so the syntax in [Commands](#commands) leaves them out.

| Argument | Where | What it does |
|---|---|---|
| `--help` | every command | Every legal shape of that command, complete, plus its subcommands. JSON by default; `--output plain` for a terminal. |
| `--version` | afpay only | Name, version, and build identity as one protocol result. |
| `--docs` | afpay only | This document, rendered from the registry. |
| `--output <FORMAT>` | per output contract | Render as json, yaml, plain (default `json`). |
| `--output-to <DESTINATION>` | per output contract | Route results and diagnostics to split, stdout, stderr (default `split`). |
| `--stdout-file <PATH>`, `--stderr-file <PATH>` | per output contract | Append that stream to a file instead. |

Success output is protocol events, on those terms, unless a command's own **Output** line says otherwise.

A **shape** is one legal set of arguments that may appear together, under a stable id. Where a command has more than one, each id is a heading below. `--help` returns them all at once, so discovering a command costs one call; there is no recursive mode across commands, and this document is that view.

## Commands

- [`afpay`](#afpay) — Run a long-lived afpay session instead of a single command
- [`afpay api export`](#afpay-api-export) — Write the generated OpenAPI document.
- [`afpay api serve`](#afpay-api-serve) — Serve the bearer-protected operation API.
- [`afpay balance`](#afpay-balance) — Balance across every network
- [`afpay btc backup`](#afpay-btc-backup) — Back up Bitcoin wallet data to a .tar.zst archive
- [`afpay btc balance`](#afpay-btc-balance) — Bitcoin balance
- [`afpay btc config set`](#afpay-btc-config-set) — Update one Bitcoin wallet's settings
- [`afpay btc config show`](#afpay-btc-config-show) — Show one Bitcoin wallet's configuration
- [`afpay btc limit add`](#afpay-btc-limit-add) — Add a Bitcoin network or wallet spend limit
- [`afpay btc receive`](#afpay-btc-receive) — Show the wallet's receive address
- [`afpay btc restore`](#afpay-btc-restore) — Restore Bitcoin wallet data from a .tar.zst archive
- [`afpay btc send`](#afpay-btc-send) — Send BTC on-chain
- [`afpay btc wallet close`](#afpay-btc-wallet-close) — Close a Bitcoin wallet
- [`afpay btc wallet create`](#afpay-btc-wallet-create) — Create a Bitcoin wallet
- [`afpay btc wallet dangerously-show-seed`](#afpay-btc-wallet-dangerously-show-seed) — Reveal the Bitcoin wallet seed; output is deliberately unredacted
- [`afpay btc wallet list`](#afpay-btc-wallet-list) — List Bitcoin wallets
- [`afpay cashu backup`](#afpay-cashu-backup) — Back up Cashu wallet data to a .tar.zst archive
- [`afpay cashu balance`](#afpay-cashu-balance) — Cashu balance
- [`afpay cashu config set`](#afpay-cashu-config-set) — Update one Cashu wallet's settings
- [`afpay cashu config show`](#afpay-cashu-config-show) — Show one Cashu wallet's configuration
- [`afpay cashu limit add`](#afpay-cashu-limit-add) — Add a Cashu network or wallet spend limit
- [`afpay cashu receive`](#afpay-cashu-receive) — Redeem a Cashu token into a wallet
- [`afpay cashu receive-from-ln`](#afpay-cashu-receive-from-ln) — Create a Lightning invoice that mints Cashu proofs when paid
- [`afpay cashu receive-from-ln-claim`](#afpay-cashu-receive-from-ln-claim) — Claim the proofs minted by a settled receive-from-ln quote
- [`afpay cashu restore`](#afpay-cashu-restore) — Restore Cashu wallet data from a .tar.zst archive
- [`afpay cashu send`](#afpay-cashu-send) — Mint a P2P Cashu token; to pay a Lightning invoice use `cashu send-to-ln`
- [`afpay cashu send-to-ln`](#afpay-cashu-send-to-ln) — Melt Cashu proofs to pay a Lightning invoice
- [`afpay cashu wallet close`](#afpay-cashu-wallet-close) — Close a Cashu wallet
- [`afpay cashu wallet create`](#afpay-cashu-wallet-create) — Create a Cashu wallet on one mint
- [`afpay cashu wallet dangerously-show-seed`](#afpay-cashu-wallet-dangerously-show-seed) — Reveal the Cashu wallet seed; output is deliberately unredacted
- [`afpay cashu wallet list`](#afpay-cashu-wallet-list) — List Cashu wallets
- [`afpay cashu wallet restore`](#afpay-cashu-wallet-restore) — Restore lost proofs from the mint, repairing counter or proof drift
- [`afpay container install`](#afpay-container-install) — Build the image if missing, run the daemon, and print the client command
- [`afpay container logs`](#afpay-container-logs) — Stream the container logs, unchanged
- [`afpay container status`](#afpay-container-status) — Report whether the daemon is running, with its endpoint and client command
- [`afpay container uninstall`](#afpay-container-uninstall) — Stop and remove the container; --purge also drops the image and cache
- [`afpay evm backup`](#afpay-evm-backup) — Back up EVM wallet data to a .tar.zst archive
- [`afpay evm balance`](#afpay-evm-balance) — EVM balance
- [`afpay evm config set`](#afpay-evm-config-set) — Update one EVM wallet's settings
- [`afpay evm config show`](#afpay-evm-config-show) — Show one EVM wallet's configuration
- [`afpay evm config token-add`](#afpay-evm-config-token-add) — Register a custom EVM token for balance tracking
- [`afpay evm config token-remove`](#afpay-evm-config-token-remove) — Unregister a custom EVM token
- [`afpay evm limit add`](#afpay-evm-limit-add) — Add a EVM network or wallet spend limit
- [`afpay evm receive`](#afpay-evm-receive) — Show the wallet's receive address
- [`afpay evm restore`](#afpay-evm-restore) — Restore EVM wallet data from a .tar.zst archive
- [`afpay evm send`](#afpay-evm-send) — Send the chain's native token or an ERC-20
- [`afpay evm wallet close`](#afpay-evm-wallet-close) — Close a EVM wallet
- [`afpay evm wallet create`](#afpay-evm-wallet-create) — Create an EVM chain wallet
- [`afpay evm wallet dangerously-show-seed`](#afpay-evm-wallet-dangerously-show-seed) — Reveal the EVM wallet seed; output is deliberately unredacted
- [`afpay evm wallet list`](#afpay-evm-wallet-list) — List EVM wallets
- [`afpay global backup`](#afpay-global-backup) — Back up every network's data to a .tar.zst archive
- [`afpay global config get`](#afpay-global-config-get) — Read the runtime configuration, or one value by dot-path
- [`afpay global config set`](#afpay-global-config-set) — Set one runtime configuration value
- [`afpay global limit add`](#afpay-global-limit-add) — Add a global spend limit, in USD cents
- [`afpay global restore`](#afpay-global-restore) — Restore every network's data from a .tar.zst archive
- [`afpay history list`](#afpay-history-list) — List history records from the local store
- [`afpay history status`](#afpay-history-status) — Report one transaction's current status
- [`afpay history update`](#afpay-history-update) — Incrementally sync backend history into the local store
- [`afpay limit list`](#afpay-limit-list) — Show every spend-limit rule and its usage
- [`afpay limit reconcile`](#afpay-limit-reconcile) — Force a stuck spend-ledger reservation to a terminal state (operator-only)
- [`afpay limit remove`](#afpay-limit-remove) — Remove a spend-limit rule by ID
- [`afpay ln backup`](#afpay-ln-backup) — Back up Lightning wallet data to a .tar.zst archive
- [`afpay ln balance`](#afpay-ln-balance) — Lightning balance
- [`afpay ln config set`](#afpay-ln-config-set) — Update one Lightning wallet's settings
- [`afpay ln config show`](#afpay-ln-config-show) — Show one Lightning wallet's configuration
- [`afpay ln limit add`](#afpay-ln-limit-add) — Add a Lightning network or wallet spend limit
- [`afpay ln receive`](#afpay-ln-receive) — Create a BOLT11 invoice, or return the reusable BOLT12 offer
- [`afpay ln restore`](#afpay-ln-restore) — Restore Lightning wallet data from a .tar.zst archive
- [`afpay ln send`](#afpay-ln-send) — Pay a BOLT11 invoice or a BOLT12 offer. Lightning carries no on-chain memo, so annotate with --local-memo
- [`afpay ln wallet close`](#afpay-ln-wallet-close) — Close a Lightning wallet
- [`afpay ln wallet create`](#afpay-ln-wallet-create) — Create a Lightning wallet
- [`afpay ln wallet dangerously-show-seed`](#afpay-ln-wallet-dangerously-show-seed) — Reveal the Lightning wallet seed; output is deliberately unredacted
- [`afpay ln wallet list`](#afpay-ln-wallet-list) — List Lightning wallets
- [`afpay pay confirm`](#afpay-pay-confirm) — Pay by confirming a plan a `send` resolved — the only command that moves money
- [`afpay skill install`](#afpay-skill-install) — Install the Agent-First Pay skill
- [`afpay skill status`](#afpay-skill-status) — Report whether the Agent-First Pay skill is installed, valid, and current
- [`afpay skill uninstall`](#afpay-skill-uninstall) — Remove the Agent-First Pay skill that afpay installed
- [`afpay sol backup`](#afpay-sol-backup) — Back up Solana wallet data to a .tar.zst archive
- [`afpay sol balance`](#afpay-sol-balance) — Solana balance
- [`afpay sol config set`](#afpay-sol-config-set) — Update one Solana wallet's settings
- [`afpay sol config show`](#afpay-sol-config-show) — Show one Solana wallet's configuration
- [`afpay sol config token-add`](#afpay-sol-config-token-add) — Register a custom Solana token for balance tracking
- [`afpay sol config token-remove`](#afpay-sol-config-token-remove) — Unregister a custom Solana token
- [`afpay sol limit add`](#afpay-sol-limit-add) — Add a Solana network or wallet spend limit
- [`afpay sol receive`](#afpay-sol-receive) — Show the wallet's receive address
- [`afpay sol restore`](#afpay-sol-restore) — Restore Solana wallet data from a .tar.zst archive
- [`afpay sol send`](#afpay-sol-send) — Send SOL or an SPL token
- [`afpay sol wallet close`](#afpay-sol-wallet-close) — Close a Solana wallet
- [`afpay sol wallet create`](#afpay-sol-wallet-create) — Create a Solana wallet
- [`afpay sol wallet dangerously-show-seed`](#afpay-sol-wallet-dangerously-show-seed) — Reveal the Solana wallet seed; output is deliberately unredacted
- [`afpay sol wallet list`](#afpay-sol-wallet-list) — List Solana wallets
- [`afpay ui receive`](#afpay-ui-receive) — Open a panel showing the receive address or invoice as a code to scan
- [`afpay ui send`](#afpay-ui-send) — Open a panel showing a resolved payment and wait for a person to approve it
- [`afpay ui wallet`](#afpay-ui-wallet) — Open a panel showing every wallet and its balance
- [`afpay wallet list`](#afpay-wallet-list) — List wallets across every network

### `afpay`

Run a long-lived afpay session instead of a single command

#### `session-pipe` — Read JSONL requests on stdin and answer on stdout

```
afpay --mode pipe [--data-dir <DIR>] [--log <FILTER>...] [--public-listen]
```

#### `session-interactive` — Human REPL with completion and QR helpers

```
afpay --mode interactive [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>]
```

#### `session-tui` — Full-screen terminal workflow over the same command interface

```
afpay --mode tui [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--mode` | Long-lived session to run instead of a single command |
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Drive another afpay node from this session |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--public-listen` | Allow binding to a non-loopback address; use only behind TLS or a firewall |

### `afpay api export`

Write the generated OpenAPI document.

```
afpay api export [--directory <PATH>] [--force]
```

Output: protocol events; `--output` json/yaml/plain (default `json`), `--output-to` split/stdout/stderr (default `split`).

If omitted, `--directory` = `openapi`.

| Argument | Meaning |
|---|---|
| `--directory` | Destination directory. |
| `--force` | Replace an existing generated document. |

### `afpay api serve`

Serve the bearer-protected operation API.

```
afpay api serve [--port <PORT>] [--listen <IP>] [--advertise <HOST[:PORT]>] [--access-token-secret <SOURCE>] [--data-dir <DIR>] [--log <FILTER>...] [--public-listen]
```

Output: protocol events; `--output` json/yaml/plain (default `json`), `--output-to` stdout/stderr (default `stdout`).

If omitted, `--listen` = `127.0.0.1`, `--port` = `9401`.

| Argument | Meaning |
|---|---|
| `--port` | TCP port. Use 0 to let the operating system choose. |
| `--listen` | IP address to bind. Use 0.0.0.0 to listen on all IPv4 addresses. |
| `--advertise` | Published address. Defaults to the listen address or the LAN address for 0.0.0.0. |
| `--access-token-secret` | Required bearer credential. (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--public-listen` | Allow a non-loopback bind with an explicit provider allowlist. |

### `afpay balance`

Balance across every network

```
afpay balance [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] [--network <cashu|ln|sol|evm|btc>] [--cashu-check]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (omit to show every wallet) |
| `--network` | Restrict to one network |
| `--cashu-check` | Verify Cashu proofs against the mint; slower but authoritative |

### `afpay btc backup`

Back up Bitcoin wallet data to a .tar.zst archive

```
afpay btc backup [--data-dir <DIR>] [--archive-out <PATH>] [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--archive-out` | Archive path (default: ./afpay-btc-<epoch>.tar.zst) |
| `--wallet` | Wallet ID (omit to back up every Bitcoin wallet) |

### `afpay btc balance`

Bitcoin balance

```
afpay btc balance [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (omit to show every Bitcoin wallet) |

### `afpay btc config set`

Update one Bitcoin wallet's settings

```
afpay btc config set [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--label <LABEL>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--label` | New wallet label |

### `afpay btc config show`

Show one Bitcoin wallet's configuration

```
afpay btc config show [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay btc limit add`

Add a Bitcoin network or wallet spend limit

```
afpay btc limit add [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] --window <DURATION> --max-spend <AMOUNT>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID; omit for a limit covering the whole network |
| `--window` | Rolling window, e.g. 30m, 1h, 24h, 7d |
| `--max-spend` | Maximum spend in base units |

### `afpay btc receive`

Show the wallet's receive address

#### `btc-receive` — Return the receive address or invoice and exit

```
afpay btc receive [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] [--qr-svg-file] [--idempotency-key <KEY>]
```

#### `btc-receive-wait` — Block until a matching payment settles; only this shape describes the wait

```
afpay btc receive [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] --wait [--wait-timeout-s <SECONDS>] [--wait-poll-interval-ms <MS>] [--qr-svg-file] [--idempotency-key <KEY>] [--wait-sync-limit <N>]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (auto-selected if omitted) |
| `--wait` | Block until a matching payment settles |
| `--wait-timeout-s` | Give up waiting after N seconds |
| `--wait-poll-interval-ms` | Poll interval while waiting |
| `--qr-svg-file` | Write the receive QR payload to an SVG file |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and body returns the receive already placed instead of minting a second invoice |
| `--wait-sync-limit` | Max history records scanned per poll while resolving the tx id |

### `afpay btc restore`

Restore Bitcoin wallet data from a .tar.zst archive

```
afpay btc restore <ARCHIVE> [--data-dir <DIR>] [--dangerously-overwrite] [--pg-url-secret <SOURCE>]
```

| Argument | Meaning |
|---|---|
| `ARCHIVE` | Path to the backup archive |
| `--data-dir` | Wallet and data directory |
| `--dangerously-overwrite` | Clear existing data before restoring instead of merging |
| `--pg-url-secret` | Override the PostgreSQL connection URL for the pg restore step (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |

### `afpay btc send`

Send BTC on-chain

```
afpay btc send [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --to <ADDRESS> --amount-sats <SATS> [--wallet <WALLET_ID>] [--onchain-memo <TEXT>] [--local-memo <KEY=VALUE>...]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--to` | Recipient Bitcoin address (bc1… / tb1…) |
| `--amount-sats` | Amount in satoshis |
| `--wallet` | Source wallet ID (auto-selected if omitted) |
| `--onchain-memo` | On-chain memo, sent with the transaction |
| `--local-memo` | Local bookkeeping annotation; bare text is stored as note=<text> |

### `afpay btc wallet close`

Close a Bitcoin wallet

```
afpay btc wallet close [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--dangerously-skip-balance-check-and-may-lose-money]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--dangerously-skip-balance-check-and-may-lose-money` | Close even if the wallet still holds funds |

### `afpay btc wallet create`

Create a Bitcoin wallet

#### `btc-wallet-create-esplora` — Esplora chain source; only this shape accepts --btc-esplora-url

```
afpay btc wallet create [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--idempotency-key <KEY>] [--btc-network <mainnet|signet>] [--btc-address-type <taproot|segwit>] [--btc-backend esplora] [--btc-esplora-url <URL>] [--mnemonic-secret <SOURCE>] [--label <LABEL>]
```

If omitted, `--btc-backend` = `esplora`.

#### `btc-wallet-create-core-rpc` — Bitcoin Core RPC chain source; requires --btc-core-url

```
afpay btc wallet create [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--idempotency-key <KEY>] [--btc-network <mainnet|signet>] [--btc-address-type <taproot|segwit>] --btc-backend core-rpc --btc-core-url <URL> [--btc-core-auth-secret <SOURCE>] [--mnemonic-secret <SOURCE>] [--label <LABEL>]
```

#### `btc-wallet-create-electrum` — Electrum chain source; requires --btc-electrum-url

```
afpay btc wallet create [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--idempotency-key <KEY>] [--btc-network <mainnet|signet>] [--btc-address-type <taproot|segwit>] --btc-backend electrum --btc-electrum-url <URL> [--mnemonic-secret <SOURCE>] [--label <LABEL>]
```

#### Shared defaults

If omitted, `--btc-address-type` = `taproot`, `--btc-network` = `mainnet`.

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and body reports the wallet the first call created instead of generating a second key |
| `--btc-network` | Bitcoin sub-network |
| `--btc-address-type` | Address type |
| `--btc-backend` | Chain-source backend |
| `--btc-esplora-url` | Custom Esplora API URL |
| `--btc-core-url` | Bitcoin Core RPC URL |
| `--btc-core-auth-secret` | Bitcoin Core RPC credentials as USER:PASS (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--btc-electrum-url` | Electrum server URL |
| `--mnemonic-secret` | Existing BIP39 mnemonic to restore this wallet from (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--label` | Optional wallet label |

### `afpay btc wallet dangerously-show-seed`

Reveal the Bitcoin wallet seed; output is deliberately unredacted

```
afpay btc wallet dangerously-show-seed [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay btc wallet list`

List Bitcoin wallets

```
afpay btc wallet list [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |

### `afpay cashu backup`

Back up Cashu wallet data to a .tar.zst archive

```
afpay cashu backup [--data-dir <DIR>] [--archive-out <PATH>] [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--archive-out` | Archive path (default: ./afpay-cashu-<epoch>.tar.zst) |
| `--wallet` | Wallet ID (omit to back up every Cashu wallet) |

### `afpay cashu balance`

Cashu balance

```
afpay cashu balance [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] [--check]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (omit to show every Cashu wallet) |
| `--check` | Verify proofs against the mint; slower but authoritative |

### `afpay cashu config set`

Update one Cashu wallet's settings

```
afpay cashu config set [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--label <LABEL>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--label` | New wallet label |

### `afpay cashu config show`

Show one Cashu wallet's configuration

```
afpay cashu config show [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay cashu limit add`

Add a Cashu network or wallet spend limit

```
afpay cashu limit add [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] --window <DURATION> --max-spend <AMOUNT>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID; omit for a limit covering the whole network |
| `--window` | Rolling window, e.g. 30m, 1h, 24h, 7d |
| `--max-spend` | Maximum spend in base units |

### `afpay cashu receive`

Redeem a Cashu token into a wallet

```
afpay cashu receive [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] <TOKEN> [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `TOKEN` | Cashu token string |
| `--wallet` | Wallet ID (auto-matched from the token if omitted) |

### `afpay cashu receive-from-ln`

Create a Lightning invoice that mints Cashu proofs when paid

#### `cashu-receive` — Return the receive address or invoice and exit

```
afpay cashu receive-from-ln [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] [--qr-svg-file] [--idempotency-key <KEY>] [--amount-sats <SATS>] [--onchain-memo <TEXT>]
```

#### `cashu-receive-wait` — Block until a matching payment settles; only this shape describes the wait

```
afpay cashu receive-from-ln [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] --wait [--wait-timeout-s <SECONDS>] [--wait-poll-interval-ms <MS>] [--qr-svg-file] [--idempotency-key <KEY>] [--amount-sats <SATS>] [--onchain-memo <TEXT>]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (auto-selected if omitted) |
| `--wait` | Block until a matching payment settles |
| `--wait-timeout-s` | Give up waiting after N seconds |
| `--wait-poll-interval-ms` | Poll interval while waiting |
| `--qr-svg-file` | Write the receive QR payload to an SVG file |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and body returns the receive already placed instead of minting a second invoice |
| `--amount-sats` | Amount in sats |
| `--onchain-memo` | Invoice description |

### `afpay cashu receive-from-ln-claim`

Claim the proofs minted by a settled receive-from-ln quote

```
afpay cashu receive-from-ln-claim [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> --ln-quote-id <QUOTE_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--ln-quote-id` | Quote ID or payment hash from the deposit |

### `afpay cashu restore`

Restore Cashu wallet data from a .tar.zst archive

```
afpay cashu restore <ARCHIVE> [--data-dir <DIR>] [--dangerously-overwrite] [--pg-url-secret <SOURCE>]
```

| Argument | Meaning |
|---|---|
| `ARCHIVE` | Path to the backup archive |
| `--data-dir` | Wallet and data directory |
| `--dangerously-overwrite` | Clear existing data before restoring instead of merging |
| `--pg-url-secret` | Override the PostgreSQL connection URL for the pg restore step (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |

### `afpay cashu send`

Mint a P2P Cashu token; to pay a Lightning invoice use `cashu send-to-ln`

```
afpay cashu send [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --amount-sats <SATS> [--cashu-mint <URL>...] [--wallet <WALLET_ID>] [--onchain-memo <TEXT>] [--local-memo <KEY=VALUE>...]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--amount-sats` | Amount in sats |
| `--cashu-mint` | Restrict to wallets on these mints, tried in order |
| `--wallet` | Source wallet ID (auto-selected if omitted) |
| `--onchain-memo` | On-chain memo, sent with the transaction |
| `--local-memo` | Local bookkeeping annotation; bare text is stored as note=<text> |

### `afpay cashu send-to-ln`

Melt Cashu proofs to pay a Lightning invoice

```
afpay cashu send-to-ln [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --to <BOLT11> [--wallet <WALLET_ID>] [--onchain-memo <TEXT>] [--local-memo <KEY=VALUE>...]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--to` | Lightning invoice to pay |
| `--wallet` | Source wallet ID (auto-selected if omitted) |
| `--onchain-memo` | On-chain memo, sent with the transaction |
| `--local-memo` | Local bookkeeping annotation; bare text is stored as note=<text> |

### `afpay cashu wallet close`

Close a Cashu wallet

```
afpay cashu wallet close [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--dangerously-skip-balance-check-and-may-lose-money]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--dangerously-skip-balance-check-and-may-lose-money` | Close even if the wallet still holds funds |

### `afpay cashu wallet create`

Create a Cashu wallet on one mint

```
afpay cashu wallet create [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --cashu-mint <URL> [--label <LABEL>] [--mnemonic-secret <SOURCE>] [--idempotency-key <KEY>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--cashu-mint` | Cashu mint URL |
| `--label` | Optional wallet label |
| `--mnemonic-secret` | Existing BIP39 mnemonic to restore this wallet from (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and body reports the wallet the first call created instead of generating a second key |

### `afpay cashu wallet dangerously-show-seed`

Reveal the Cashu wallet seed; output is deliberately unredacted

```
afpay cashu wallet dangerously-show-seed [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay cashu wallet list`

List Cashu wallets

```
afpay cashu wallet list [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |

### `afpay cashu wallet restore`

Restore lost proofs from the mint, repairing counter or proof drift

```
afpay cashu wallet restore [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay container install`

Build the image if missing, run the daemon, and print the client command

#### `container-install-release` — Download the prebuilt release image pinned to this binary

```
afpay container install [--runtime <apple|podman|docker>] [--name <NAME>] [--port <PORT>] [--with <phoenixd|bitcoind>...] [--allow <CATEGORY=URL>...] [--btc-network <mainnet|signet>] [--btc-rpc-port <PORT>] [--btc-prune-mb <MB>] [--rebuild] [--reveal-daemon-secret]
```

#### `container-install-from-source` — Compile from a checkout; only this shape accepts --features and --context

```
afpay container install [--runtime <apple|podman|docker>] [--name <NAME>] [--port <PORT>] [--with <phoenixd|bitcoind>...] [--allow <CATEGORY=URL>...] [--btc-network <mainnet|signet>] [--btc-rpc-port <PORT>] [--btc-prune-mb <MB>] --from-source [--features <FEATURES>] [--context <DIR>] [--reveal-daemon-secret]
```

#### Shared defaults

If omitted, `--btc-network` = `mainnet`, `--btc-prune-mb` = `550`, `--btc-rpc-port` = `8332`, `--name` = `afpay`, `--port` = `9401`.

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--runtime` | Container runtime; auto-detected when omitted |
| `--name` | Container name |
| `--port` | Daemon port, published on 127.0.0.1 |
| `--with` | Bundled daemon to install and enable |
| `--allow` | Operator allowlist entry; a public listener refuses to start without one. Categories: mint, esplora, sol-rpc, evm-rpc, btc-core, btc-electrum, ln |
| `--btc-network` | Bitcoin network when --with bitcoind |
| `--btc-rpc-port` | bitcoind RPC port when --with bitcoind |
| `--btc-prune-mb` | bitcoind prune target when --with bitcoind |
| `--rebuild` | Rebuild the image even when it already exists |
| `--from-source` | Compile the image from a source checkout instead of the prebuilt release |
| `--features` | Cargo feature set for the source build |
| `--context` | Source checkout to build from |
| `--reveal-daemon-secret` | Print the generated daemon credential and the credential-bearing client command |

### `afpay container logs`

Stream the container logs, unchanged

```
afpay container logs [--runtime <apple|podman|docker>] [--name <NAME>] [--follow]
```

Output: raw bytes on success; rejects `--output` and `--output-to`; redirect with `--stdout-file` or `--stderr-file`. Failures are still strict JSON on stderr.

If omitted, `--name` = `afpay`.

| Argument | Meaning |
|---|---|
| `--runtime` | Container runtime; auto-detected when omitted |
| `--name` | Container name |
| `--follow` | Keep streaming as new lines arrive |

### `afpay container status`

Report whether the daemon is running, with its endpoint and client command

```
afpay container status [--runtime <apple|podman|docker>] [--name <NAME>] [--port <PORT>] [--reveal-daemon-secret]
```

If omitted, `--name` = `afpay`, `--port` = `9401`.

| Argument | Meaning |
|---|---|
| `--runtime` | Container runtime; auto-detected when omitted |
| `--name` | Container name |
| `--port` | Daemon port, published on 127.0.0.1 |
| `--reveal-daemon-secret` | Print the generated daemon credential and the credential-bearing client command |

### `afpay container uninstall`

Stop and remove the container; --purge also drops the image and cache

```
afpay container uninstall [--runtime <apple|podman|docker>] [--name <NAME>] [--purge]
```

If omitted, `--name` = `afpay`.

| Argument | Meaning |
|---|---|
| `--runtime` | Container runtime; auto-detected when omitted |
| `--name` | Container name |
| `--purge` | Also remove the built image and the cached context |

### `afpay evm backup`

Back up EVM wallet data to a .tar.zst archive

```
afpay evm backup [--data-dir <DIR>] [--archive-out <PATH>] [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--archive-out` | Archive path (default: ./afpay-evm-<epoch>.tar.zst) |
| `--wallet` | Wallet ID (omit to back up every EVM wallet) |

### `afpay evm balance`

EVM balance

```
afpay evm balance [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (omit to show every EVM wallet) |

### `afpay evm config set`

Update one EVM wallet's settings

```
afpay evm config set [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--label <LABEL>] [--evm-rpc-endpoint <URL>...] [--chain-id <ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--label` | New wallet label |
| `--evm-rpc-endpoint` | Replace the EVM JSON-RPC endpoints, in failover order |
| `--chain-id` | EVM chain ID |

### `afpay evm config show`

Show one EVM wallet's configuration

```
afpay evm config show [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay evm config token-add`

Register a custom EVM token for balance tracking

```
afpay evm config token-add [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> --symbol <SYMBOL> --address <ADDRESS> [--decimals <N>]
```

If omitted, `--decimals` = `6`.

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--symbol` | Token symbol, e.g. dai |
| `--address` | Token contract or mint address |
| `--decimals` | Token decimals |

### `afpay evm config token-remove`

Unregister a custom EVM token

```
afpay evm config token-remove [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> --symbol <SYMBOL>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--symbol` | Token symbol to remove |

### `afpay evm limit add`

Add a EVM network or wallet spend limit

```
afpay evm limit add [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] --window <DURATION> --max-spend <AMOUNT> [--token <TOKEN>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID; omit for a limit covering the whole network |
| `--window` | Rolling window, e.g. 30m, 1h, 24h, 7d |
| `--max-spend` | Maximum spend in base units |
| `--token` | Token the limit applies to |

### `afpay evm receive`

Show the wallet's receive address

```
afpay evm receive [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] [--onchain-memo <TEXT>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (auto-selected if omitted) |
| `--onchain-memo` | Memo recorded with the request |

### `afpay evm restore`

Restore EVM wallet data from a .tar.zst archive

```
afpay evm restore <ARCHIVE> [--data-dir <DIR>] [--dangerously-overwrite] [--pg-url-secret <SOURCE>]
```

| Argument | Meaning |
|---|---|
| `ARCHIVE` | Path to the backup archive |
| `--data-dir` | Wallet and data directory |
| `--dangerously-overwrite` | Clear existing data before restoring instead of merging |
| `--pg-url-secret` | Override the PostgreSQL connection URL for the pg restore step (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |

### `afpay evm send`

Send the chain's native token or an ERC-20

```
afpay evm send [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --to <ADDRESS> --amount <BASE_UNITS> --token <TOKEN> [--chain-id <ID>] [--wallet <WALLET_ID>] [--onchain-memo <TEXT>] [--local-memo <KEY=VALUE>...]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--to` | Recipient address (0x…) |
| `--amount` | Amount in base units (wei for ETH) |
| `--token` | `native`, or a registered token symbol |
| `--chain-id` | Pin the chain; a mismatched wallet returns wrong_chain |
| `--wallet` | Source wallet ID (auto-selected if omitted) |
| `--onchain-memo` | On-chain memo, sent with the transaction |
| `--local-memo` | Local bookkeeping annotation; bare text is stored as note=<text> |

### `afpay evm wallet close`

Close a EVM wallet

```
afpay evm wallet close [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--dangerously-skip-balance-check-and-may-lose-money]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--dangerously-skip-balance-check-and-may-lose-money` | Close even if the wallet still holds funds |

### `afpay evm wallet create`

Create an EVM chain wallet

```
afpay evm wallet create [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --evm-rpc-endpoint <URL>... [--chain-id <ID>] [--label <LABEL>] [--idempotency-key <KEY>]
```

If omitted, `--chain-id` = `8453`.

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--evm-rpc-endpoint` | EVM JSON-RPC endpoint; repeat to set the failover order |
| `--chain-id` | EVM chain ID |
| `--label` | Optional wallet label |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and body reports the wallet the first call created instead of generating a second key |

### `afpay evm wallet dangerously-show-seed`

Reveal the EVM wallet seed; output is deliberately unredacted

```
afpay evm wallet dangerously-show-seed [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay evm wallet list`

List EVM wallets

```
afpay evm wallet list [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |

### `afpay global backup`

Back up every network's data to a .tar.zst archive

```
afpay global backup [--data-dir <DIR>] [--archive-out <PATH>] [--extra-dir <LABEL=/path>...]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--archive-out` | Archive path (default: ./afpay-global-<epoch>.tar.zst) |
| `--extra-dir` | Also archive this directory under LABEL |

### `afpay global config get`

Read the runtime configuration, or one value by dot-path

```
afpay global config get [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [<KEY>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `KEY` | Dot-path key, e.g. log or exchange_rate.ttl_s; omit to show everything |

### `afpay global config set`

Set one runtime configuration value

```
afpay global config set [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] <KEY> [<VALUE>...]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `KEY` | Dot-path key |
| `VALUE` | Value, or repeated values for a list-valued key |

### `afpay global limit add`

Add a global spend limit, in USD cents

```
afpay global limit add [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --window <DURATION> --max-spend <CENTS>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--window` | Rolling window, e.g. 30m, 1h, 24h, 7d |
| `--max-spend` | Maximum spend in USD cents |

### `afpay global restore`

Restore every network's data from a .tar.zst archive

```
afpay global restore <ARCHIVE> [--data-dir <DIR>] [--dangerously-overwrite] [--pg-url-secret <SOURCE>] [--extra-dir <LABEL=/path>...]
```

| Argument | Meaning |
|---|---|
| `ARCHIVE` | Path to the backup archive |
| `--data-dir` | Wallet and data directory |
| `--dangerously-overwrite` | Clear existing data before restoring instead of merging |
| `--pg-url-secret` | Override the PostgreSQL connection URL for the pg restore step (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--extra-dir` | Also restore this directory from LABEL |

### `afpay history list`

List history records from the local store

```
afpay history list [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] [--network <cashu|ln|sol|evm|btc>] [--onchain-memo <TEXT>] [--limit <N>] [--offset <N>] [--since-epoch-s <EPOCH>] [--until-epoch-s <EPOCH>]
```

If omitted, `--limit` = `20`, `--offset` = `0`.

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Filter by wallet ID |
| `--network` | Restrict to one network |
| `--onchain-memo` | Filter by exact on-chain memo |
| `--limit` | Maximum records returned |
| `--offset` | Records to skip |
| `--since-epoch-s` | Only records created at or after this epoch second |
| `--until-epoch-s` | Only records created before this epoch second |

### `afpay history status`

Report one transaction's current status

```
afpay history status [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --transaction-id <TX_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--transaction-id` | Transaction ID |

### `afpay history update`

Incrementally sync backend history into the local store

```
afpay history update [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] [--network <cashu|ln|sol|evm|btc>] [--limit <N>]
```

If omitted, `--limit` = `200`.

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Sync one wallet (default: every wallet in scope) |
| `--network` | Restrict to one network |
| `--limit` | Maximum records scanned per wallet |

### `afpay limit list`

Show every spend-limit rule and its usage

```
afpay limit list [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |

### `afpay limit reconcile`

Force a stuck spend-ledger reservation to a terminal state (operator-only)

#### `limit-reconcile-confirm` — Record the spend: the payment actually succeeded

```
afpay limit reconcile [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --reservation-id <ID> --confirm --reason <TEXT>
```

#### `limit-reconcile-cancel` — Release the reservation: the payment did not happen

```
afpay limit reconcile [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --reservation-id <ID> --cancel --reason <TEXT>
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--reservation-id` | Reservation ID |
| `--confirm` | The payment did settle |
| `--cancel` | The payment did not settle |
| `--reason` | Audit note (1..=512 chars) explaining the forced outcome |

### `afpay limit remove`

Remove a spend-limit rule by ID

```
afpay limit remove [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --rule-id <RULE_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--rule-id` | Rule ID, e.g. r_1a2b3c4d |

### `afpay ln backup`

Back up Lightning wallet data to a .tar.zst archive

```
afpay ln backup [--data-dir <DIR>] [--archive-out <PATH>] [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--archive-out` | Archive path (default: ./afpay-ln-<epoch>.tar.zst) |
| `--wallet` | Wallet ID (omit to back up every Lightning wallet) |

### `afpay ln balance`

Lightning balance

```
afpay ln balance [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (omit to show every Lightning wallet) |

### `afpay ln config set`

Update one Lightning wallet's settings

```
afpay ln config set [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--label <LABEL>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--label` | New wallet label |

### `afpay ln config show`

Show one Lightning wallet's configuration

```
afpay ln config show [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay ln limit add`

Add a Lightning network or wallet spend limit

```
afpay ln limit add [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] --window <DURATION> --max-spend <AMOUNT>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID; omit for a limit covering the whole network |
| `--window` | Rolling window, e.g. 30m, 1h, 24h, 7d |
| `--max-spend` | Maximum spend in base units |

### `afpay ln receive`

Create a BOLT11 invoice, or return the reusable BOLT12 offer

#### `ln-receive` — Return the receive address or invoice and exit

```
afpay ln receive [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] [--qr-svg-file] [--idempotency-key <KEY>] [--amount-sats <SATS>]
```

#### `ln-receive-wait` — Block until a matching payment settles; only this shape describes the wait

```
afpay ln receive [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] --wait [--wait-timeout-s <SECONDS>] [--wait-poll-interval-ms <MS>] [--qr-svg-file] [--idempotency-key <KEY>] [--amount-sats <SATS>]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (auto-selected if omitted) |
| `--wait` | Block until a matching payment settles |
| `--wait-timeout-s` | Give up waiting after N seconds |
| `--wait-poll-interval-ms` | Poll interval while waiting |
| `--qr-svg-file` | Write the receive QR payload to an SVG file |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and body returns the receive already placed instead of minting a second invoice |
| `--amount-sats` | Amount in sats; omit for a BOLT12 offer |

### `afpay ln restore`

Restore Lightning wallet data from a .tar.zst archive

```
afpay ln restore <ARCHIVE> [--data-dir <DIR>] [--dangerously-overwrite] [--pg-url-secret <SOURCE>]
```

| Argument | Meaning |
|---|---|
| `ARCHIVE` | Path to the backup archive |
| `--data-dir` | Wallet and data directory |
| `--dangerously-overwrite` | Clear existing data before restoring instead of merging |
| `--pg-url-secret` | Override the PostgreSQL connection URL for the pg restore step (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |

### `afpay ln send`

Pay a BOLT11 invoice or a BOLT12 offer. Lightning carries no on-chain memo, so annotate with --local-memo

```
afpay ln send [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --to <INVOICE> [--amount-sats <SATS>] [--wallet <WALLET_ID>] [--local-memo <KEY=VALUE>...]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--to` | BOLT11 invoice or BOLT12 offer (lno1…) |
| `--amount-sats` | Amount in sats; required for a BOLT12 offer, rejected for BOLT11 |
| `--wallet` | Source wallet ID (auto-selected if omitted) |
| `--local-memo` | Local bookkeeping annotation; bare text is stored as note=<text> |

### `afpay ln wallet close`

Close a Lightning wallet

```
afpay ln wallet close [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--dangerously-skip-balance-check-and-may-lose-money]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--dangerously-skip-balance-check-and-may-lose-money` | Close even if the wallet still holds funds |

### `afpay ln wallet create`

Create a Lightning wallet

#### `ln-wallet-create-nwc` — Nostr Wallet Connect; authenticates with a connection URI

```
afpay ln wallet create [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --backend nwc --nwc-uri-secret <SOURCE> [--label <LABEL>] [--idempotency-key <KEY>]
```

#### `ln-wallet-create-phoenixd` — phoenixd; authenticates with an endpoint and HTTP password

```
afpay ln wallet create [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --backend phoenixd --endpoint-url <URL> --password-secret <SOURCE> [--label <LABEL>] [--idempotency-key <KEY>]
```

#### `ln-wallet-create-lnbits` — LNbits; authenticates with an endpoint and admin API key

```
afpay ln wallet create [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --backend lnbits --endpoint-url <URL> --admin-key-secret <SOURCE> [--label <LABEL>] [--idempotency-key <KEY>]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--backend` | Lightning backend this wallet talks to |
| `--nwc-uri-secret` | NWC connection URI (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--endpoint-url` | Backend HTTP endpoint |
| `--password-secret` | phoenixd HTTP password (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--admin-key-secret` | LNbits admin API key (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--label` | Optional wallet label |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and body reports the wallet the first call created instead of generating a second key |

### `afpay ln wallet dangerously-show-seed`

Reveal the Lightning wallet seed; output is deliberately unredacted

```
afpay ln wallet dangerously-show-seed [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay ln wallet list`

List Lightning wallets

```
afpay ln wallet list [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |

### `afpay pay confirm`

Pay by confirming a plan a `send` resolved — the only command that moves money

```
afpay pay confirm [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --plan-id <PLAN_ID> [--idempotency-key <KEY>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--plan-id` | The plan_id a `send` returned. Single-use, and refused once it expires or the terms it was resolved against change |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and plan replays the first response instead of paying twice |

### `afpay skill install`

Install the Agent-First Pay skill

#### `skill-install-standard` — Install into the standard skill folders

```
afpay skill install [--scope <personal|workspace>] [--force]
```

If omitted, `--scope` = `personal`.

#### `skill-install-directory` — Install into one skills directory

```
afpay skill install --skills-dir <PATH> [--force]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--scope` | Standard folders under the home directory (personal) or the current directory (workspace) |
| `--skills-dir` | One skills directory to use instead of the standard folders |
| `--force` | Overwrite or remove a skill at the target path that afpay did not install |

### `afpay skill status`

Report whether the Agent-First Pay skill is installed, valid, and current

#### `skill-status-standard` — Report on the standard skill folders

```
afpay skill status [--scope <personal|workspace>]
```

If omitted, `--scope` = `personal`.

#### `skill-status-directory` — Report on one skills directory

```
afpay skill status --skills-dir <PATH>
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--scope` | Standard folders under the home directory (personal) or the current directory (workspace) |
| `--skills-dir` | One skills directory to use instead of the standard folders |

### `afpay skill uninstall`

Remove the Agent-First Pay skill that afpay installed

#### `skill-uninstall-standard` — Remove from the standard skill folders

```
afpay skill uninstall [--scope <personal|workspace>] [--force]
```

If omitted, `--scope` = `personal`.

#### `skill-uninstall-directory` — Remove from one skills directory

```
afpay skill uninstall --skills-dir <PATH> [--force]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--scope` | Standard folders under the home directory (personal) or the current directory (workspace) |
| `--skills-dir` | One skills directory to use instead of the standard folders |
| `--force` | Overwrite or remove a skill at the target path that afpay did not install |

### `afpay sol backup`

Back up Solana wallet data to a .tar.zst archive

```
afpay sol backup [--data-dir <DIR>] [--archive-out <PATH>] [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--archive-out` | Archive path (default: ./afpay-sol-<epoch>.tar.zst) |
| `--wallet` | Wallet ID (omit to back up every Solana wallet) |

### `afpay sol balance`

Solana balance

```
afpay sol balance [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (omit to show every Solana wallet) |

### `afpay sol config set`

Update one Solana wallet's settings

```
afpay sol config set [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--label <LABEL>] [--sol-rpc-endpoint <URL>...]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--label` | New wallet label |
| `--sol-rpc-endpoint` | Replace the Solana JSON-RPC endpoints, in failover order |

### `afpay sol config show`

Show one Solana wallet's configuration

```
afpay sol config show [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay sol config token-add`

Register a custom Solana token for balance tracking

```
afpay sol config token-add [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> --symbol <SYMBOL> --address <ADDRESS> [--decimals <N>]
```

If omitted, `--decimals` = `6`.

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--symbol` | Token symbol, e.g. dai |
| `--address` | Token contract or mint address |
| `--decimals` | Token decimals |

### `afpay sol config token-remove`

Unregister a custom Solana token

```
afpay sol config token-remove [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> --symbol <SYMBOL>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--symbol` | Token symbol to remove |

### `afpay sol limit add`

Add a Solana network or wallet spend limit

```
afpay sol limit add [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] --window <DURATION> --max-spend <AMOUNT> [--token <TOKEN>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID; omit for a limit covering the whole network |
| `--window` | Rolling window, e.g. 30m, 1h, 24h, 7d |
| `--max-spend` | Maximum spend in base units |
| `--token` | Token the limit applies to |

### `afpay sol receive`

Show the wallet's receive address

#### `sol-receive` — Return the receive address or invoice and exit

```
afpay sol receive [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] [--qr-svg-file] [--idempotency-key <KEY>]
```

#### `sol-receive-wait` — Block until a matching payment settles; only this shape describes the wait

```
afpay sol receive [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--wallet <WALLET_ID>] --wait [--wait-timeout-s <SECONDS>] [--wait-poll-interval-ms <MS>] [--qr-svg-file] [--idempotency-key <KEY>] [--onchain-memo <TEXT>] [--min-confirmations <N>] [--reference <KEY>]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID (auto-selected if omitted) |
| `--wait` | Block until a matching payment settles |
| `--wait-timeout-s` | Give up waiting after N seconds |
| `--wait-poll-interval-ms` | Poll interval while waiting |
| `--qr-svg-file` | Write the receive QR payload to an SVG file |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and body returns the receive already placed instead of minting a second invoice |
| `--onchain-memo` | On-chain memo to watch for |
| `--min-confirmations` | Confirmation depth before the payment counts as settled |
| `--reference` | Reference key to watch for (base58) |

### `afpay sol restore`

Restore Solana wallet data from a .tar.zst archive

```
afpay sol restore <ARCHIVE> [--data-dir <DIR>] [--dangerously-overwrite] [--pg-url-secret <SOURCE>]
```

| Argument | Meaning |
|---|---|
| `ARCHIVE` | Path to the backup archive |
| `--data-dir` | Wallet and data directory |
| `--dangerously-overwrite` | Clear existing data before restoring instead of merging |
| `--pg-url-secret` | Override the PostgreSQL connection URL for the pg restore step (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |

### `afpay sol send`

Send SOL or an SPL token

```
afpay sol send [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --to <ADDRESS> --amount <BASE_UNITS> --token <TOKEN> [--reference <KEY>] [--wallet <WALLET_ID>] [--onchain-memo <TEXT>] [--local-memo <KEY=VALUE>...]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--to` | Recipient Solana address (base58) |
| `--amount` | Amount in base units (lamports for SOL) |
| `--token` | `native` for SOL, or a registered token symbol |
| `--reference` | Reference key for order binding (base58-encoded 32 bytes) |
| `--wallet` | Source wallet ID (auto-selected if omitted) |
| `--onchain-memo` | On-chain memo, sent with the transaction |
| `--local-memo` | Local bookkeeping annotation; bare text is stored as note=<text> |

### `afpay sol wallet close`

Close a Solana wallet

```
afpay sol wallet close [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID> [--dangerously-skip-balance-check-and-may-lose-money]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |
| `--dangerously-skip-balance-check-and-may-lose-money` | Close even if the wallet still holds funds |

### `afpay sol wallet create`

Create a Solana wallet

```
afpay sol wallet create [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --sol-rpc-endpoint <URL>... [--label <LABEL>] [--sol-cluster <mainnet-beta|devnet|testnet>] [--idempotency-key <KEY>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--sol-rpc-endpoint` | Solana JSON-RPC endpoint; repeat to set the failover order |
| `--label` | Optional wallet label |
| `--sol-cluster` | Intended cluster; plans warn when RPC hostname evidence differs |
| `--idempotency-key` | Opaque key (≤128 chars); a repeat with the same key and body reports the wallet the first call created instead of generating a second key |

### `afpay sol wallet dangerously-show-seed`

Reveal the Solana wallet seed; output is deliberately unredacted

```
afpay sol wallet dangerously-show-seed [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] --wallet <WALLET_ID>
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--wallet` | Wallet ID |

### `afpay sol wallet list`

List Solana wallets

```
afpay sol wallet list [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |

### `afpay ui receive`

Open a panel showing the receive address or invoice as a code to scan

#### `ui-receive-cashu` — A Lightning invoice that mints Cashu proofs when paid

```
afpay ui receive [--data-dir <DIR>] [--log <FILTER>...] --network cashu [--mode <window|link|session>] [--safe-mode] [--wallet <WALLET_ID>] [--idempotency-key <KEY>] [--amount-sats <SATS>] [--onchain-memo <TEXT>]
```

#### `ui-receive-ln` — A BOLT11 invoice, or the reusable BOLT12 offer

```
afpay ui receive [--data-dir <DIR>] [--log <FILTER>...] --network ln [--mode <window|link|session>] [--safe-mode] [--wallet <WALLET_ID>] [--idempotency-key <KEY>] [--amount-sats <SATS>]
```

#### `ui-receive-sol` — The wallet's Solana receive address

```
afpay ui receive [--data-dir <DIR>] [--log <FILTER>...] --network sol [--mode <window|link|session>] [--safe-mode] [--wallet <WALLET_ID>] [--idempotency-key <KEY>]
```

#### `ui-receive-evm` — The wallet's EVM receive address

```
afpay ui receive [--data-dir <DIR>] [--log <FILTER>...] --network evm [--mode <window|link|session>] [--safe-mode] [--wallet <WALLET_ID>] [--idempotency-key <KEY>] [--onchain-memo <TEXT>]
```

#### `ui-receive-btc` — The wallet's Bitcoin receive address

```
afpay ui receive [--data-dir <DIR>] [--log <FILTER>...] --network btc [--mode <window|link|session>] [--safe-mode] [--wallet <WALLET_ID>] [--idempotency-key <KEY>]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--network` | Network to be paid on |
| `--mode` | How this reaches the person: window a browser window is open on this machine; link the page is reachable from this machine's network at the link URL; session the session is registered only; open it with `afui host open` or reach it through `afui host serve`. Defaults to session when AFUI_LAUNCH_FILE supplies a registry, or window otherwise |
| `--safe-mode` | Use the built-in panel frontend |
| `--wallet` | Wallet ID (auto-selected if omitted) |
| `--idempotency-key` | Opaque key (≤128 chars); create a receive request |
| `--amount-sats` | Amount in sats |
| `--onchain-memo` | Memo recorded with the request |

### `afpay ui send`

Open a panel showing a resolved payment and wait for a person to approve it

#### `ui-send-cashu` — Melt Cashu proofs to pay a Lightning invoice

```
afpay ui send [--data-dir <DIR>] [--log <FILTER>...] --network cashu [--mode <window|session>] [--safe-mode] --to <DESTINATION> [--wallet <WALLET_ID>] [--onchain-memo <TEXT>] [--local-memo <KEY=VALUE>...]
```

#### `ui-send-ln` — Pay a BOLT11 invoice or a BOLT12 offer

```
afpay ui send [--data-dir <DIR>] [--log <FILTER>...] --network ln [--mode <window|session>] [--safe-mode] --to <DESTINATION> [--amount-sats <SATS>] [--wallet <WALLET_ID>] [--local-memo <KEY=VALUE>...]
```

#### `ui-send-sol` — Send SOL or an SPL token

```
afpay ui send [--data-dir <DIR>] [--log <FILTER>...] --network sol [--mode <window|session>] [--safe-mode] --to <DESTINATION> --amount <BASE_UNITS> --token <TOKEN> [--reference <KEY>] [--wallet <WALLET_ID>] [--onchain-memo <TEXT>] [--local-memo <KEY=VALUE>...]
```

#### `ui-send-evm` — Send the chain's native token or an ERC-20

```
afpay ui send [--data-dir <DIR>] [--log <FILTER>...] --network evm [--mode <window|session>] [--safe-mode] --to <DESTINATION> --amount <BASE_UNITS> --token <TOKEN> [--chain-id <ID>] [--wallet <WALLET_ID>] [--onchain-memo <TEXT>] [--local-memo <KEY=VALUE>...]
```

#### `ui-send-btc` — Send BTC on-chain

```
afpay ui send [--data-dir <DIR>] [--log <FILTER>...] --network btc [--mode <window|session>] [--safe-mode] --to <DESTINATION> --amount-sats <SATS> [--wallet <WALLET_ID>] [--onchain-memo <TEXT>] [--local-memo <KEY=VALUE>...]
```

Arguments across every shape above:

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--network` | Network the payment leaves on |
| `--mode` | How this reaches the person: window a browser window is open on this machine; session the session is registered only; open it with `afui host open` or reach it through `afui host serve`. Defaults to session when AFUI_LAUNCH_FILE supplies a registry, or window otherwise |
| `--safe-mode` | Use the built-in panel frontend |
| `--to` | Recipient address, BOLT11 invoice, or BOLT12 offer |
| `--amount` | Amount in base units (lamports for SOL, wei for ETH) |
| `--amount-sats` | Amount in satoshis |
| `--token` | `native`, or a registered token symbol |
| `--reference` | Reference key for order binding (base58-encoded 32 bytes) |
| `--chain-id` | Pin the chain; a mismatched wallet returns wrong_chain |
| `--wallet` | Source wallet ID (auto-selected if omitted) |
| `--onchain-memo` | On-chain memo, sent with the transaction |
| `--local-memo` | Local bookkeeping annotation; bare text is stored as note=<text> |

### `afpay ui wallet`

Open a panel showing every wallet and its balance

```
afpay ui wallet [--data-dir <DIR>] [--log <FILTER>...] [--wallet <WALLET_ID>] [--network <cashu|ln|sol|evm|btc>] [--cashu-check] [--mode <window|link|session>] [--safe-mode]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--wallet` | Wallet ID (omit to show every wallet) |
| `--network` | Restrict to one network |
| `--cashu-check` | Verify Cashu proofs against the mint; slower but authoritative |
| `--mode` | How this reaches the person: window a browser window is open on this machine; link the page is reachable from this machine's network at the link URL; session the session is registered only; open it with `afui host open` or reach it through `afui host serve`. Defaults to session when AFUI_LAUNCH_FILE supplies a registry, or window otherwise |
| `--safe-mode` | Use the built-in panel frontend |

### `afpay wallet list`

List wallets across every network

```
afpay wallet list [--data-dir <DIR>] [--log <FILTER>...] [--peer-url <URL>] [--peer-api-key-secret <SOURCE>] [--dry-run] [--network <cashu|ln|sol|evm|btc>]
```

| Argument | Meaning |
|---|---|
| `--data-dir` | Wallet and data directory |
| `--log` | Log filter to enable; repeat, or pass a comma-separated list |
| `--peer-url` | Run this command on another afpay node instead of locally |
| `--peer-api-key-secret` | The peer's --access-token-secret; required with --peer-url (the value, or where to read it: env:NAME, file[+FORMAT]:PATH[#DOT_PATH], literal:VALUE) |
| `--dry-run` | Preview the command without executing it |
| `--network` | Restrict to one network |

## Exit codes

| Code | Meaning |
|---|---|
| 0 | The command ran and succeeded. |
| 1 | The command ran and failed. The event carries a domain `error.code`. |
| 2 | The invocation was rejected before anything ran. `error.code` is one of the `cli_*` codes below. |
| 4 | Output could not be written (`output_write_failed`); a closed reader is success. |

The split is the useful one for a caller: exit 2 means the call was never made, so retrying it unchanged cannot help, while exit 1 means it was.

## CLI errors

Every structural failure emits one strict JSON `kind:"error"` event on stderr, leaves stdout empty, and exits 2. The `code` names the failure — `cli_unknown_argument` for an unknown spelling, `cli_unregistered_combination` for registered arguments in a mixture that is not, and one each for `cli_unknown_command`, `cli_missing_argument_value`, `cli_invalid_argument_value`, `cli_duplicate_argument`, `cli_unexpected_positional`, and `cli_invalid_utf8`. `message` identifies a safe argument spelling or the failure category and `hint` gives the command to run next; neither ever quotes a raw value, including secrets. These are decided before any config, secret source, filesystem, network, or domain I/O.

`cli_invocation_invalid` (exit 1) describes the tool itself rather than the call: the program misread its own resolved invocation — an unknown action id, or an argument id the selected combination cannot produce. It is a defect to report, not an input to correct; retrying the same command cannot help. `output_setup_failed` (exit 1) means an output sink (`--stdout-file`, `--stderr-file`, stream redirection) could not be established; the message names the flag and path, which is usually a missing directory or a permission to fix.

A tool may also exit 2 with a code of its own for a usage error its argument grammar cannot express — two arguments that are each valid but cannot be combined, or a value whose meaning depends on the target. Such a call is likewise refused before anything is changed.

Domain failures (exit 1) carry their own stable `error.code` instead, drawn from whatever this tool defines rather than from the `cli_*` set. Error events are routinely logged, so a message never quotes a value that came from an argument able to carry a credential — a header, a cookie, a token, a password, a proxy URL, an environment value, a form field. Such an error names the argument and the shape that was wrong, and stops there. A value that cannot be a secret — a path, a dot-path, a session name — is quoted, because an error that cannot say which one it means is not worth logging either.
