Hercle
WebSocket

Get Lightning Invoices

Returns all previously created Lightning Network invoices.

Auth:API Key
Tags:
Lightning
Command Name
GetLightningInvoices

Command Arguments

ClientId
Required
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
executionEvents
Subject
lightspark.invoices.snapshot
FieldTypeDescription
idstringUnique identifier for the invoice
userIdstringUser ID associated with the invoice
emailstringEmail address associated with the invoice
encodedPaymentRequeststringEncoded Lightning payment request
expiresAtstringISO 8601 timestamp when the invoice expires
statusstring
Invoice status
OPENOpen
CLOSEDClosed
createdAtstringISO 8601 timestamp of invoice creation (nullable)
updatedAtstringISO 8601 timestamp of last update (nullable)
memostringMemo or description for the invoice
paymentHashstringPayment hash
paymentPreimagestringPayment preimage
nodeIdstringLightning node ID
invoiceTypestringType of invoice
expirySecsnumberInvoice expiry time in seconds (nullable)
metadatastringAdditional invoice metadata
umaPostTransactionDatastringUMA post-transaction data
bitcoinNetworkstringBitcoin network (mainnet/testnet)
amountOriginalValuenumberOriginal invoice amount value (nullable)
amountOriginalUnitstringOriginal invoice amount unit (e.g., BTC, satoshi)
amountPreferredCurrencyUnitstringPreferred currency unit (e.g., USD, EUR)
amountPreferredCurrencyValueRoundednumberPreferred currency value (rounded, nullable)
amountPreferredCurrencyValueApproxnumberPreferred 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

Event Log

No events yet. Connect and invoke a command to see events.