rail402 command, every global flag, the machine-readable --json shape, and how the CLI decides which facilitator to talk to.
This is the reference for @rail402.dev/cli, which ships the rail402 binary.
CLI amounts are decimals in the asset’s units.
--max 0.10 is 0.10 USDC. This is the opposite of the SDK, where amounts are atomic-unit strings.Commands
Global flags
Command options
--max is a decimal in the asset’s units, so --max 0.10 is 0.10 USDC. It is required on every paying command (buy, pay).
The —json envelope
Pass--json to any command for a single structured object. It is the same envelope on success and on failure, so an agent can branch on ok.
- Success
- Failure
error carries a machine-readable code, a non-null reason, and a retryable flag. Branch on code, never on the reason text. See Error registry. Common codes: mcp_budget_required (you omitted --max), mcp_budget_exceeded (price above the cap), config_no_signer (no RAIL402_SECRET).
Configuration precedence
Every endpoint defaults to Rail402’s hosted testnet infrastructure, and every one is overridable, so the same binary drives your own self-hosted facilitator or explorer. Precedence, highest first:- a command-line flag (
--facilitator,--network, …), - an environment variable (
RAIL402_SECRET, and the endpoint overrides), - the saved config at
~/.rail402/config.json, - the built-in default (
https://facilitator.rail402.dev,stellar:testnet).
Next steps
Buyer quickstart
Fund, discover, and pay from the terminal.
SDK reference
The same operations as library calls.
Error registry
Codes that appear in the
--json error object.Packages
Where the CLI sits among the packages.