Developer Resources
...
API Resources
LND Node API
REST API Examples
5min
prerequisites admin macaroon the admin macaroon is an authentication token that allows you to interact with your lnd node's grpc api with administrative permissions you can also grab a "read only" macaroon that wont have permissions to spend you can find your macaroons in your voltage dashboard by visiting manage access > macaroon bakery interacting with your node's lnd rest api here are some code snippets demonstrating how to interact with some of the most common and popular lnd api methods getinfo https //lightning engineering/api docs/api/lnd/lightning/get info https //lightning engineering/api docs/api/lnd/lightning/get info const rest host = 'node name m voltageapp io 8080'; const macaroon = 'your macaroon in hex format'; // replace this with your actual macaroon in hex format const getinfo = async () => { try { const response = await fetch(`https //${rest host}/v1/getinfo`, { method 'get', headers { 'grpc metadata macaroon' macaroon, }, }); const data = await response json(); console log("getinfo", data) } catch (error) { console error('error ', error); } }; addinvoice https //lightning engineering/api docs/api/lnd/lightning/add invoice https //lightning engineering/api docs/api/lnd/lightning/add invoice const rest host = 'node name m voltageapp io 8080'; const macaroon = 'your macaroon in hex format'; // replace this with your actual macaroon in hex format const createinvoice = async () => { try { const response = await fetch(`https //${rest host}/v1/invoices`, { method 'post', headers { 'grpc metadata macaroon' macaroon, 'content type' 'application/json', }, body json stringify({ value 1000, // invoice amount in satoshis memo 'test invoice', // optional memo for the invoice }), }); const data = await response json(); setinvoice(data); } catch (error) { console error('error ', error); } }; sendpaymentsync https //lightning engineering/api docs/api/lnd/lightning/send payment sync https //lightning engineering/api docs/api/lnd/lightning/send payment sync const rest host = 'node name m voltageapp io 8080'; const macaroon = 'your macaroon in hex format'; // replace this with your actual macaroon in hex format const payinvoice = async () => { try { const response = await fetch(`https //${rest host}/v1/channels/transactions`, { method 'post', headers { 'grpc metadata macaroon' macaroon, 'content type' 'application/json', }, body json stringify({ payment request 'lnbc ', // paste the invoice's payment request here amt 1000, // amount to pay in satoshis }), }); const data = await response json(); console log("payinvoice", data) } catch (error) { console error('error ', error); } }; post /v1/channels/transactions pays an invoice by providing the payment request and the amount to pay post /v1/invoices creates a new invoice with a specified amount and optional memo get /v1/getinfo retrieves general information about your node make sure to replace the placeholders in the script with your actual macaroon file path, node url, and the desired invoice details