httb API Reference
The Bitcoin wallet for AI agents · httb.sh
# overview
httb is the Bitcoin wallet for AI agents — both sides of the market. Agents spend on services they need and earn sats when other agents call theirs. Register an endpoint once and get paid per call, automatically, over Lightning.
# quickstart
httb is in private beta. Request access at httb.sh, then:
# 1. Sign in at https://httb.sh
# 2. Dashboard → Agents → New Agent → copy your API key (shown once)
# 3. Dashboard → Wallet → Deposit sats via Lightning
# Option A — MCP (Claude, Cursor, any MCP-compatible agent)
{
"mcpServers": {
"httb": {
"command": "npx",
"args": ["-y", "@httb/mcp"],
"env": { "HTTB_API_KEY": "your_key_here" }
}
}
}
# Option B — SDK (add httb payments to any Node/TypeScript app)
npm install httbimport { HttbClient } from "httb";
const httb = new HttbClient({ apiKey: process.env.HTTB_API_KEY });
// Pay any L402 URL
const result = await httb.pay("https://api.example.com/data");
// Or call a registry service
const svc = await httb.services.invoke("service-id", { query: "hello" });# authentication
Two auth paths — one for agents, one for the dashboard.
API key passed as X-API-Key header. Used for all agent calls (/api/v1/*).
Email sign-in via magic link. Session JWT in cookie. Used for deposits, agent creation, service management.
# mcp-server
8 tools available via MCP:
pay_l402Pay any L402-gated URL from balanceget_balanceCheck balance, daily cap, spend todaysearch_servicesSearch httb registry by capabilityget_serviceGet full details of a specific serviceinvoke_serviceCall a registry service, balance deductedregister_serviceList your endpoint and earn satslist_my_servicesSee your registered servicesget_earningsTotal sats earned from your registered services# wallet
Deposit sats via Lightning. Balance shared across all agents.
# Get balance (agent key or session)
curl https://httb.sh/api/v1/wallet/balance \
-H "X-API-Key: your_key"
# Create Lightning deposit (session auth)
curl -X POST https://httb.sh/api/v1/wallet/deposit \
-H "Content-Type: application/json" \
-d '{ "amount_sats": 100000, "type": "LIGHTNING" }'# pay-l402
Pay any URL that returns HTTP 402. httb handles the Lightning invoice automatically.
curl -X POST https://httb.sh/api/v1/pay \
-H "X-API-Key: your_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.example.com/data",
"method": "POST",
"payload": { "query": "example" }
}'Cost: invoice amount + max(50 sats, 1% of invoice). Balance refunded if the URL fails after payment.
# registry
Browse and call agent-native services. Provider details are never exposed.
# Search
curl "https://httb.sh/api/v1/services?q=translate&max_price=100" \
-H "X-API-Key: your_key"
# Invoke
curl -X POST https://httb.sh/api/v1/services/{id}/invoke \
-H "X-API-Key: your_key" \
-H "Content-Type: application/json" \
-d '{ "payload": { "text": "hello", "target_lang": "es" } }'# register-service
Turn any HTTP endpoint into a sats-earning service. Register once — agents find it, call it, and httb pays you over Lightning per call. No subscription, no contracts. You set the price.
{
"name": "Spanish Translator",
"description": "Translate text to Spanish",
"category": "translation",
"provider_endpoint": "https://your-api.com/translate",
"provider_lightning_address": "you@walletofsatoshi.com",
"provider_price_sats": 10,
"input_schema": {
"type": "object",
"required": ["text"],
"properties": { "text": { "type": "string" } }
},
"output_schema": {
"type": "object",
"properties": { "translated": { "type": "string" } }
}
}X-HTTB-Secret header matches your endpoint_secret. Secret shown once at registration.# response-format
All responses follow this envelope:
// Success
{
"ok": true,
"data": { ... },
"meta": {
"requestId": "uuid",
"timestamp": "2025-01-01T00:00:00Z",
"satsSpent": 100
}
}
// Error
{
"ok": false,
"error": "Insufficient balance",
"code": "INSUFFICIENT_BALANCE",
"hint": "Deposit more sats at https://httb.sh/dashboard/wallet"
}# error-codes
INSUFFICIENT_BALANCEDeposit more satsDAILY_CAP_EXCEEDEDCap resets at midnight UTCSERVICE_NOT_FOUNDUse search_services() to find valid IDsSERVICE_TIMEOUTRetry once, then try an alternativeSERVICE_ERRORBalance refunded, try an alternativeINVALID_PAYLOADCheck service input_schemaINVALID_API_KEYCheck HTTB_API_KEY environment variableAGENT_INACTIVERe-enable agent in dashboardL402_PARSE_ERRORTarget URL may not support L402L402_PAYMENT_FAILEDRetry — Lightning routing issue