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
| Method | Endpoint | Description |
|---|---|---|
POST | /api/payments | Create payment invoice |
GET | /api/payments/{invoiceId}/status | Public 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}/sync | Re-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.
| Method | Endpoint | Description |
|---|---|---|
POST | /api/refunds | Create refund |
GET | /api/refunds/{refundId} | Get refund status |
GET | /api/refunds | List refunds |
GET | /api/refunds/invoice/{invoiceId} | Get refunds for an invoice |
POST | /api/refunds/{refundId}/sync | Re-read refund status from your payment provider |
L402
| Method | Endpoint | Description |
|---|---|---|
POST | /api/l402/challenges | Create an L402 challenge (producer API) |
GET | /api/l402/challenges | List your challenges with payment status |
GET | /api/l402/challenges/{paymentHash} | Get one challenge |
POST | /api/l402/challenges/verify | Verify an L402 or legacy Payment credential |
POST | /api/l402/challenges/verify-credential | Verify a single-use Payment credential |
GET | /api/l402/endpoints | List 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
| Method | Endpoint | Description |
|---|---|---|
POST | /api/webhooks/opennode | OpenNode webhook receiver |
POST | /api/webhooks/strike | Strike 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
| Method | Endpoint | Description |
|---|---|---|
GET | /api/merchant/me | Account info and onboarding status |
GET | /api/merchant/subscription | Subscription details |
GET / POST | /api/merchant/subscription/renew | Quote or pay a renewal in sats over L402 |
GET | /api/merchant/l402-status | L402 feature status |
GET | /api/merchant/api-key-info | API key metadata (masked key, created, last rotated) |
GET | /api/merchant/quickstart | Onboarding checklist |
POST | /api/merchant/regenerate-key | Regenerate your API key |
PUT | /api/merchant/payment-provider | Choose strike, opennode or nwc |
PUT | /api/merchant/strike-key | Save a Strike API key |
PUT | /api/merchant/opennode-key | Save an OpenNode API key |
PUT | /api/merchant/nwc-connection | Save a Nostr Wallet Connect connection string |
PUT | /api/merchant/webhook-url | Set webhook URL and signing secret |
POST | /api/merchant/webhook-secret/rotate | Generate a new webhook signing secret (returned once) |
POST | /api/merchant/validate-strike | Validate your Strike API key |
POST | /api/merchant/validate-opennode | Validate your OpenNode API key |
Full request and response schemas: Merchant Settings.
Health Check
| Method | Endpoint | Description |
|---|---|---|
GET | /health | Service health (public) |
Request Format
| Header | Required | Description |
|---|---|---|
X-API-Key | On authenticated endpoints | Your merchant API key |
Content-Type | On POST/PUT with a body | application/json |
X-Idempotency-Key | No | Prevents duplicate payments and refunds on retry |
Idempotency-Key | No | Retry-safe key for POST /api/l402/challenges |
X-Correlation-Id | No | Request 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
| Code | Description |
|---|---|
200 | Success |
201 | Created |
400 | Bad request: fix the request |
401 | Missing or invalid API key |
402 | Payment required (L402), or an L402 plan cap was reached |
403 | Subscription or feature gate |
404 | Not found (also for another account's resource) |
409 | Conflict with the current state |
429 | Rate limited; honor Retry-After |
500 | Server error; the body carries a correlationId |
502 | The payment provider or proxied API returned an error |
503 | Temporarily 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):
- .NET / C#:
L402Requestson NuGet - JavaScript / TypeScript:
l402-requestson npm - Python:
l402-requestson PyPI
Agent SDKs (higher-level agent commerce primitives):
- .NET / C#:
LightningEnable.AgentSdkon NuGet - JavaScript / TypeScript:
le-agent-sdkon npm - Python:
le-agent-sdkon PyPI
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"]
}
]
}
| Field | Description |
|---|---|
status | Overall result: Healthy, Degraded, or Unhealthy |
totalDuration | Time to run all checks, in milliseconds |
checks[] | One entry per check, with name, status, duration, description, exception, and tags |
| Check | What it verifies |
|---|---|
database | The API can query its database. A failure makes the whole response Unhealthy |
store-tenant | Store 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
- Authentication - API key management
- Request Headers - Idempotency, correlation IDs, and API versioning
- Payments - Create and manage payments
- Webhooks - Real-time notifications
- Errors - Error handling