Skip to main content

CLI Reference

All x402 Cloud commands are under bankr x402.

Setup​

bankr x402 init​

Scaffolds the x402/ directory and bankr.x402.json config file in the current directory.

bankr x402 init

bankr x402 add <name>​

Creates a new service handler at x402/<name>/index.ts with a starter template, and adds it to the config.

bankr x402 add weather
bankr x402 add sentiment-analysis
Service Name Rules

Names must be alphanumeric, hyphens, or underscores — max 47 characters. Examples: weather, crypto-prices, sentiment_v2.

bankr x402 configure <name>​

Interactive wizard to set description, price, network, HTTP method, and payment scheme (exact or upto) for a service.

bankr x402 configure weather

The wizard doesn't ask for a payment token. To price in a custom token, set tokenAddress in bankr.x402.json (the wizard leaves it in place) — see Custom Tokens.

Deployment​

bankr x402 deploy [name]​

Bundles and deploys your services. If no name is given, deploys all services in x402/.

bankr x402 deploy          # Deploy all
bankr x402 deploy weather # Deploy only weather

The CLI:

  1. Reads your TypeScript handler source
  2. Sends it to Bankr for server-side bundling and security sandboxing
  3. Registers the endpoint and makes it live
Rate Limit

Deploys are rate-limited to 20 per hour per IP address. A single deploy can include up to 25 services, with handler source capped at 1 MB per service.

A deploy is rejected if the source uses ctx. with anything other than files, appKV or askAgent (for example ctx.files.read, or your own variable named ctx) — the error names the method to use instead.

Management​

bankr x402 list​

Shows all your deployed endpoints with status, version, price, and request count.

bankr x402 list

bankr x402 pause <name>​

Temporarily stops an endpoint from serving requests. The endpoint returns 404 while paused.

bankr x402 pause weather

bankr x402 resume <name>​

Resumes a paused endpoint.

bankr x402 resume weather

bankr x402 delete <name>​

Permanently deletes an endpoint. Requires confirmation before proceeding.

bankr x402 delete weather

Environment Variables​

bankr x402 env set KEY=VALUE​

Sets an encrypted environment variable. Available as process.env.KEY in every one of your handlers.

bankr x402 env set WEATHER_API_KEY=sk-abc123
bankr x402 env set DB_URL=postgres://user:pass@host/db

Can be called before or after deploying. Values are encrypted at rest.

Key Validation

Keys must match ^[A-Za-z_][A-Za-z0-9_]{0,127}$. Keys with a reserved prefix such as BANKR_ are rejected to avoid conflicts with the runtime. Each value is capped at 4 KB.

bankr x402 env list​

Lists environment variable names (values are never shown).

bankr x402 env list
# Output:
# WEATHER_API_KEY
# DB_URL

bankr x402 env unset KEY​

Removes an environment variable.

bankr x402 env unset DB_URL

Revenue​

bankr x402 revenue [name]​

Shows earnings breakdown by time period.

bankr x402 revenue weather
# Output:
# Last 7 days 142 reqs $0.120600 earned $0.021200 fees
# Last 30 days 891 reqs $0.757350 earned $0.133650 fees
# All time 2340 reqs $1.989000 earned $0.351000 fees

earned is after the platform fee, in USD at each request's settlement-time value (see Custom Tokens for token-priced endpoints). Without a name, shows a summary of all endpoints.

Discovery & Inspection​

bankr x402 search <query>​

Search the x402 service marketplace. No authentication required. The same catalogue is browsable in the browser at bankr.bot/terminal/x402/discover.

bankr x402 search "weather data"
bankr x402 search "sentiment analysis"

Results show service name, description, method, price, network, and input/output schemas.

FlagDescription
--rawOutput raw JSON (for piping or scripting)
# Pipe to jq for programmatic use
bankr x402 search "crypto prices" --raw | jq '.[0].routes[0].schema'

bankr x402 schema <url>​

View the input/output schema for a Bankr x402 endpoint. No authentication required.

bankr x402 schema https://x402.bankr.bot/0xYourWallet/weather

Displays the endpoint's name, description, price, accepted methods, and typed JSON schema for inputs and outputs. Useful for understanding how to call an endpoint before making a paid request.

FlagDescription
--rawOutput raw JSON (for piping or scripting)

Calling Endpoints​

bankr x402 call <url>​

Call an x402-protected endpoint with automatic payment from your Bankr wallet. Bankr pays in whatever token the endpoint requires — USDC, or any other ERC-20 — on any supported chain. The --max-payment cap is always in USD, regardless of the payment token; a payment Bankr can't price in USD is refused rather than sent uncapped. If the endpoint's advertised price exceeds your cap, the call fails instead of paying more — re-run with a higher --max-payment to allow it. The advertised price can only lower the limit: after checking it, the CLI sends the smaller of that price and your cap (-y skips the check and sends your cap, which Bankr still enforces). Needs an API key with Wallet API access that isn't read-only.

# Basic GET request
bankr x402 call https://x402.bankr.bot/0xYourWallet/weather?city=London

# POST with JSON body
bankr x402 call https://x402.bankr.bot/0xYourWallet/sentiment -X POST -d '{"text": "hello world"}'

# Interactive mode — fetch the schema, prompt for each input field
bankr x402 call https://x402.bankr.bot/0xYourWallet/doordash -i
FlagDescription
-X, --method <method>HTTP method: GET, POST, PUT, DELETE (default: GET)
-d, --body <json>JSON request body
--max-payment <usd>Maximum payment in USD (default: 1, max: 10). Fails if the endpoint asks for more
-i, --interactiveFetch endpoint schema and prompt for input values
-y, --yesSkip payment confirmation
--rawOutput raw JSON (unformatted)

Interactive mode​

When called with -i, the CLI:

  1. Fetches the endpoint's schema (same as bankr x402 schema)
  2. Prompts you for each input field with descriptions and types
  3. Shows the exact price from the endpoint's config
  4. Asks for payment confirmation before submitting

This lets you call any x402 endpoint without knowing the API shape upfront — the schema tells you exactly what's needed.

$ bankr x402 call https://x402.bankr.bot/0xabc.../doordash -i

doordash
AI agent that searches DoorDash restaurants...
Price $0.03 USDC

? location (string): Berkeley CA
? query (string, optional): healthy dinner

? Submit with $0.03 USDC payment? Yes

{ "location": "Berkeley CA", "recommendations": [...] }

Config File​

See Config File for the full bankr.x402.json reference — fields, schema shapes, and examples.