Back to browse
SatsAPI – Bitcoin data API, pay per call in sats via Lightning L402

SatsAPI – Bitcoin data API, pay per call in sats via Lightning L402

by Aperezvigoa·Mar 8, 2026·3 points·3 comments

AI Analysis

●●●BangerZero to OneSlickSolve My Problem

L402 turns Lightning payments into stateless API auth for autonomous agents.

Strengths
  • L402 auth eliminates API keys/subscriptions—genuinely novel auth mechanism for production APIs
  • Live on mainnet with real bot traffic—not vaporware, validated demand exists
  • Thoughtful endpoint design: 2-200 sats, includes AI signals and on-chain metrics
Weaknesses
  • Bitcoin ecosystem only—not a differentiator, but limits TAM to crypto-native developers
  • Learning curve: L402 + Lightning wallets required vs familiar API key flows
Category
Target Audience

Developers, traders, and AI agents needing real-time Bitcoin data

Similar To

CoinGecko API · Glassnode · The Graph (indexing)

Post Description

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.

Similar Projects

AI/ML●●●Banger

MCP plugin that lets Claude autonomously pay for APIs via Lightning

Agents finally have bank accounts: 402 interception + Lightning payments just works.

Zero to OneBold BetBig Brain
jaafarskafi
102mo ago