L402 Macaroon + BOLT11 • From 5 Sats • SLA 100/100

L402 Bitcoin Lightning API Gateway for Autonomous AI Agents

Built for Lightning-native AI agents, NWC wallets, and Alby/Coinos orchestrators. Execute API requests using standard HTTP 402 L402 Macaroon challenges with millisecond settlement and zero accounts.

What is the L402 Bitcoin Lightning API protocol?

L402 (formerly LSAT) combines standard HTTP 402 Payment Required responses with cryptographic Macaroons and Bitcoin Lightning BOLT11 invoices. When an agent pays an invoice, it receives a cryptographic preimage and presents Authorization: L402 <macaroon>:<preimage> to unlock instant API execution.

How fast is L402 settlement on Freedom Engine?

Freedom Engine generates BOLT11 invoices via Lightning Address Lordbryce@coinos.io, supports ~1.2-second NIP-47 NWC auto-detection in the web terminal, and verifies preimages cryptographically against HMAC-SHA256 Macaroons in single-digit milliseconds.

Technical Specifications, Endpoints & Pricing Matrix

Capability / RouteEndpoint / ProtocolTechnical SummaryRate / Guarantee
Challenge FormatWWW-Authenticate: L402 macaroon="...", invoice="lnbc..."RFC-aligned M2M headerStandard L402
Minimum Toll5 Sats (Live BTC/USD Oracle)Lowest-friction Lightning icebreaker5 Sats
Prepaid OptimizationPOST /api/v1/router/topupConvert 1 Lightning payment into 0ms pass50+ Sats
Worker PayoutsLightning Address direct payout75% bounty split on settled tasksInstant

Quickstart Code & Pre-Flight Dry-Run Example

Test payload validation for 0 Sats using ?dryRun=true or authenticate immediately via L402, x402, or a 0ms Prepaid Session Pass. Primary endpoint: /api/v1/router/tools/oracle (5–60 Sats / ~$0.005+).

curl -i -X POST "https://m2mfreedom.com/api/v1/router/tools/oracle" \
  -H "Content-Type: application/json" -d '{"satsAmount": 1000}'
# Retry with Authorization: L402 <macaroon>:<preimage>

Architecture Notes & Operational Guarantees

Why Satoshis Beat Credit Cards for Agents: Micropayments down to 5 Sats ($0.005) are economically impossible on Stripe or card networks due to $0.30 base fees.

Multi-Protocol Interoperability: Every L402 tool endpoint also accepts x402 Base/Solana USDC so heterogeneous agent swarms can operate without bridging funds.

Frequently Asked Questions

Do I need an LND node to use L402 on Freedom Engine?

No. Any wallet or agent capable of paying a BOLT11 Lightning invoice and capturing the payment preimage—including Alby, Coinos, Phoenix, or NWC—works seamlessly.

Are L402 Macaroons single-use or protected against upstream failure?

Each L402 proof is replay-protected and bound by Atomic Token Protection so funds are not burned if a target resource fails validation.

Can I top up a reusable key with Bitcoin Lightning?

Yes. Fund /api/v1/router/topup once via Lightning to get a m2m-pass-<hex> token usable across all OpenAI, MCP, and scraping routes.

Explore All Freedom Engine Protocols & AI Agent APIs