bootstrap.bolt12.org: API Guide bitcoin version

This provides a simple REST API which (at cost of grossly violating privacy!) lets wallets implement BOLT 12 offers support.

It's not complete (yet), but it supports basic offers usage: see the examples page

https://bootstrap.bolt12.org/decode/STRING (GET)

Returns a application/json which decode the string (it covers bolt11 strings, bolt12 offers, bolt12 invoices and bolt12 invoice_requests).

Most importantly, check valid: if it's false, don't use it!

You can see a complete JSON return description on the manual page

https://bootstrap.bolt12.org/fetchinvoice/OFFER[[/msatoshi]/quantity] (GET)

This fetches an invoice corresponding to a simple offer, and as a courtesy, decodes it. Returns a application/json. If the offer does not specify an amount, msatoshi is required, otherwise it is optional. Similarly, quantity is is required if the offer specifies quantity_min or quantity_max, otherwise it is not allowed.

It will error if we don't get a response from the node in 60 seconds. It will also error if the offer is a recurring offer (see fetchinvoicerecurring).

The important fields are invoice (the bolt12 invoice string), changes (what changed between the offer and the invoice), and decoded which is the output of the decode API, to save you a round-trip.

You can see a complete JSON return description on the manual page.

https://bootstrap.bolt12.org/fetchinvoicerecurring/OFFER/PAYERKEY/COUNTER[/START] (GET)

This fetches an invoice corresponding to an offer which has recurrence, and as a courtesy, decodes it. Returns a application/json. It is not a complete API, but is enough for testing.

The PAYERKEY is a 32-byte hex secret key (needed to sign the invoice request), also uniquely identifies this series of recurrences. COUNTER is the invoice number (it starts at 0, and increases by 1 every time). The offering node won't give you an invoice until the previous one has been paid (and also won't unless you're inside the paywindow, if the offer specifies one). START is required if the offer specifies start_any_period, otherwise it is not allowed.

It will error if we don't get a response from the node in 60 seconds. It will also error if the offer is not a recurring offer (see fetchinvoice).

The return is similar to fetchinvoice, but unless that was the final permitted payment there is a next_period which indicates the next COUNTER, and when the next fetch is possible.

https://bootstrap.bolt12.org/rawinvreq/INVREQ/NODEID (GET, POST)

This low-level API sends a raw invreq message through the network to nodeid, waits up to 60 seconds for an invoice, and as a courtesy, decodes it. Returns a application/json.

https://bootstrap.bolt12.org/status (GET)

Runs getinfo so you can see if the node has fallen over.