Lightning Labs

LND Lightning API

LND Lightning API endpoints from Lightning Labs

Finance & banking#openapi

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

LND Lightning API endpoints from Lightning Labs

Endpoints 68

Lightning

  • GETlncli: `listaliases` ListAliases returns the set of all aliases that have ever existed with their confirmed SCID (if it exists) and/or the base SCID (in the case of zero conf)./v1/aliases/list
  • GETlncli: `walletbalance` WalletBalance returns total unspent outputs(confirmed and unconfirmed), all confirmed unspent outputs and all unconfirmed unspent outputs under control of the wallet./v1/balance/blockchain
  • GETlncli: `channelbalance` ChannelBalance returns a report on the total funds across all open channels, categorized in local/remote, pending local/remote and unsettled local/remote balances./v1/balance/channels
  • GETlncli: `listchannels` ListChannels returns a description of all the open channels that this node is a participant in./v1/channels
  • POSTOpenChannelSync is a synchronous version of the OpenChannel RPC call. This call is meant to be consumed by clients to the REST proxy. As with all other sync calls, all byte slices are intended to be populated as hex encoded strings./v1/channels
  • DELETElncli: `abandonchannel` AbandonChannel removes all channel state from the database except for a close summary. This method can be used to get rid of permanently unusable channels due to bugs fixed in newer versions of lnd. This method can also be used to remove externally funded channels where the funding transaction was never broadcast. Only available for non-externally funded channels in dev build./v1/channels/abandon/:channel_point.funding_txid_str/:channel_point.output_index
  • POSTChannelAcceptor dispatches a bi-directional streaming RPC in which OpenChannel requests are sent to the client and the client responds with a boolean that tells LND whether or not to accept the channel. This allows node operators to specify their own criteria for accepting inbound channels through a single persistent connection./v1/channels/acceptor
  • GETExportAllChannelBackups returns static channel backups for all existing channels known to lnd. A set of regular singular static channel backups for each channel are returned. Additionally, a multi-channel backup is returned as well, which contains a single encrypted blob containing the backups of each channel./v1/channels/backup
  • POSTlncli: `restorechanbackup` RestoreChannelBackups accepts a set of singular channel backups, or a single encrypted multi-chan backup and attempts to recover any funds remaining within the channel. If we are able to unpack the backup, then the new channel will be shown under listchannels, as well as pending channels./v1/channels/backup/restore
  • GETSubscribeChannelBackups allows a client to sub-subscribe to the most up to date information concerning the state of all channel backups. Each time a new channel is added, we return the new set of channels, along with a multi-chan backup containing the backup info for all channels. Each time a channel is closed, we send a new update, which contains new new chan back ups, but the updated set of encrypted multi-chan backups with the closed channel(s) removed./v1/channels/backup/subscribe
  • POSTlncli: `verifychanbackup` VerifyChanBackup allows a caller to verify the integrity of a channel backup snapshot. This method will accept either a packed Single or a packed Multi. Specifying both will result in an error./v1/channels/backup/verify
  • GETlncli: `exportchanbackup` ExportChannelBackup attempts to return an encrypted static channel backup for the target channel identified by it channel point. The backup is encrypted with a key generated from the aezeed seed of the user. The returned backup can either be restored using the RestoreChannelBackup method once lnd is running, or via the InitWallet and UnlockWallet methods from the WalletUnlocker service./v1/channels/backup/:chan_point.funding_txid_str/:chan_point.output_index
  • POSTlncli: `batchopenchannel` BatchOpenChannel attempts to open multiple single-funded channels in a single transaction in an atomic way. This means either all channel open requests succeed at once or all attempts are aborted if any of them fail. This is the safer variant of using PSBTs to manually fund a batch of channels through the OpenChannel RPC./v1/channels/batch
  • GETlncli: `closedchannels` ClosedChannels returns a description of all the closed channels that this node was a participant in./v1/channels/closed
  • GETlncli: `pendingchannels` PendingChannels returns a list of all the channels that are currently considered "pending". A channel is pending if it has finished the funding workflow and is waiting for confirmations for the funding txn, or is in the process of closure, either initiated cooperatively or non-cooperatively./v1/channels/pending
  • POSTlncli: `openchannel` OpenChannel attempts to open a singly funded channel specified in the request to a remote peer. Users are able to specify a target number of blocks that the funding transaction should be confirmed in, or a manual fee rate to us for the funding transaction. If neither are specified, then a lax block confirmation target is used. Each OpenStatusUpdate will return the pending channel ID of the in-progress channel. Depending on the arguments specified in the OpenChannelRequest, this pending channel ID can then be used to manually progress the channel funding flow./v1/channels/stream
  • GETSubscribeChannelEvents creates a uni-directional stream from the server to the client in which any updates relevant to the state of the channels are sent over. Events include new active channels, inactive channels, and closed channels./v1/channels/subscribe
  • DELETElncli: `closechannel` CloseChannel attempts to close an active channel identified by its channel outpoint (ChannelPoint). The actions of this method can additionally be augmented to attempt a force close after a timeout period in the case of an inactive peer. If a non-force close (cooperative closure) is requested, then the user can specify either a target number of blocks until the closure transaction is confirmed, or a manual fee rate. If neither are specified, then a default lax, block confirmation target is used./v1/channels/:channel_point.funding_txid_str/:channel_point.output_index
  • POSTlncli: `updatechanpolicy` UpdateChannelPolicy allows the caller to update the fee schedule and channel policies for all channels globally, or a particular channel./v1/chanpolicy
  • POSTlncli: `sendcustom` SendCustomMessage sends a custom peer message./v1/custommessage
  • GETlncli: `subscribecustom` SubscribeCustomMessages subscribes to a stream of incoming custom peer messages./v1/custommessage/subscribeTo include messages with type outside of the custom range (>= 32768) lnd needs to be compiled with the dev build tag, and the message type to override should…
  • POSTlncli: `debuglevel` DebugLevel allows a caller to programmatically set the logging verbosity of lnd. The logging can be targeted according to a coarse daemon-wide logging level, or in a granular fashion to specify the logging for a target sub-system./v1/debuglevel
  • GETlncli: `feereport` FeeReport allows the caller to obtain a report detailing the current fee schedule enforced by the node globally for each channel./v1/fees
  • POSTFundingStateStep is an advanced funding related call that allows the caller to either execute some preparatory steps for a funding workflow, or manually progress a funding workflow. The primary way a funding flow is identified is via its pending channel ID. As an example, this method can be used to specify that we're expecting a funding flow for a particular pending channel ID, for which we need to use specific parameters. Alternatively, this can be used to interactively drive PSBT signing for funding for partially complete funding transactions./v1/funding/step
  • GETlncli: 'getdebuginfo' GetDebugInfo returns debug information concerning the state of the daemon and its subsystems. This includes the full configuration and the latest log entries from the log file./v1/getdebuginfo
  • GETlncli: `getinfo` GetInfo returns general information concerning the lightning node including it's identity pubkey, alias, the chains it is connected to, and information concerning the number of open+pending channels./v1/getinfo
  • GET* lncli: `getrecoveryinfo` GetRecoveryInfo returns information concerning the recovery mode including whether it's in a recovery mode, whether the recovery is finished, and the progress made so far./v1/getrecoveryinfo
  • GETlncli: `describegraph` DescribeGraph returns a description of the latest graph state from the point of view of the node. The graph information is partitioned into two components: all the nodes/vertexes, and all the edges that connect the vertexes themselves. As this is a directed graph, the edges also contain the node directional specific routing policy which includes: the time lock delta, fee information, etc./v1/graph
  • GETlncli: `getchaninfo` GetChanInfo returns the latest authenticated network announcement for the given channel identified by its channel ID: an 8-byte integer which uniquely identifies the location of transaction's funding output within the blockchain./v1/graph/edge/:chan_id
  • GETlncli: `getnetworkinfo` GetNetworkInfo returns some basic stats about the known channel graph from the point of view of the node./v1/graph/info
  • GETlncli: `getnodeinfo` GetNodeInfo returns the latest advertised, aggregated, and authenticated channel information for the specified node identified by its public key./v1/graph/node/:pub_key
  • GETlncli: `getnodemetrics` GetNodeMetrics returns node metrics calculated from the graph. Currently the only supported metric is betweenness centrality of individual nodes./v1/graph/nodemetrics
  • GETlncli: `queryroutes` QueryRoutes attempts to query the daemon's Channel Router for a possible route to a target destination capable of carrying a specific amount of satoshis. The returned route contains the full details required to craft and send an HTLC, also including the necessary information that should be present within the Sphinx packet encapsulated within the HTLC./v1/graph/routes/:pub_key/:amtWhen using REST, the dest_custom_records map type can be set by appending &dest_custom_records[<record_number>]=<record_data_base64_url_encoded> to the URL.…
  • POSTlncli: `queryroutes` QueryRoutes attempts to query the daemon's Channel Router for a possible route to a target destination capable of carrying a specific amount of satoshis. The returned route contains the full details required to craft and send an HTLC, also including the necessary information that should be present within the Sphinx packet encapsulated within the HTLC./v1/graph/routes/:pub_key/:amtWhen using REST, the dest_custom_records map type can be set by appending &dest_custom_records[<record_number>]=<record_data_base64_url_encoded> to the URL.…
  • GETSubscribeChannelGraph launches a streaming RPC that allows the caller to receive notifications upon any changes to the channel graph topology from the point of view of the responding node. Events notified include: new nodes coming online, nodes updating their authenticated attributes, new channels being advertised, updates in the routing policy for a directional channel edge, and when channels are closed on-chain./v1/graph/subscribe
  • GETLookupHtlcResolution retrieves a final htlc resolution from the database. If the htlc has no final resolution yet, a NotFound grpc status code is returned./v1/htlc-resolution/:chan_id/:htlc_index
  • GETlncli: `lookupinvoice` LookupInvoice attempts to look up an invoice according to its payment hash. The passed payment hash *must* be exactly 32 bytes, if not, an error is returned./v1/invoice/:r_hash_str
  • GETlncli: `listinvoices` ListInvoices returns a list of all the invoices currently stored within the database. Any active debug invoices are ignored. It has full support for paginated responses, allowing users to query for specific invoices through their add_index. This can be done by using either the first_index_offset or last_index_offset fields included in the response as the index_offset of the next request. By default, the first 100 invoices created will be returned. Backwards pagination is also supported through the Reversed flag./v1/invoices
  • POSTlncli: `addinvoice` AddInvoice attempts to add a new invoice to the invoice database. Any duplicated invoices are rejected, therefore all invoices *must* have a unique payment preimage./v1/invoices
  • DELETElncli: `deletecanceledinvoice` DeleteCanceledInvoice removes a canceled invoice from the database. If the invoice is not in the canceled state, an error will be returned. Ordinary invoices whose preimage was released cannot be deleted, even if no funds were collected, so their release history is retained./v1/invoices
  • GETSubscribeInvoices returns a uni-directional stream (server -> client) for notifying the client of newly added/settled invoices. The caller can optionally specify the add_index and/or the settle_index. If the add_index is specified, then we'll first start by sending add invoice events for all invoices with an add_index greater than the specified value. If the settle_index is specified, then next, we'll send out all settle events for invoices with a settle_index greater than the specified value. One or both of these fields can be set. If no fields are set, then we'll only send out the latest add/settle events./v1/invoices/subscribe
  • POSTlncli: `bakemacaroon` BakeMacaroon allows the creation of a new macaroon with custom read and write permissions. No first-party caveats are added since this can be done offline./v1/macaroon
  • POSTCheckMacaroonPermissions checks whether the provided macaroon contains all the provided permissions. If the macaroon is valid (e.g. all caveats are satisfied), and all permissions provided in the request are met, then this RPC returns true./v1/macaroon/checkpermissions
  • GETlncli: `listmacaroonids` ListMacaroonIDs returns all root key IDs that are in use./v1/macaroon/ids
  • GETlncli: `listpermissions` ListPermissions lists all RPC method URIs and their required macaroon permissions to access them./v1/macaroon/permissions
  • DELETElncli: `deletemacaroonid` DeleteMacaroonID deletes the specified macaroon ID and invalidates all macaroons derived from that ID./v1/macaroon/:root_key_id
  • POSTRegisterRPCMiddleware adds a new gRPC middleware to the interceptor chain. A gRPC middleware is software component external to lnd that aims to add additional business logic to lnd by observing/intercepting/validating incoming gRPC client requests and (if needed) replacing/overwriting outgoing messages before they're sent to the client. When registering the middleware must identify itself and indicate what custom macaroon caveats it wants to be responsible for. Only requests that contain a macaroon with that specific custom caveat are then sent to the middleware for inspection. The other option is to register for the read-only mode in which all requests/responses are forwarded for interception to the middleware but the middleware is not allowed to modify any responses. As a security measure, _no_ middleware can modify responses for requests made with _unencumbered_ macaroons!/v1/middleware
  • GETlncli: `newaddress` NewAddress creates a new address under control of the local wallet./v1/newaddress
  • POSTlncli: `sendonion` SendOnionMessage sends an onion message to a peer./v1/onionmessage
  • GETlncli: `subscribeonion` SubscribeOnionMessages subscribes to a stream of incoming onion messages./v1/onionmessage/subscribe
  • DELETElncli: `deletepayments` DeletePayment deletes an outgoing payment from DB. Note that it will not attempt to delete an In-Flight payment, since that would be unsafe./v1/payment
  • GETlncli: `listpayments` ListPayments returns a list of all outgoing payments./v1/payments
  • DELETElncli: `deletepayments --all` DeleteAllPayments deletes all outgoing payments from DB. Note that it will not attempt to delete In-Flight payments, since that would be unsafe./v1/payments
  • GETlncli: `decodepayreq` DecodePayReq takes an encoded payment request string and attempts to decode it, returning a full description of the conditions encoded within the payment request./v1/payreq/:pay_req
  • GETlncli: `listpeers` ListPeers returns a verbose listing of all currently active peers./v1/peers
  • POSTlncli: `connect` ConnectPeer attempts to establish a connection to a remote peer. This is at the networking level, and is used for communication between nodes. This is distinct from establishing a channel with a peer./v1/peers
  • GETSubscribePeerEvents creates a uni-directional stream from the server to the client in which any events relevant to the state of peers are sent over. Events include peers going online and offline./v1/peers/subscribe
  • DELETElncli: `disconnect` DisconnectPeer attempts to disconnect one peer from another identified by a given pubKey. In the case that we currently have a pending or active channel with the target peer, then this action will be not be allowed./v1/peers/:pub_key
  • POSTlncli: `signmessage` SignMessage signs a message with this node's private key. The returned signature string is `zbase32` encoded and pubkey recoverable, meaning that only the message digest and signature are needed for verification./v1/signmessage
  • POSTlncli: `stop` StopDaemon will send a shutdown request to the interrupt handler, triggering a graceful shutdown of the daemon./v1/stop
  • POSTlncli: `fwdinghistory` ForwardingHistory allows the caller to query the htlcswitch for a record of all HTLCs forwarded within the target time range, and integer offset within that time range, for a maximum number of events. If no maximum number of events is specified, up to 100 events will be returned. If no time-range is specified, then events will be returned in the order that they occured./v1/switchA list of forwarding events are returned. The size of each forwarding event is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB. As a…
  • GETlncli: `listchaintxns` GetTransactions returns a list describing all the known transactions relevant to the wallet./v1/transactions
  • POSTlncli: `sendcoins` SendCoins executes a request to send coins to a particular address. Unlike SendMany, this RPC call only allows creating a single output at a time. If neither target_conf, or sat_per_vbyte are set, then the internal wallet will consult its fee model to determine a fee for the default confirmation target./v1/transactions
  • GETlncli: `estimatefee` EstimateFee asks the chain backend to estimate the fee rate and total fees for a transaction that pays to multiple specified outputs./v1/transactions/feeWhen using REST, the AddrToAmount map type can be set by appending &AddrToAmount[<address>]=<amount_to_send> to the URL. Unfortunately this map type doesn't…
  • POSTlncli: `sendmany` SendMany handles a request for a transaction that creates multiple specified outputs in parallel. If neither target_conf, or sat_per_vbyte are set, then the internal wallet will consult its fee model to determine a fee for the default confirmation target./v1/transactions/many
  • GETSubscribeTransactions creates a uni-directional stream from the server to the client in which any newly discovered transactions relevant to the wallet are sent over./v1/transactions/subscribe
  • GETlncli: `listunspent` Deprecated, use walletrpc.ListUnspent instead./v1/utxosListUnspent returns a list of all utxos spendable by the wallet with a number of confirmations between the specified minimum and maximum.
  • POSTlncli: `verifymessage` VerifyMessage verifies a signature over a message and recovers the signer's public key. The signature is only deemed valid if the recovered public key corresponds to a node key in the public Lightning network. The signature must be zbase32 encoded and signed by an active node in the resident node's channel database. In addition to returning the validity of the signature, VerifyMessage also returns the recovered pubkey from the signature./v1/verifymessage

API details

Authentication
None declared in the description
Operations
68 operations on 61 pathsGET 38POST 23DELETE 7
Main resources
Lightning 68
Response formats
application/json
Description format
Swagger 2.0, API version version not set

How to test the LND Lightning API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the LND Lightning API collection, without the publisher's secrets.
  3. Add your credentialsOpen the collection's variables or an environment and enter your API key or token, if the API needs one.
  4. Send a requestPick an endpoint, for example “lncli: `listaliases` ListAliases returns the set of all aliases that have ever existed with their confirmed SCID (if it exists) and/or the base SCID (in the case of zero conf).” (GET /v1/aliases/list), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the LND Lightning API?

LND Lightning API endpoints from Lightning Labs It is listed under Finance & banking and has 68 endpoints.

Who publishes the LND Lightning API?

It is listed from Lightning Labs's public API description (an OpenAPI document), not published by Lightning Labs on Swastik Codes. Anyone who controls lightning.engineering can claim the profile by adding a DNS TXT record.

How do I authenticate with the LND Lightning API?

Its OpenAPI description does not declare an authentication scheme. Some endpoints may be open; check the provider's documentation before relying on that.

How many endpoints does the LND Lightning API have?

68 operations on 61 paths (38 GET, 23 POST, 7 DELETE). The largest groups are Lightning.

Is forking the LND Lightning API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.