API Reference
The Lightning Enable API is a RESTful web service for integrating Bitcoin Lightning payments into your platform.
Base URL
https://api.lightningenable.com
Authentication
All API requests require authentication via the X-API-Key header:
curl -X GET https://api.lightningenable.com/api/payments \
-H "X-API-Key: le_merchant_your-api-key"
See Authentication for details.
API Endpoints
Payments
| Method | Endpoint | Description |
|---|---|---|
POST | /api/payments | Create payment invoice |
GET | /api/payments/{invoiceId} | Get payment by ID |
GET | /api/payments/order/{orderId} | Get payment by order ID |
POST | /api/payments/{invoiceId}/sync | Sync status from OpenNode |
Refunds
| Method | Endpoint | Description |
|---|---|---|
POST | /api/refunds | Create refund |
GET | /api/refunds/{refundId} | Get refund status |
GET | /api/refunds | List all refunds |
GET | /api/refunds/invoice/{invoiceId} | Get refunds for invoice |
Exchange Rates
| Method | Endpoint | Description |
|---|---|---|
GET | /api/rates | Get current BTC exchange rates |
GET | /api/rates/{currency} | Get rate for specific currency |
L402 Protocol
| Method | Endpoint | Description |
|---|---|---|
GET | /api/l402/pricing | Get L402 endpoint pricing |
GET | /api/l402/status | Check L402 auth status |
* | /l402/proxy/{proxyId}/* | L402-protected proxy |
Webhooks
| Method | Endpoint | Description |
|---|---|---|
POST | /api/webhooks/opennode | OpenNode webhook receiver |
Merchant Settings (Self-Service)
| Method | Endpoint | Description |
|---|---|---|
GET | /api/merchant/me | Get account info and onboarding status |
PUT | /api/merchant/opennode-key | Update OpenNode API key |
PUT | /api/merchant/webhook-url | Update webhook URL |
GET | /api/merchant/subscription | Get subscription details |
POST | /api/merchant/validate-opennode | Validate OpenNode API key |
GET | /api/merchant/quickstart | Get onboarding guide |
Admin (Requires Admin Key)
| Method | Endpoint | Description |
|---|---|---|
GET | /api/admin/merchants | List merchants |
POST | /api/admin/merchants | Create merchant |
GET | /api/admin/merchants/{id} | Get merchant |
PUT | /api/admin/merchants/{id} | Update merchant |
Request Format
Headers
| Header | Required | Description |
|---|---|---|
X-API-Key | Yes | Your merchant API key |
Content-Type | Yes (POST/PUT) | application/json |
Request Body
POST and PUT requests accept JSON bodies:
{
"orderId": "ORDER-12345",
"amount": 99.99,
"currency": "USD"
}
Response Format
Success Response
{
"invoiceId": "inv_abc123",
"status": "unpaid",
"amount": 99.99,
"currency": "USD"
}
Error Response
{
"error": "Bad Request",
"message": "Amount is required",
"code": "INVALID_REQUEST"
}
HTTP Status Codes
| Code | Description |
|---|---|
200 | Success |
201 | Created |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid API key |
402 | Payment Required - L402 payment needed |
403 | Forbidden - Access denied |
404 | Not Found - Resource doesn't exist |
429 | Too Many Requests - Rate limited |
500 | Server Error |
Pagination
List endpoints support pagination using skip and take parameters:
GET /api/refunds?skip=0&take=20
| Parameter | Default | Description |
|---|---|---|
skip | 0 | Number of records to skip |
take | 50 | Number of records to return (max 100) |
Example - get second page of 20 results:
GET /api/refunds?skip=20&take=20
Rate Limiting
| Policy | Limit | Applied To |
|---|---|---|
| Global | 100/min | All authenticated requests (per API key) |
| Read | 200/min | GET operations |
| Payment Create | 10/min | POST /api/payments, POST /api/refunds |
| Admin | 30/min | /api/admin/* endpoints |
See Rate Limiting for details.
SDKs and Libraries
Official SDKs (coming soon):
- .NET / C#
- JavaScript / TypeScript
- Python
Quick Examples
Create Payment
curl -X POST https://api.lightningenable.com/api/payments \
-H "X-API-Key: le_merchant_abc123" \
-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/inv_abc123 \
-H "X-API-Key: le_merchant_abc123"
Create Refund
curl -X POST https://api.lightningenable.com/api/refunds \
-H "X-API-Key: le_merchant_abc123" \
-H "Content-Type: application/json" \
-d '{
"invoiceId": "inv_abc123",
"amount": 49.99,
"lightningInvoice": "lnbc499900n1p..."
}'
Next Steps
- Authentication - API key management
- Payments - Create and manage payments
- Webhooks - Real-time notifications
- Errors - Error handling