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
Names must be alphanumeric, hyphens, or underscores — max 47 characters. Examples: weather, crypto-prices, sentiment_v2.
bankr x402 configure <name>
Interactive wizard to set pricing, description, currency, and network for a service.
bankr x402 configure weather
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:
- Reads your TypeScript handler source
- Sends it to Bankr for server-side bundling and security sandboxing
- Registers the endpoint and makes it live
Deploys are rate-limited to 20 per hour.
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 typing delete to confirm.
bankr x402 delete weather
Environment Variables
bankr x402 env set KEY=VALUE
Sets an encrypted environment variable. Available as process.env.KEY in 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.
Keys must match ^[A-Za-z_][A-Za-z0-9_]{0,127}$. Certain reserved prefixes are rejected to avoid conflicts with the runtime.
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 2,340 reqs $1.989000 earned $0.351000 fees
Without a name, shows a summary of all endpoints.
Discovery & Inspection
bankr x402 search <query>
Search the x402 service marketplace. No authentication required.
bankr x402 search "weather data"
bankr x402 search "sentiment analysis"
Results show service name, description, method, price, network, and input/output schemas.
| Flag | Description |
|---|---|
--raw | Output 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.
| Flag | Description |
|---|---|
--raw | Output raw JSON (for piping or scripting) |
Calling Endpoints
bankr x402 call <url>
Call an x402-protected endpoint with automatic USDC payment from your Bankr wallet.
# 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
| Flag | Description |
|---|---|
-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) |
-i, --interactive | Fetch endpoint schema and prompt for input values |
-y, --yes | Skip payment confirmation |
--raw | Output raw JSON (unformatted) |
Interactive mode
When called with -i, the CLI:
- Fetches the endpoint's schema (same as
bankr x402 schema) - Prompts you for each input field with descriptions and types
- Shows the exact price from the endpoint's config
- 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 | Methods: POST | Network: base
location (string, required): Berkeley CA
query (string): 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.