Create a BOLT11 invoice
curl --request POST \
--url https://api.example.com/api/v1/lightning/receives/invoice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount_sat": 1,
"description": "<string>",
"token": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/lightning/receives/invoice"
payload = {
"amount_sat": 1,
"description": "<string>",
"token": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount_sat: 1, description: '<string>', token: '<string>'})
};
fetch('https://api.example.com/api/v1/lightning/receives/invoice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/lightning/receives/invoice",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_sat' => 1,
'description' => '<string>',
'token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/lightning/receives/invoice"
payload := strings.NewReader("{\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/lightning/receives/invoice")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/lightning/receives/invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"invoice": "<string>"
}{
"message": "<string>"
}lightning
Create a BOLT11 invoice
Generates a new BOLT11 invoice for the specified amount via the Ark server, creating a pending Lightning receive.
POST
/
api
/
v1
/
lightning
/
receives
/
invoice
Create a BOLT11 invoice
curl --request POST \
--url https://api.example.com/api/v1/lightning/receives/invoice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount_sat": 1,
"description": "<string>",
"token": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/lightning/receives/invoice"
payload = {
"amount_sat": 1,
"description": "<string>",
"token": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount_sat: 1, description: '<string>', token: '<string>'})
};
fetch('https://api.example.com/api/v1/lightning/receives/invoice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/lightning/receives/invoice",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_sat' => 1,
'description' => '<string>',
'token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/lightning/receives/invoice"
payload := strings.NewReader("{\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/lightning/receives/invoice")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/lightning/receives/invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"invoice": "<string>"
}{
"message": "<string>"
}Authorizations
Base64url-encoded auth token
Body
application/json
The amount to create invoice for (in satoshis). This is the amount the payee will pay but the final amount received by the client will have any server-configured LightningReceiveFees [blocked] deducted.
Required range:
x >= 0Optional description embedded in the invoice as its memo.
Optional lightning receive token for authentication of the claim, if the server requires one and there are no existing spendable VTXOs to prove ownership of.
Response
Returns the created invoice
The invoice string
Was this page helpful?
⌘I