Skip to main content

API Reference

The Lightning Enable API is a REST API for taking Bitcoin Lightning payments and selling API access over L402. Lightning Enable does not hold funds; your payment provider (Strike or OpenNode), or your own wallet over Nostr Wallet Connect, facilitates custody and settlement.

Base URL​

https://api.lightningenable.com

Authentication​

Authenticated requests carry your merchant API key in the X-API-Key header:

curl https://api.lightningenable.com/api/merchant/me \
-H "X-API-Key: YOUR_API_KEY"

See Authentication, including which endpoints are public.

API Endpoints​

Payments​

MethodEndpointDescription
POST/api/paymentsCreate payment invoice
GET/api/payments/{invoiceId}/statusPublic payment status (no API key; safe for browser polling)
GET/api/payments/{invoiceId}Get payment by ID
GET/api/payments/order/{orderId}Get payment by order ID
POST/api/payments/{invoiceId}/syncRe-read status from your payment provider
GET/pay/{token}Public hosted checkout page; the link is returned as payUrl

Refunds​

Refunds are enabled per account by support. See Errors.

MethodEndpointDescription
POST/api/refundsCreate refund
GET/api/refunds/{refundId}Get refund status
GET/api/refundsList refunds
GET/api/refunds/invoice/{invoiceId}Get refunds for an invoice
POST/api/refunds/{refundId}/syncRe-read refund status from your payment provider

L402​

MethodEndpointDescription
POST/api/l402/challengesCreate an L402 challenge (producer API)
GET/api/l402/challengesList your challenges with payment status
GET/api/l402/challenges/{paymentHash}Get one challenge
POST/api/l402/challenges/verifyVerify an L402 or legacy Payment credential
POST/api/l402/challenges/verify-credentialVerify a single-use Payment credential
GET/api/l402/endpointsList your L402 endpoints and plan usage
*/l402/proxy/{proxyId}/{path}L402-protected proxy (public; pays per request)

See L402 API and the Producer API Reference.

Webhooks​

MethodEndpointDescription
POST/api/webhooks/opennodeOpenNode webhook receiver
POST/api/webhooks/strikeStrike webhook receiver

These receive events from your payment provider. Your own notifications go to the callback URL you set with PUT /api/merchant/webhook-url. See Webhooks.

Merchant Settings​

MethodEndpointDescription
GET/api/merchant/meAccount info and onboarding status
GET/api/merchant/subscriptionSubscription details
GET / POST/api/merchant/subscription/renewQuote or pay a renewal in sats over L402
GET/api/merchant/l402-statusL402 feature status
GET/api/merchant/api-key-infoAPI key metadata (masked key, created, last rotated)
GET/api/merchant/quickstartOnboarding checklist
POST/api/merchant/regenerate-keyRegenerate your API key
PUT/api/merchant/payment-providerChoose strike, opennode or nwc
PUT/api/merchant/strike-keySave a Strike API key
PUT/api/merchant/opennode-keySave an OpenNode API key
PUT/api/merchant/nwc-connectionSave a Nostr Wallet Connect connection string
PUT/api/merchant/webhook-urlSet webhook URL and signing secret
POST/api/merchant/webhook-secret/rotateGenerate a new webhook signing secret (returned once)
POST/api/merchant/validate-strikeValidate your Strike API key
POST/api/merchant/validate-opennodeValidate your OpenNode API key

Full request and response schemas: Merchant Settings.

Health Check​

MethodEndpointDescription
GET/healthService health (public)

Request Format​

HeaderRequiredDescription
X-API-KeyOn authenticated endpointsYour merchant API key
Content-TypeOn POST/PUT with a bodyapplication/json
X-Idempotency-KeyNoPrevents duplicate payments and refunds on retry
Idempotency-KeyNoRetry-safe key for POST /api/l402/challenges
X-Correlation-IdNoRequest tracing ID (generated if you don't send one)

See Request Headers.

Errors​

Every error body has an error field. On most endpoints it's a stable snake_case code with a message beside it (for example invalid_expiry); some older endpoints return a prose error, which you should handle by HTTP status. The L402 producer endpoints return application/problem+json with a stable type URI. Model-binding failures return the standard ASP.NET validation problem (a 400 with an errors dictionary). See Errors.

HTTP Status Codes​

CodeDescription
200Success
201Created
400Bad request: fix the request
401Missing or invalid API key
402Payment required (L402), or an L402 plan cap was reached
403Subscription or feature gate
404Not found (also for another account's resource)
409Conflict with the current state
429Rate limited; honor Retry-After
500Server error; the body carries a correlationId
502The payment provider or proxied API returned an error
503Temporarily unavailable; retry

Pagination​

GET /api/refunds takes skip (default 0) and take (default 50, max 100). The L402 listings use their own parameters and return the unpaged total in X-Total-Count; see L402 API.

Rate Limiting​

Every request counts against a global 100 per minute (per API key, or per IP without one), and most routes also have a named policy, for example 10 per minute per API key for POST /api/payments. See Rate Limiting.

SDKs and Libraries​

L402 client libraries (HTTP clients that pay 402s for you):

Agent SDKs (higher-level agent commerce primitives):

For MCP clients (Claude Desktop, Claude Code and others), see the Lightning Enable MCP repository.

Quick Examples​

Create Payment​

curl -X POST https://api.lightningenable.com/api/payments \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"orderId": "ORDER-12345",
"amount": 49.99,
"currency": "USD",
"description": "Premium Subscription"
}'

Check Payment Status​

curl https://api.lightningenable.com/api/payments/1042 \
-H "X-API-Key: YOUR_API_KEY"

Health Check Endpoint​

GET /health is public and returns the status of the API and its dependencies, so you can point an uptime monitor or load-balancer probe at it.

curl https://api.lightningenable.com/health
{
"status": "Healthy",
"totalDuration": 42.15,
"checks": [
{
"name": "database",
"status": "Healthy",
"duration": 38.72,
"description": null,
"exception": null,
"tags": ["db", "sql"]
},
{
"name": "store-tenant",
"status": "Healthy",
"duration": 3.1,
"description": null,
"exception": null,
"tags": ["store"]
}
]
}
FieldDescription
statusOverall result: Healthy, Degraded, or Unhealthy
totalDurationTime to run all checks, in milliseconds
checks[]One entry per check, with name, status, duration, description, exception, and tags
CheckWhat it verifies
databaseThe API can query its database. A failure makes the whole response Unhealthy
store-tenantStore API configuration. It reports Degraded, never Unhealthy

The response is 200 for Healthy and Degraded, and 503 for Unhealthy. Alert on a non-200 status, or on any check whose status isn't Healthy.

Next Steps​