Built on L402 Protocol by Lightning Labs

Monetize Your APIs with Lightning Payments

Enable pay-per-request for any API. No subscriptions, no API keys, no accounts. Your users pay with Bitcoin Lightning and get instant access.

Open Source (MIT)
2,400+ developers
$1.2M+ processed
server.ts
// Add L402 payment protection with one line
import { l402Middleware } from "paygate-l402"

app.use(
  l402Middleware({
    "GET /api/data": { price: 100, currency: "sats" },
    "POST /api/generate": { price: 500, currency: "sats" },
  })
)
0.00
Transactions
$0.0M
Volume Processed
0
API Providers
0.0ms
Avg. Response Time

Everything you need to monetize your API

Built on the L402 protocol, Clobig gives you the tools to turn any endpoint into a revenue stream.

Instant Payments
Receive payments in milliseconds via Lightning Network. No waiting for confirmations or settlement delays.
No API Keys
Users pay and authenticate in a single request. No key management, no rate limit juggling, no security risks.
Global Access
Anyone with a Lightning wallet can access your API. No bank accounts, no credit cards, no KYC required.
Simple Integration
Add payment protection to any endpoint with middleware. Works with Express, Fastify, Hono, and more.
Micropayments
Charge fractions of a cent per request. Enable pricing models that weren't possible before.
Real-time Analytics
Track revenue, usage patterns, and performance metrics. Export data for your own analysis.

How L402 works

The HTTP 402 status code was reserved for "Payment Required" since 1997. L402 finally puts it to work.

01

Client makes HTTP request

User or AI agent sends a request to your protected endpoint without any API key or pre-registration.

fetch('/api/weather?city=miami')
02

Server returns 402 Payment Required

Your server responds with a Lightning invoice and payment details according to the L402 protocol.

HTTP/1.1 402 Payment Required
WWW-Authenticate: L402
  macaroon="...",
  invoice="lnbc..."
03

Client pays the invoice

The client pays the Lightning invoice instantly, typically in under 1 second. Payment is settled immediately.

const preimage = await wallet.pay(invoice)
04

Access granted

Client retries with payment proof. Server validates and returns the requested data. The whole flow takes seconds.

Authorization: L402 <macaroon>:<preimage>
// Response: { "weather": "sunny", "temp": 75 }

Built for the agentic future

From AI agents to data APIs, L402 enables new business models that weren't possible before.

AI Agents
Let autonomous agents pay for services automatically. No human in the loop for API access.
  • GPT plugins
  • Autonomous workflows
  • Agent-to-agent payments
LLM APIs
Monetize your fine-tuned models or inference endpoints with per-token pricing.
  • Chat completions
  • Embeddings
  • Custom models
Media Generation
Charge per image, video, or audio generation. Perfect for creative AI tools.
  • Image generation
  • Voice synthesis
  • Video editing
Data APIs
Sell access to premium data feeds with per-query pricing.
  • Market data
  • Weather APIs
  • Research datasets
Compute Services
Offer GPU compute, transcoding, or heavy processing on a pay-per-use basis.
  • GPU inference
  • Video transcoding
  • 3D rendering
Content Access
Gate premium content behind micropayments. No subscriptions needed.
  • Articles
  • Research papers
  • Tutorials

SDKs for every language

Get started in minutes with our official SDKs. Fully open source and MIT licensed.

TypeScript / Node.js
npm install paygate-l402
Python
pip install paygate-l402
Go
go get github.com/paygate/l402-go
Rust
cargo add paygate-l402
middleware.ts
import { l402Middleware } from "paygate-l402"
import { createLightningProvider } from "paygate-l402/lightning"

// Connect to your Lightning node
const lightning = createLightningProvider({
  backend: "lnd", // or "cln", "phoenixd"
  macaroonPath: process.env.MACAROON_PATH,
})

// Protect your routes
export const paywall = l402Middleware({
  lightning,
  routes: {
    "GET /api/weather": { price: 10, currency: "sats" },
    "POST /api/generate": { price: 100, currency: "sats" },
    "GET /api/premium/*": { price: 50, currency: "sats" },
  },
})

Transparent pricing

No monthly fees, no hidden costs. Pay only for what you use, or self-host for free.

Open Source
Self-hosted, full control
FreeForever
  • Full L402 protocol support
  • All middleware integrations
  • Community support
  • MIT License
  • Self-managed Lightning node
Popular
Pro
Managed infrastructure
0.5%Per transaction
  • Everything in Open Source
  • Managed Lightning node
  • Automatic channel management
  • Real-time analytics dashboard
  • Email support
  • 99.9% uptime SLA
Enterprise
For high-volume APIs
CustomVolume discounts
  • Everything in Pro
  • Dedicated infrastructure
  • Custom integrations
  • 24/7 priority support
  • On-premise deployment option
  • Custom SLA

Ready to monetize your API?

Join thousands of developers building the future of internet-native payments. Start accepting Lightning payments in minutes.

Get Started Free

No credit card required. Start building in minutes.