Lightning

The Lightning API allows you to create invoices, send payments, decode payment requests, and verify settlements over the Bitcoin Lightning Network. All amounts are in satoshis (1 BTC = 100,000,000 satoshis). Ideal for fast, low-fee Bitcoin transactions that settle in seconds.

Lightning API Endpoints
Key Terms
1
Satoshi (sat)unit

The smallest unit of Bitcoin. 1 BTC = 100,000,000 satoshis. All Lightning amounts in this API are denominated in satoshis.

2
BOLT11format

The standard encoding format for Lightning invoices. A BOLT11 string contains the destination, amount, description, and expiry — everything a wallet needs to make a payment.

3
Payment Hashidentifier

A 64-character hex string that uniquely identifies a Lightning payment. It is derived from the payment preimage and is used to verify that a payment was completed.

4
Preimageproof

A 64-character hex secret that proves a payment was successfully received. When a payment settles, the receiver reveals the preimage to the sender as proof of payment.

5
Invoicepayment request

A payment request generated by the receiver. It encodes the amount, description, expiry, and destination so the sender knows exactly what to pay.

6
Directionstring

Whether the invoice is 'incoming' (you created it to receive payment) or 'outgoing' (you paid someone else's invoice).

7
Idempotency Key (reference)string

A unique string you provide to ensure the same request is not processed twice. If you retry a request with the same reference, the API returns the original result instead of creating a duplicate.


Create Invoice

Use Case

Generate a Lightning invoice to receive a payment. The invoice encodes the amount, description, and expiry into a BOLT11 string that any Lightning wallet can pay.

Endpoint

Request Body
1
customer_idstringOptional

An identifier for the customer this invoice belongs to. Useful for associating payments with specific users in your system.

2
amountnumberRequired

The invoice amount in satoshis. Must be between 1 and 20,000,000 sats (0.2 BTC). This is the exact amount the payer will be asked to send.

3
descriptionstringRequired

A human-readable description of what the payment is for (e.g., 'Payment for order #123'). This is displayed in the payer's wallet.

4
expirynumberOptional

How long the invoice remains valid, in seconds. Default: 86400 (24 hours). After expiry, the invoice can no longer be paid.

5
referencestringRequired

A unique idempotency key for this request. If you send the same reference twice, the API returns the original invoice instead of creating a duplicate.

Example Request

Response Body (201)
1
idstringRequired

A unique UUID assigned to this invoice. Use this to retrieve or reference the invoice later.

2
payment_hashstringRequired

A 64-character hex string that uniquely identifies this payment on the Lightning Network. Used to verify payment completion.

3
requeststringRequired

The BOLT11 invoice string. Share this with the payer — they paste it into their Lightning wallet to pay.

4
amount_satnumberRequired

The invoice amount in satoshis, confirming what was requested.

5
descriptionstringRequired

The description attached to the invoice.

6
statusstringRequired

Current state of the invoice: 'pending' (awaiting payment), 'paid' (settled), or 'expired' (no longer valid).

7
expires_atstringRequired

ISO 8601 timestamp when the invoice will expire and become unpayable.

8
created_atstringRequired

ISO 8601 timestamp when the invoice was created.

Example Response (201)

Decode Payment Request

Use Case

Decode a BOLT11 invoice string to inspect its contents before paying. This reveals the amount, destination, description, and whether the invoice has expired — without sending any funds.

Endpoint

Request Body
1
requeststringRequired

A BOLT11-encoded Lightning invoice string. This is the payment request you want to inspect.

Example Request

Response Body (200)
1
payment_hashstringRequired

The unique hash identifying this payment. Used to track and verify the payment across the Lightning Network.

2
destinationstringRequired

The public key of the Lightning node that will receive the payment. This is a 66-character hex string unique to each node.

3
amount_satnumberRequired

The invoice amount in satoshis.

4
amount_msatnumberRequired

The invoice amount in millisatoshis (1 sat = 1000 msat). Used for more precise routing calculations.

5
descriptionstringRequired

The human-readable memo attached to the invoice by the creator.

6
expires_atnumberRequired

Unix timestamp (seconds) when the invoice expires.

7
is_expiredbooleanRequired

Whether the invoice has already expired. If true, the invoice can no longer be paid.

Example Response (200)

Initiate Payment

Use Case

Initiate a Lightning payment by submitting a BOLT11 invoice. This previews the payment details including the destination, amount, routing fee, and whether a valid route exists — before the payment is finalized.

Endpoint

Request Body
1
requeststringRequired

The BOLT11 invoice string to pay. Must be a valid Lightning invoice.

Example Request

Response Body (200)
1
payment_hashstringRequired

The hash that identifies this payment on the Lightning Network.

2
destinationstringRequired

The public key of the destination node that will receive the payment.

3
amount_satstringRequired

The amount to be sent in satoshis.

4
fee_satstringRequired

The estimated routing fee in satoshis.

5
total_satstringRequired

The total cost of the payment (amount + fee) in satoshis.

6
descriptionstringRequired

The description embedded in the Lightning invoice.

7
expires_atstringRequired

Unix timestamp when the invoice expires.

8
is_expiredbooleanRequired

Whether the invoice has already expired.

9
route_foundbooleanRequired

Whether a valid route to the destination was found. If false, the payment cannot be completed.

Example Response (200)

Send Payment

Use Case

Execute a Lightning payment. This sends satoshis to the destination encoded in the BOLT11 invoice. The payment is final once settled — there are no chargebacks on Lightning.

Endpoint

Request Body
1
customer_idstringOptional

An identifier for the customer initiating this payment. Helps you track which user triggered the transaction.

2
requeststringRequired

The BOLT11 invoice string to pay. Must be a valid, unexpired Lightning invoice.

3
referencestringRequired

A unique idempotency key. Prevents duplicate payments if the same request is retried.

4
max_feenumberOptional

Maximum routing fee you're willing to pay, in satoshis. Set to 0 for no limit. If the routing fee exceeds this, the payment will not be sent.

Example Request

Response Body (201)
1
idstringRequired

A unique UUID for this payment record.

2
payment_hashstringRequired

The hash that identifies this payment on the Lightning Network.

3
preimagestringRequired

The payment preimage (proof of payment). This 64-character hex string proves the recipient received the funds. Store this for dispute resolution.

4
amount_satnumberRequired

The amount sent in satoshis.

5
fee_satnumberRequired

The actual routing fee charged, in satoshis.

6
statusstringRequired

Payment status: 'paid' (successfully settled), 'pending' (in-flight), or 'failed' (could not route or settle).

7
created_atstringRequired

ISO 8601 timestamp when the payment was created.

8
referencestringRequired

The idempotency key you provided in the request.

9
transaction_idstringRequired

An internal transaction ID linking this payment to your ledger.

Example Response (201)

Get Invoice

Use Case

Retrieve a single Lightning invoice by its ID. Use this to check the current status of an invoice (pending, paid, or expired) and access its full details.

Endpoint

Response Body (200)
1
idstringRequired

The unique UUID of the invoice.

2
payment_hashstringRequired

The hash uniquely identifying this payment on the Lightning Network.

3
requeststringRequired

The BOLT11 invoice string.

4
preimagestringRequired

The payment preimage. Empty string if not yet paid; populated with proof of payment once settled.

5
amount_satnumberRequired

Invoice amount in satoshis.

6
amount_msatnumberRequired

Invoice amount in millisatoshis.

7
fee_satnumberRequired

Routing fee in satoshis (0 for incoming invoices you created).

8
fee_msatnumberRequired

Routing fee in millisatoshis.

9
descriptionstringRequired

The description attached to the invoice.

10
statusstringRequired

Current state: 'pending', 'paid', 'expired', or 'failed'.

11
directionstringRequired

'incoming' if you created this invoice to receive a payment, 'outgoing' if you paid someone else's invoice.

12
company_idstringRequired

The ID of the company that owns this invoice.

13
customer_idstringRequired

The customer identifier associated with the invoice, if provided during creation.

14
referencestringRequired

The idempotency key provided when the invoice was created.

15
expires_atnumberRequired

Unix timestamp when the invoice expires.

16
created_atstringRequired

ISO 8601 timestamp when the invoice was created.

17
updated_atstringRequired

ISO 8601 timestamp of the last update (e.g., when status changed to paid).

Example Response (200)

List Invoices

Use Case

Retrieve a paginated list of Lightning invoices. Filter by status or direction to find specific invoices.

Endpoint

Query Parameters
1
pageintegerOptional

Page number to retrieve. Default: 1.

2
page_sizeintegerOptional

Number of results per page. Default: 20, maximum: 100.

3
statusstringOptional

Filter by invoice status. Accepted values: 'pending', 'paid', 'expired', 'failed'.

4
directionstringOptional

Filter by direction. 'incoming' for invoices you created to receive payment, 'outgoing' for invoices you paid.

Example Query

Response Body (200)
Note

Each invoice object in the invoices array has the same fields as the Get Invoice response. The response also includes pagination metadata.

1
invoicesarrayRequired

An array of invoice objects. Each object contains all fields described in the Get Invoice section.

2
total_countnumberRequired

The total number of invoices matching your filters.

3
pagenumberRequired

The current page number.

4
page_sizenumberRequired

The number of results per page.

Example Response (200)

Verify Invoice Payment

Use Case

Confirm whether a specific Lightning invoice has been paid and settled. Use this to verify payment status server-side, especially when webhooks may have been missed or delayed.

Endpoint

Request Body
1
payment_hashstringRequired

The 64-character hex payment hash of the invoice you want to verify. This was returned when the invoice was created.

Example Request

Response Body (200)
1
idstringRequired

The UUID of the invoice.

2
payment_hashstringRequired

The payment hash you queried.

3
preimagestringRequired

The payment preimage — cryptographic proof that the payment was received. Empty if not yet paid.

4
amount_satnumberRequired

The invoice amount in satoshis.

5
statusstringRequired

Current status: 'paid' if settled, 'pending' if still waiting, 'expired' if the invoice timed out.

6
is_paidbooleanRequired

A convenience boolean: true if the invoice has been paid and settled.

7
ledger_creditedbooleanRequired

Whether the payment amount has been credited to your wallet balance. Should be true once settlement is complete.

8
settled_atstringRequired

ISO 8601 timestamp when the payment was settled. Null if not yet paid.

Example Response (200)

Did you find this page useful?