Docs/HTTP API
Reference

HTTP API

The klw daemon exposes a local REST API for agents that do not support MCP. All endpoints require a Bearer token.

Connection

Base URL

http://127.0.0.1:7732

Auth header

Authorization: Bearer <token>

Terminalbash
# Read the daemon token
TOKEN=$(cat ~/.kleepay/daemon_token)

# Check health
curl -s http://127.0.0.1:7732/health \
  -H "Authorization: Bearer $TOKEN"

# Authorize a payment
curl -s http://127.0.0.1:7732/authorize \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "card_id": "card_7f3a9c2d",
    "amount": 49.00,
    "currency": "USD",
    "merchant": "vercel.com",
    "ttl": "15m"
  }'

Endpoints

GET/health

Check daemon health status

{ "status": "ok", "version": "0.4.2", "uptime_seconds": 3612 }
GET/cards

List all virtual cards

{ "cards": [{ "id": "card_7f3a9c2d", "label": "infra", "status": "frozen", "balance": 500.00 }] }
GET/cards/:card_id

Get a single card with details

{ "id": "card_7f3a9c2d", "label": "infra", "status": "frozen", "balance": 500.00, "daily_limit": 2000.00 }
POST/authorize

Authorize a payment (signs PolicyWindow, unfreezes card)

{ "tx_id": "tx_a1b2c3d4", "status": "authorized", "signed_at": "2026-04-09T10:30:00Z" }
GET/transactions

List recent transactions

{ "transactions": [{ "id": "tx_a1b2c3d4", "amount": 49.00, "merchant": "vercel.com", "status": "settled" }] }
GET/transactions/:tx_id

Get transaction details

{ "id": "tx_a1b2c3d4", "amount": 49.00, "merchant": "vercel.com", "status": "settled", "policy_window": { ... } }
GET/wallet/balance

Get wallet balance

{ "usdt": 1250.00, "allocated": 750.00, "available": 500.00 }
POST/wallet/allocate

Allocate funds to a card

{ "card_id": "card_7f3a9c2d", "allocated": 200.00, "new_balance": 700.00 }