| Hi HN, I built SatsAPI — a Bitcoin market intelligence API that uses
L402 (HTTP 402 + Lightning Network) for pay-per-call access instead
of API keys or subscriptions. The flow: GET /v1/price
→ 402 + { invoice: "lnbc3n1p...", payment_hash: "abc123" }
pay invoice (any Lightning wallet)
GET /v1/price?payment_hash=abc123
→ 200 + { price, rsi, macd, trend, ... }
8 endpoints covering price/technicals, mempool fees, on-chain metrics,
derivatives, AI-generated signals and a full market summary. Costs range
from 2 sats (~$0.001) to 200 sats (~$0.12).The main thing I wanted to test: can L402 work as a real auth mechanism
for a production API? Turns out yes — it's been live for a week on
mainnet and already receiving payments from what looks like bots or
automated scripts hitting multiple endpoints in sequence. A few things I learned building this: - phoenixd makes the Lightning side trivial. The entire payment middleware
is ~60 lines of Express code.
- L402 is a genuinely better model than API keys for programmatic access.
No credential to leak, natural rate limiting through economics, agents
can pay autonomously.
- Railway blocks exchange IPs so derivatives data is estimated from price
momentum rather than real funding rates. Documented but worth knowing. Stack: Node.js/Express on Railway, phoenixd 0.7.2 on DigitalOcean. https://satsapi.dev/docs — full docs with JS/Python/cURL examples
https://satsapi.dev/health — live node status
https://github.com/Aperezvigoa/satsapi — source Happy to answer questions about the L402 implementation or the
phoenixd setup. |
https://x.com/aperezvigoa/status/2030996046273302876?s=20