Skip to main content

x402-only model

The CLI is x402-only. It does not send an x-api-key header, and it ignores BRICKKEN_API_KEY / BKN_API_KEY if they are set. Preparing a transaction is free; the send is paid through x402:
  1. The CLI prepares a transaction with /prepare-transactions (free).
  2. On send, the API responds 402 Payment Required with a PAYMENT-REQUIRED header.
  3. The CLI signs the x402 payment locally and retries with an X-PAYMENT header.
In the recommended brickken-relayed mode the private key signs only the x402 payment — Brickken’s relayer signs and broadcasts the operation. In the default client-signed mode the same key also signs the blockchain transaction locally.
Your private key never leaves your machine. Treat it as a secret: prefer an .env file or environment variable over passing --private-key inline.

Provide a private key

BKN_PRIVATE_KEY is accepted as an alias.

Environments and base URLs

Select the environment with --env or BRICKKEN_ENV (default: sandbox): Override the base URL directly with --base-url or BRICKKEN_BASE_URL when needed.
The CLI’s default sandbox base URL is https://api.sandbox.brickken.com. Some older API Reference pages show https://api-sandbox.brickken.com — use the value above for the CLI.

Networks and chain IDs

Pass the target chain with --chain. Both decimal and hex forms are accepted, and common decimal IDs are normalized automatically — for example Base Sepolia can be passed as 84532 or 14a34.

RPC URL

Some commands (notably create-token) wait for the deployment receipt to read back the deployed tokenAddress. Set an RPC for the target chain:
BKN_RPC_URL is accepted as an alias, or use --rpc-url.

Configuration precedence

Configuration is resolved in this order (highest priority first):
  1. Command-line flags--env, --base-url, --private-key, --rpc-url, --env-file, --json
  2. Environment variablesBRICKKEN_* or BKN_*
  3. .env file in the current working directory (or the path given by --env-file)
  4. Defaultssandbox environment, client-signed execution mode (pass --execution-mode brickken-relayed to opt into relayed)

Global flags

Environment variables

Budget note

Preparing is free; only the send is x402-priced. On Base Sepolia and other non-production environments the reference price is 0.01 USDC per send. Fund the wallet behind BRICKKEN_PRIVATE_KEY with enough USDC on the x402 payment chain (Circle USDC 0x036CbD53842c5426634e7929541eC2318f3dCF7e on Base Sepolia). See Pricing for the mainnet per-operation table.