Skip to main content

Install

npm install -g @boltzpay/cli
Or run directly without installing:
npx @boltzpay/cli <command> [options]

Global Flags

Every command accepts these flags:
FlagShortDescription
--json-jOutput as a structured JSON envelope
--verbose-vShow protocol and timing details
--debugFull request/response dump (to stderr)
--version-VPrint version number
--help-hPrint help text
boltzpay --json fetch https://invy.bot/api
boltzpay -v quote https://invy.bot/api

Commands

fetch

Detect the payment protocol, pay, and return the response body.
boltzpay fetch <url> [options]
FlagShortDefaultDescription
--method <m>-mGETHTTP method
--header <h>-HHeaders as key:value (repeatable)
--data <body>-dRequest body
--chain <c>-cForce chain (evm or svm)
Human output:
$ boltzpay fetch https://invy.bot/api

Payment
  Protocol:  x402
  Amount:    $0.05
  Tx Hash:   0xabc123...

Response
  URL:       https://invy.bot/api
  Status:    200
  Type:      application/json

Body
{"holdings": [...]}
JSON output:
{
  "success": true,
  "data": "{\"holdings\": [...]}",
  "payment": {
    "protocol": "x402",
    "amount": "$0.05",
    "currency": "USD",
    "txHash": "0xabc123..."
  },
  "metadata": { "url": "https://invy.bot/api", "status": 200, "duration": 2345 }
}

quote

Check the cost of a paid endpoint without paying. No credentials needed.
boltzpay quote <url>
Human output:
$ boltzpay quote https://invy.bot/api

Quote
  Protocol:  x402
  Amount:    $0.05
  Currency:  USD
  Network:   eip155:8453 (Base)
  Alternatives:
    - solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp (Solana) — $0.05
Prints This endpoint is free (no payment required) for free endpoints. JSON output (data field):
{
  "protocol": "x402",
  "amount": "$0.05",
  "currency": "USD",
  "network": "eip155:8453",
  "alternatives": [
    { "chain": "Solana", "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", "amount": "$0.05" }
  ]
}

discover

Browse paid API endpoints from the BoltzPay registry. Supports filtering by protocol, score, category, and free-text search.
boltzpay discover [options]
FlagShortTypeDescription
--category <category>-cstringFilter by category
--protocol <protocol>-pstringFilter by protocol (x402, l402, mpp)
--min-score <score>numberMinimum trust score (0-100)
--query <query>-qstringSearch by name, URL, or description
Human output:
$ boltzpay discover --protocol x402 --min-score 70

BoltzPay Registry — Paid API Endpoints

  Invy — Token Holdings (score: 85)
    Token holdings lookup across Base, Ethereum, and Solana
    URL:   https://invy.bot/api
    Protocol: x402 | Category: crypto-data

12 endpoint(s) matching filters
JSON output (data is an array of entries):
[
  {
    "slug": "invy-token-holdings",
    "name": "Invy — Token Holdings",
    "url": "https://invy.bot/api",
    "protocol": "x402",
    "score": 85,
    "health": "healthy",
    "category": "crypto-data",
    "isPaid": true,
    "badge": "established"
  }
]

budget

Show remaining spending budget. No credentials needed.
boltzpay budget
Human output:
$ boltzpay budget

Budget Status

  Daily
    Spent:     $1.25 / $10.00
    Remaining: $8.75

  Per Transaction: max $1.00
Prints No budget limits configured if no limits are set. JSON output (data field):
{ "dailySpent": "$0.00", "dailyLimit": "$10.00", "dailyRemaining": "$10.00",
  "monthlySpent": "$0.00", "monthlyLimit": null, "monthlyRemaining": null,
  "perTransactionLimit": "$1.00" }

history

Show payment history. History is persistent when the SDK persistence option is enabled. No credentials needed.
boltzpay history
Human output:
$ boltzpay history

Payment History

  Date                 Protocol   Amount       Chain    URL
  ----------------------------------------------------------------------
  2026-02-19 14:30:00  x402       $0.05        Base     https://invy.bot/api

1 payment(s) total
By chain: Base $0.05
JSON output (data is an array):
[{ "url": "https://invy.bot/api", "protocol": "x402", "amount": "$0.05",
   "timestamp": "2026-02-19T14:30:00.000Z", "txHash": "0xabc...", "chain": "Base" }]

demo

Interactive walkthrough: checks your wallet, selects an appropriate endpoint (testnet or mainnet, x402 or L402), gets a quote, and optionally fetches with payment.
boltzpay demo [options]
FlagShortDefaultDescription
--yes-ySkip confirmation prompts
--testnetForce testnet mode
Endpoints are selected based on wallet capabilities: L402 if NWC is configured, x402 if Coinbase keys are set, read-only otherwise.

diagnose

Full diagnostic of a paid API endpoint: DNS resolution, protocol detection, format version, pricing, health, and latency. No credentials needed.
boltzpay diagnose <url>
Human output:
$ boltzpay diagnose https://invy.bot/api

Endpoint Diagnosis
  URL:            https://invy.bot/api
  Classification: paid
  Protocol:       x402
  Format:         V2 header
  Scheme:         exact
  Health:         healthy
  Amount:         $0.05
  Network:        eip155:8453
  Latency:        234ms
JSON output (data field):
{
  "url": "https://invy.bot/api",
  "isPaid": true,
  "classification": "paid",
  "protocol": "x402",
  "formatVersion": "V2 header",
  "scheme": "exact",
  "health": "healthy",
  "amount": "$0.05",
  "network": "eip155:8453",
  "latencyMs": 234,
  "timing": { "detectMs": 120, "quoteMs": 114 }
}

wallet

Show wallet addresses, balances, network, active protocols, and budget status.
boltzpay wallet
Human output:
$ boltzpay wallet

Wallet & Configuration

  EVM address:    0x1234...abcd
  Solana address: 7xKX...9mNq
  Balance:        Base $12.50 · Solana $5.00
  Network:        base
  Protocols:      x402, l402
  Budget:         Daily: $8.75 remaining
JSON output (data field):
{
  "network": "base",
  "protocols": ["x402", "l402"],
  "addresses": { "evm": "0x1234...abcd", "svm": "7xKX...9mNq" },
  "balances": { "evm": "$12.50", "svm": "$5.00" },
  "budget": { "configured": true, "dailyLimit": "$10.00" }
}

JSON Output

The --json flag wraps every command’s output in a standard envelope:
{
  success: boolean;
  data: unknown;          // Command-specific payload
  payment: {              // Present on fetch, null otherwise
    protocol: string;
    amount: string;
    currency: string;
    txHash: string | null;
  } | null;
  metadata: {
    url: string;
    status: number;
    duration: number;     // Milliseconds
  };
}
On errors:
{
  "success": false,
  "error": {
    "code": "daily_budget_exceeded",
    "message": "Budget exceeded: requested $0.50, limit $5.00"
  }
}
Error codes map directly to exit codes and error classes. See the Errors section for the full list.

Exit Codes

CodeMeaningError class
0Success
1General / unknown errorAny unrecognized error
2Configuration / credentials errorConfigurationError
3Budget exceededBudgetExceededError
4Payment / protocol errorProtocolError
5Network errorNetworkError
6Insufficient fundsInsufficientFundsError

Python Bridge

The CLI’s --json mode makes it trivial to call from Python (or any language). This is the recommended pattern for using BoltzPay with LangChain, CrewAI, or any Python framework.
import subprocess
import json


def boltzpay_fetch(url: str) -> dict:
    """Fetch a paid API endpoint via BoltzPay CLI."""
    result = subprocess.run(
        ["npx", "@boltzpay/cli", "fetch", url, "--json"],
        capture_output=True,
        text=True,
        check=True,
    )
    return json.loads(result.stdout)


def boltzpay_quote(url: str) -> dict:
    """Get a price quote for an endpoint (no keys needed)."""
    result = subprocess.run(
        ["npx", "@boltzpay/cli", "quote", url, "--json"],
        capture_output=True,
        text=True,
        check=True,
    )
    return json.loads(result.stdout)


# Example: quote then fetch
quote = boltzpay_quote("https://invy.bot/api")
print(f"Price: {quote['data']['amount']}")

data = boltzpay_fetch("https://invy.bot/api")
print(f"Response: {data['data']}")
Set environment variables (COINBASE_API_KEY_ID, etc.) in your shell before running. The CLI reads them automatically via process.env.

Error Handling in Python

import subprocess
import json


def boltzpay_fetch(url: str) -> dict:
    try:
        result = subprocess.run(
            ["npx", "@boltzpay/cli", "fetch", url, "--json"],
            capture_output=True,
            text=True,
        )
        data = json.loads(result.stdout)
        if not data.get("success"):
            error = data.get("error", {})
            raise RuntimeError(f"BoltzPay error [{error['code']}]: {error['message']}")
        return data
    except json.JSONDecodeError:
        raise RuntimeError(f"CLI failed (exit {result.returncode}): {result.stderr}")

Environment Variables

The CLI reads configuration from environment variables. A .env file in your working directory is loaded automatically.
VariableRequiredDescription
COINBASE_API_KEY_IDFor paymentsCoinbase CDP API key ID
COINBASE_API_KEY_SECRETFor paymentsCoinbase CDP API key secret
COINBASE_WALLET_SECRETFor paymentsCoinbase CDP wallet secret
NWC_CONNECTION_STRINGNoEnables L402 protocol
BOLTZPAY_NETWORKNobase (default) or base-sepolia
BOLTZPAY_DAILY_BUDGETNoDaily spending limit in USD
BOLTZPAY_MONTHLY_BUDGETNoMonthly spending limit in USD
BOLTZPAY_PER_TRANSACTIONNoPer-transaction limit in USD
TEMPO_PRIVATE_KEYNoTempo wallet private key (enables MPP)
STRIPE_SECRET_KEYNoStripe secret key (enables Stripe MPP)
Read-only commands (quote, discover, diagnose, budget, history, wallet) work without Coinbase credentials. Only fetch requires them. See Configuration for constructor options, .env examples, and budget details.