Hercle
REST
POST/api/v1/invoices

Create Lightning Invoice

Create an invoice via Lightning Network. Send the BTC amount and (optionally) a memo. expiryHours defaults to 24 and can go up to 720 (1 month).

Auth:Bearer <api_key>
Tags:LightningInvoices

Request

cURL
curl -X POST https://publicapi.sandbox.hercle.financial/api/v1/invoices \
  -H "Authorization: Bearer eyJhb..." \
  -H "Content-Type: application/json" \
  -d '{"key": "value"}'

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
Content-TypestringYesapplication/json

Request Body

Schema

object
amountBtc*:number
// Amount of BTC to be invoiced
expiryHours*:number
// Expiry time in hours (default: 24, max: 720)
memo:string
// Optional memo for the invoice

Example

{
  "amountBtc": 0.001,
  "expiryHours": 24,
  "memo": "Payment for services"
}

Response

Success Response Schema

FieldTypeDescription
idstringUnique identifier for the invoice
encodedPaymentRequeststringEncoded Lightning payment request
expiresAtstringISO 8601 timestamp when the invoice expires

Responses

Invoice created successfully

201 application/json
{
  "id": "xxxx",
  "encodedPaymentRequest": "lnbc1...",
  "expiresAt": "2024-03-28T16:03:12.456Z"
}

API Tester

Test this endpoint directly against the sandbox environment

Get your API key from Hercle Sandbox

https://publicapi.sandbox.hercle.financial/api/v1/invoices