lightning
Create a BOLT11 invoice for an Ark address
Generates a new BOLT11 invoice. When paid, the wallet claims the Lightning receive and forwards the resulting Ark VTXO to the supplied Ark address mailbox. The invoice expires after expiry_secs if given, otherwise after the Ark server’s invoice expiry, which is also the longest it accepts.
POST
/
api
/
v1
/
lightning
/
receives
/
invoice
/
for-address
Create a BOLT11 invoice for an Ark address
curl --request POST \
--url https://api.example.com/api/v1/lightning/receives/invoice/for-address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": "<string>",
"amount_sat": 1,
"description": "<string>",
"expiry_secs": 2
}
'import requests
url = "https://api.example.com/api/v1/lightning/receives/invoice/for-address"
payload = {
"address": "<string>",
"amount_sat": 1,
"description": "<string>",
"expiry_secs": 2
}
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({address: '<string>', amount_sat: 1, description: '<string>', expiry_secs: 2})
};
fetch('https://api.example.com/api/v1/lightning/receives/invoice/for-address', 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/for-address",
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([
'address' => '<string>',
'amount_sat' => 1,
'description' => '<string>',
'expiry_secs' => 2
]),
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/for-address"
payload := strings.NewReader("{\n \"address\": \"<string>\",\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"expiry_secs\": 2\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/for-address")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"<string>\",\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"expiry_secs\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/lightning/receives/invoice/for-address")
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 \"address\": \"<string>\",\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"expiry_secs\": 2\n}"
response = http.request(request)
puts response.read_body{
"invoice": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Authorizations
Base64url-encoded auth token
Body
application/json
Ark address that will receive the claimed VTXO.
The amount to create invoice for (in satoshis).
Required range:
x >= 0Optional description embedded in the invoice as its memo.
Optional number of seconds the invoice can be paid for. Defaults to, and cannot exceed, the Ark server's invoice expiry.
Required range:
x >= 1Response
Returns the created invoice
The invoice string
Was this page helpful?
⌘I
Create a BOLT11 invoice for an Ark address
curl --request POST \
--url https://api.example.com/api/v1/lightning/receives/invoice/for-address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": "<string>",
"amount_sat": 1,
"description": "<string>",
"expiry_secs": 2
}
'import requests
url = "https://api.example.com/api/v1/lightning/receives/invoice/for-address"
payload = {
"address": "<string>",
"amount_sat": 1,
"description": "<string>",
"expiry_secs": 2
}
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({address: '<string>', amount_sat: 1, description: '<string>', expiry_secs: 2})
};
fetch('https://api.example.com/api/v1/lightning/receives/invoice/for-address', 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/for-address",
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([
'address' => '<string>',
'amount_sat' => 1,
'description' => '<string>',
'expiry_secs' => 2
]),
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/for-address"
payload := strings.NewReader("{\n \"address\": \"<string>\",\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"expiry_secs\": 2\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/for-address")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"<string>\",\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"expiry_secs\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/lightning/receives/invoice/for-address")
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 \"address\": \"<string>\",\n \"amount_sat\": 1,\n \"description\": \"<string>\",\n \"expiry_secs\": 2\n}"
response = http.request(request)
puts response.read_body{
"invoice": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}