Satoshi BTC Intelligence API ⚡
Pay-per-request Bitcoin data API using L402 Lightning micropayments.
No accounts. No API keys. No subscriptions. Just pay sats, get data.
Live: api.satoshiapi.io
Endpoints
| Endpoint | Price | Description |
|---|---|---|
GET /price | 10 sats | BTC/USD price + 24h change |
GET /mempool | 10 sats | Mempool fee estimates (sat/vB) |
GET /blockheight | 10 sats | Block height + network hashrate |
GET /sentiment | 25 sats | Fear & Greed index |
GET /signal | 50 sats | DCA signal (STRONG_BUY / BUY / HOLD / REDUCE) |
GET /health | Free | Service status |
How It Works
# 1. Request an endpoint — get a 402 + Lightning invoice + macaroon
curl -i https://api.satoshiapi.io/price
# HTTP/1.1 402 Payment Required
# WWW-Authenticate: L402 macaroon="<base64>", invoice="lnbc100n1..."
# 2. Pay the invoice with any Lightning wallet — save the preimage
# 3. Re-request with the L402 token
curl -H "Authorization: L402 <macaroon>:<preimage_hex>" \
https://api.satoshiapi.io/price
# {"price_usd": 68163, "change_24h_pct": -3.19, "timestamp": "2026-03-22T21:05:26Z"}
L402 Protocol
This API implements standard L402 authentication:
- Server issues a macaroon (credential) and Lightning invoice in the
WWW-Authenticateheader - Client pays the invoice and receives a preimage (proof of payment)
- Client presents
Authorization: L402 <macaroon_base64>:<preimage_hex> - Server verifies the macaroon signature and confirms the invoice was settled
- Data is returned
Compatible with any L402 client library (l402-python, alby-tools, lsat-js, etc.) or manual payment with any Lightning wallet.
Stack
- Python — Lightweight HTTP server with native L402 implementation
- LND — Lightning Network Daemon for invoice creation and verification
- Macaroons — Standard macaroon-based credentials (pymacaroons)
- Cloudflare — TLS termination and tunnel
No Aperture dependency. Macaroon minting, invoice creation, and payment verification are all handled natively.
Data Sources
| Endpoint | Source |
|---|---|
/price | CoinGecko API |
/mempool | mempool.space |
/blockheight | mempool.space |
/sentiment | Alternative.me Fear & Greed |
/signal | Composite (Fear & Greed + fee rates + price momentum) |
Self-Hosting
# Requirements: LND node with REST API enabled, Python 3.9+
pip install pymacaroons
# Configure LND connection in main.py:
# LND_REST = "https://127.0.0.1:8079"
# LND_MACAROON_PATH = "/path/to/invoice.macaroon"
# LND_CERT_PATH = "/path/to/tls.cert"
python main.py
# Listening on 0.0.0.0:8085
Node
Pubkey: 03176f9948d333f9cc1d7d409353f995816e44b3c90a3300b5a08ceba811faf989
License
MIT
MCP Server (Model Context Protocol)
SatoshiAPI includes an MCP server so AI agents (Claude, GPT, Gemini) can discover and use the API natively.
Setup for Claude Desktop
Add to ~/.config/claude/claude_desktop_config.json:
{
"mcpServers": {
"satoshiapi": {
"command": "python3",
"args": ["mcp_server.py"]
}
}
}
With auto-payment (LND node)
{
"mcpServers": {
"satoshiapi": {
"command": "python3",
"args": ["mcp_server.py"],
"env": {
"SATOSHIAPI_LND_REST": "https://127.0.0.1:8079",
"SATOSHIAPI_LND_MACAROON": "/path/to/invoice.macaroon",
"SATOSHIAPI_LND_CERT": "/path/to/tls.cert"
}
}
}
}
With LND configured, agents pay invoices automatically. Without it, they receive the invoice and payment instructions.
Install via PyPI: pip install satoshiapi-mcp
See MCP_README.md for full documentation.
OpenAPI Spec
Full API specification available at openapi.yaml (OpenAPI 3.1.0).
Import into Swagger Editor, Postman, or any OpenAPI-compatible tool to explore the API interactively.