WebSocket
Get Lightning Invoices
Returns all previously created Lightning Network invoices.
Auth:API Key
Tags:
Lightning
Command Name
GetLightningInvoicesCommand Arguments
| Field | Type | Required | Description |
|---|---|---|---|
ClientId | string | Required | Custom client ID (max 36 characters) Example: "my-request-123" |
ClientIdRequired
Type:
string
Description:
Custom client ID (max 36 characters)
Example:
"my-request-123"Command Invocation
Command Arguments Example:
[
"my-request-123"
]Invocation Example:
connection.invoke('GetLightningInvoices', ['my-request-123'])Response Event
Event Name
executionEventsSubject
lightspark.invoices.snapshotResponse containing all Lightning invoices
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the invoice |
userId | string | User ID associated with the invoice |
email | string | Email address associated with the invoice |
encodedPaymentRequest | string | Encoded Lightning payment request |
expiresAt | string | ISO 8601 timestamp when the invoice expires |
status | string | Invoice status OPEN→ OpenCLOSED→ Closed |
createdAt | string | ISO 8601 timestamp of invoice creation (nullable) |
updatedAt | string | ISO 8601 timestamp of last update (nullable) |
memo | string | Memo or description for the invoice |
paymentHash | string | Payment hash |
paymentPreimage | string | Payment preimage |
nodeId | string | Lightning node ID |
invoiceType | string | Type of invoice |
expirySecs | number | Invoice expiry time in seconds (nullable) |
metadata | string | Additional invoice metadata |
umaPostTransactionData | string | UMA post-transaction data |
bitcoinNetwork | string | Bitcoin network (mainnet/testnet) |
amountOriginalValue | number | Original invoice amount value (nullable) |
amountOriginalUnit | string | Original invoice amount unit (e.g., BTC, satoshi) |
amountPreferredCurrencyUnit | string | Preferred currency unit (e.g., USD, EUR) |
amountPreferredCurrencyValueRounded | number | Preferred currency value (rounded, nullable) |
amountPreferredCurrencyValueApprox | number | Preferred currency value (approximate, nullable) |
Example Response
{
"data": [
{
"id": "inv_abc123def456",
"userId": "user_789xyz",
"email": "user@example.com",
"encodedPaymentRequest": "lnbc10u1p3xnhl2pp5jmxtqn235tkjzf...",
"expiresAt": "2024-03-28T17:03:12.456Z",
"status": "OPEN",
"createdAt": "2024-03-28T16:03:12.456Z",
"updatedAt": null,
"memo": "Payment for services",
"paymentHash": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2",
"paymentPreimage": "b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3",
"nodeId": "02a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2",
"invoiceType": "STANDARD",
"expirySecs": 3600,
"metadata": "{}",
"umaPostTransactionData": "",
"bitcoinNetwork": "mainnet",
"amountOriginalValue": 1000,
"amountOriginalUnit": "satoshi",
"amountPreferredCurrencyUnit": "USD",
"amountPreferredCurrencyValueRounded": 1,
"amountPreferredCurrencyValueApprox": 0.65
}
]
}Code Examples
const signalR = require('@microsoft/signalr');
const apiKey = 'YOUR_API_KEY_HERE';
const connection = new signalR.HubConnectionBuilder()
.withUrl('https://publicapi.sandbox.hercle.financial/ExecutionLiveServer/v1', {
accessTokenFactory: () => apiKey,
})
.build();
connection.start()
.then(() => {
console.log('Connected to WebSocket');
// Invoke command
connection.invoke('GetLightningInvoices', "my-request-123")
.then(() => {
console.log('Command sent successfully');
})
.catch(err => {
console.error('Command failed:', err);
});
})
.catch(err => {
console.error('Connection failed:', err);
});
// Listen for events
connection.on('executionEvents', (data) => {
console.log('Received event:', data);
});SignalR API Tester
Test this command in the sandbox environment
Disconnected
Your API key is only used locally and never stored