c-lightning (lightningd) has a json-rpc api. The client is lightning-cli. For available commands:
lightning-cli help
Some (rough) docs are available here:
https://github.com/ElementsProject/lightning/tree/master/docIt would be nice if they would be published on a wiki someplace, but google doesn't turn it up...
Output of lightning-cli help:
feerates style
Return feerate estimates, either satoshi-per-kw ({style} perkw) or satoshi-per-kb ({style} perkb).
connect id [host] [port]
Connect to {id} at {host} (which can end in ':port' if not default). {id} can also be of the form id@host
listnodes [id]
Show node {id} (or all, if no {id}), in our local network view
getroute id msatoshi riskfactor [cltv] [fromid] [fuzzpercent] [exclude] [maxhops]
Show route to {id} for {msatoshi}, using {riskfactor} and optional {cltv} (default 9). If specified search from {fromid} otherwise use this node as source. Randomize the route with up to {fuzzpercent} (default 5.0). {exclude} an array of short-channel-id/direction (e.g. [ '564334x877x1/0', '564195x1292x0/1' ]) from consideration. Set the {maxhops} the route can take (default 20).
listchannels [short_channel_id] [source]
Show channel {short_channel_id} or {source} (or all known channels, if not specified)
invoice msatoshi label description [expiry] [fallbacks] [preimage] [exposeprivatechannels]
Create an invoice for {msatoshi} with {label} and {description} with optional {expiry} seconds (default 1 hour), optional {fallbacks} address list(default empty list) and optional {preimage} (default autogenerated)
listinvoices [label]
Show invoice {label} (or all, if no {label})
delinvoice label status
Delete unpaid invoice {label} with {status}
delexpiredinvoice [maxexpirytime]
Delete all expired invoices that expired as of given {maxexpirytime} (a UNIX epoch time), or all expired invoices if not specified
autocleaninvoice [cycle_seconds] [expired_by]
Set up autoclean of expired invoices. Perform cleanup every {cycle_seconds} (default 3600), or disable autoclean if 0. Clean up expired invoices that have expired for {expired_by} seconds (default 86400).
waitanyinvoice [lastpay_index]
Wait for the next invoice to be paid, after {lastpay_index} (if supplied)
waitinvoice label
Wait for an incoming payment matching the invoice with {label}, or if the invoice expires
decodepay bolt11 [description]
Decode {bolt11}, using {description} if necessary
help [command]
List available commands, or give verbose help on one {command}.
stop
Shut down the lightningd process
check command_to_check
Don't run {command_to_check}, just verify parameters.
getlog [level]
Show logs, with optional log {level} (info|unusual|debug|io)
fundchannel id satoshi [feerate] [announce] [minconf]
Fund channel with {id} using {satoshi} (or 'all') satoshis, at optional {feerate}. Only use outputs that have {minconf} confirmations.
listconfigs [config]
List all configuration options, or with [config], just that one.
sendpay route payment_hash [label] [msatoshi] [bolt11]
Send along {route} in return for preimage of {payment_hash}
waitsendpay payment_hash [timeout]
Wait for payment attempt on {payment_hash} to succeed or fail, but only up to {timeout} seconds.
listpayments [bolt11] [payment_hash]
Show outgoing payments
listsendpays [bolt11] [payment_hash]
Show sendpay, old and current, optionally limiting to {bolt11} or {payment_hash}.
listpeers [id] [level]
Show current peers, if {level} is set, include logs for {id}
close id [force] [timeout]
Close the channel with {id} (either peer ID, channel ID, or short channel ID). If {force} (default false) is true, force a unilateral close after {timeout} seconds (default 30), otherwise just schedule a mutual close later and fail after timing out.
disconnect id [force]
Disconnect from {id} that has previously been connected to using connect; with {force} set, even if it has a current channel
getinfo
Show information about this node
setchannelfee id [base] [ppm]
Sets specific routing fees for channel with {id} (either peer ID, channel ID, short channel ID or 'all'). Routing fees are defined by a fixed {base} (msat) and a {ppm} (proportional per millionth) value. If values for {base} or {ppm} are left out, defaults will be used. {base} can also be defined in other units, for example '1sat'. If {id} is 'all', the fees will be applied for all channels.
listforwards
List all forwarded payments and their information
ping id [len] [pongbytes]
Send peer {id} a ping of length {len} (default 128) asking for {pongbytes} (default 128)
withdraw destination satoshi [feerate] [minconf]
Send to {destination} address {satoshi} (or 'all') amount via Bitcoin transaction, at optional {feerate}
newaddr [addresstype]
Get a new {bech32, p2sh-segwit} (or all) address to fund a channel (default is bech32)
dev-listaddrs [bip32_max_index]
Show addresses list up to derivation {index} (default is the last bip32 index)
listfunds
Show available funds from the internal wallet
dev-rescan-outputs
Synchronize the state of our funds with bitcoind
pay bolt11 [msatoshi] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee]
Send payment specified by {bolt11} with {amount}
paystatus [bolt11]
Detail status of attempts to pay {bolt11}, or all
listpays [bolt11]
List result of payment {bolt11}, or all
---
run `lightning-cli help ` for more information on a specific command