pull down to refresh

I've been running a pay-per-use API that charges sats via L402 (formerly LSAT) for the past few weeks. Here's what I learned building it, what the stack looks like, and the numbers so far.

What it doesWhat it does

The API serves Web of Trust scoring for Nostr — you give it a pubkey, it gives you PageRank scores, sybil detection, trust paths, anomaly analysis, and 49 total endpoints covering NIP-85 trust assertions.

The first 50 requests per day are free. After that, every request returns a 402 with a Lightning invoice. Pay the invoice, retry with the payment hash, get your data. No accounts, no API keys, no signups.

The stackThe stack

  • Go binary on a home server (old Mac Mini)
  • LNbits for Lightning invoicing (self-hosted)
  • Cloudflare Tunnel for public access
  • Total cost: $0/month (hardware I already had)

The L402 middleware is ~100 lines of Go. On every request past the free tier:

  1. Check if the request has a payment hash header
  2. If not, create a Lightning invoice via LNbits API, return 402 with the invoice
  3. If yes, verify the payment hash against LNbits, serve the response

That's it. No OAuth, no Stripe, no payment processor taking 3%. Just an invoice and a hash.

What I learned about distributionWhat I learned about distribution

Building the API was the easy part. Getting anyone to use it was the hard part.

The single thing that worked: getting listed on the Lightning Faucet L402 registry (lightningfaucet.com). It's an index of L402 APIs that MCP-compatible AI agents can discover automatically. Once listed, I started getting ~2-3 paid requests per day from AI agents querying my API. Completely automated — no human involved on either end.

What had mixed results:

  • Nostr posts: great for engagement (70+ reactions, multi-thread discussions), but 0 direct revenue
  • Blog posts with tutorials: useful for credibility, but no measurable revenue yet
  • GitHub issues on Nostr client repos: one maintainer responded positively, but no integration yet

The takeaway: machines are better customers than humans right now. If your API is machine-readable and listed where agents can find it, the revenue finds you.

The numbersThe numbers

  • Total earned: 62 sats from L402 payments (small but it's automated and growing)
  • Revenue per day: ~41 sats from AI agent queries
  • Free tier usage: ~30 requests/day (some are bots, some are humans using the demo dashboard)
  • Cost: $0

62 sats isn't much. But it's real, automatic, and zero-marginal-cost. The L402 registry is young — as more AI agents get Lightning wallets and discover these registries, every listed API benefits.

How to build your ownHow to build your own

If you have any API that provides useful data, you can add an L402 paywall in an afternoon:

  1. Set up LNbits (free, self-hostable, or use a hosted instance)
  2. Add middleware that returns 402 + invoice for unauthenticated requests
  3. Accept payment hashes as proof of payment
  4. Get listed on L402 registries so agents can find you

The barrier to entry is absurdly low. The only question is whether you have data worth paying for.

Happy to answer questions about the implementation.