From 54c8a19a8928feea4b6c6ab50b2b5952b81e282a Mon Sep 17 00:00:00 2001
From: Andrea Welcome to the Eclair API, this website contains documentation and code examples about how to interact with the Eclair lightning node via its API.
Feel free to suggest improvements and fixes to this documentation by submitting a pull request to the repo. The API
-uses http form data to receive parameteres from the clients, please refer to RFC LINK HERE
+
+ Introduction
Eclair uses HTTP Basic authentication and expects to receive the correct header with every request. Please note that eclair only expects a password and an -empty user name.
+Eclair uses HTTP Basic authentication and expects to receive the correct header with every request.
+To set an API password use the configuration.
+The rest of this document will use '21satoshi' as password which encoded as base64 results in OjIxc2F0b3NoaQ==
Authorization: <Base64EncodedCredentials>
curl "http://example.com/getinfo" -H "Authorization: meowmeowmeow"
+
+
+Authorization: Base64Encoded("":<eclair_api_password>)
+GetInfo
GetInfo
curl -u :<eclair_api_password> -X POST "http://localhost:8080/getinfo"
+
+# with eclair-cli
+eclair-cli getinfo
The above command returns JSON structured like this:
@@ -380,14 +397,17 @@ empty user name.
"blockHeight":123456,
"publicAddresses":[
"34.239.230.56:9735",
- "of7husrflx7sforh3fw6yqlpwstee3wg5imvvmkp4bz6rbjxtg5nljad.onion:9735"
+ "of7husrflx7sforh3fw6yqlpwstee3wg5imvvmkp4bz6rbjxtg5nljad.onion:9735"
]
}
Returns information about this instance such as nodeId and current block height as seen by eclair.
POST http://example.com/getinfo
curl -F uri=<target_uri> "http://example.com/connect" -H "Authorization: meowmeowmeow"
+POST http://localhost:8080/getinfo
+Connect
Connect via URI
curl -u :<eclair_api_password> -X POST -F uri=<target_uri> "http://localhost:8080/connect"
+
+# with eclair-cli
+eclair-cli connect --uri=<target_uri>
The above command returns:
@@ -396,7 +416,7 @@ empty user name.
Connect to another lightning node, this will perform a connection but no channel will be opened.
POST http://example.com/connect
POST http://localhost:8080/connect
String |
curl -F nodeId=<node_id> -F host=1.2.3.4 -F port=1234 "http://example.com/connect" -H "Authorization: meowmeowmeow"
+Connect manually
curl -u :<eclair_api_password> -X POST -F nodeId=<node_id> -F host=<host> -F port=<port> "http://localhost:8080/connect"
+
+# with eclair-cli
+eclair-cli connect --nodeId=<node_id> --host=<host> --port=<port>
The above command returns:
@@ -422,7 +445,7 @@ empty user name.
Connect to another lightning node, this will perform a connection but no channel will be opened.
POST http://example.com/connect
POST http://localhost:8080/connect
Integer |
curl -F nodeId=03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f
--F fundingSatoshis=1234 "http://example.com/open" -H "Authorization: meowmeowmeow"
+Open
Open
curl -X POST -F nodeId=<node_id> -F fundingSatoshis=<funding_satoshis> \
+ "http://localhost:8080/open" -u :<eclair_api_password>
+
+#with eclair-cli
+eclair-cli open --nodeId=<node_id> --fundingSatoshis=<funding_satoshis>
The above command returns the channelId of the newly created channel:
@@ -460,9 +486,9 @@ empty user name.
e872f515dc5d8a3d61ccbd2127f33141eaa115807271dcc5c5c727f3eca914d3
Open a channel to another lightning node, you must specify the target nodeId and the funding satoshis for the new channel. Optionally
-you can send to the remote a 'pushMsat' value and you can specify wether this should be a public or private channel (default is set in the config).
+you can send to the remote a pushMsat value and you can specify wether this should be a public or private channel (default is set in the config).
HTTP Request
-POST http://example.com/open
+POST http://localhost:8080/open
Parameters
@@ -503,17 +529,20 @@ you can send to the remote a 'pushMsat' value and you can specify wether
Integer
-Close
Close
curl -F channelId=03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f "http://example.com/close" -H "Authorization: meowmeowmeow"
+Close
Close
curl -u :<eclair_api_password> -X POST -F channelId=<channel> "http://localhost:8080/close"
+
+#with eclair-cli
+eclair-cli close --channelId=<channel>
The above command returns:
ok
-Initiates a cooperative close for a give channel that belongs to this eclair node, the API returns once the funding_signed message has been negotiated.
-If you specified a scriptPubKey then the closing transaction will spend to that address. Note that you must specify at least a 'channelId' or 'shortChannelId'.
+Initiates a cooperative close for a give channel that belongs to this eclair node, the API returns once the funding_signed message has been negotiated.
+If you specified a scriptPubKey then the closing transaction will spend to that address. Note that you must specify at least a channelId or shortChannelId.
HTTP Request
-POST http://example.com/close
+POST http://localhost:8080/close
Parameters
@@ -542,17 +571,20 @@ If you specified a scriptPubKey then the closing transaction will spend to that
HexString (String)
-Force Close
curl -F channelId=03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f "http://example.com/forceclose" -H "Authorization: meowmeowmeow"
+Force Close
curl -u :<eclair_api_password> -X POST -F channelId=<channel> "http://localhost:8080/forceclose"
+
+#with eclair-cli
+eclair-cli forceclose --channelId=<channel>
The above command returns:
e872f515dc5d8a3d61ccbd2127f33141eaa115807271dcc5c5c727f3eca914d3
-Initiates an unilateral close for a give channel that belongs to this eclair node, once the commitment has been broadcasted the API returns its
-transaction id. Note that you must specify at least a 'channelId' or 'shortChannelId'.
+Initiates an unilateral close for a give channel that belongs to this eclair node, once the commitment has been broadcasted the API returns its
+transaction id. Note that you must specify at least a channelId or shortChannelId.
HTTP Request
-POST http://example.com/forceclose
+POST http://localhost:8080/forceclose
Parameters
@@ -575,18 +607,24 @@ transaction id. Note that you must specify at least a 'channelId' or
ShortChannelId (String)
-UpdateRelayFee
updaterelayfee
curl -F channelId=03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f
- -F feeBaseMsat=10 -F feeProportionalMillionths=5
- "http://example.com/updaterelayfee" -H "Authorization: meowmeowmeow"
+UpdateRelayFee
updaterelayfee
curl -u :<eclair_api_password> -X POST -F channelId=<channel> \
+ -F feeBaseMsat=<feebase> -F feeProportionalMillionths=<feeproportional> \
+ "http://localhost:8080/updaterelayfee"
+
+#eclair-cli
+eclair-cli updaterelayfee \
+ --channelId=<channel> \
+ --feeBaseMsat=<feebase> \
+ --feeProportionalMillionths=<feeproportional>
The above command returns:
ok
-Updates the fee policy for the specified channelId, a new update for this channel will be broadcasted to the network.
+Updates the fee policy for the specified channelId, a new update for this channel will be broadcasted to the network.
HTTP Request
-POST http://example.com/updaterelayfee
+POST http://localhost:8080/updaterelayfee
Parameters
@@ -615,7 +653,10 @@ transaction id. Note that you must specify at least a 'channelId' or
Integer
-Peers
peers
curl "http://example.com/peers" -H "Authorization: meowmeowmeow"
+Peers
peers
curl -u :<eclair_api_password> -X POST "http://localhost:8080/peers"
+
+#with eclair-cli
+eclair-cli peers
The above command returns:
@@ -636,8 +677,11 @@ transaction id. Note that you must specify at least a 'channelId' or
Returns the list of currently known peers, both connected and disconnected.
HTTP Request
-POST http://example.com/peers
-Channels
channels
curl "http://example.com/channels" -H "Authorization: meowmeowmeow"
+POST http://localhost:8080/peers
+Channels
channels
curl -u :<eclair_api_password> -X POST "http://localhost:8080/channels"
+
+#with eclair-cli
+eclair-cli channels
The above command returns:
@@ -764,9 +808,9 @@ transaction id. Note that you must specify at least a 'channelId' or
}
]
-Returns the list of local channels, optionally filtered by remote node.
+Returns the list of local channels, optionally filtered by remote node.
HTTP Request
-POST http://example.com/channels
+POST http://localhost:8080/channels
Parameters
@@ -783,7 +827,10 @@ transaction id. Note that you must specify at least a 'channelId' or
32bytes-HexString (String)
-channel
curl -F channelId=56d7d6eda04d80138270c49709f1eadb5ab4939e5061309ccdacdb98ce637d0e "http://example.com/channel" -H "Authorization: meowmeowmeow"
+channel
curl -u :<eclair_api_password> -X POST -F channelId=<channel> "http://localhost:8080/channel"
+
+#with eclair-cli
+eclair-cli channel --channelId=<channel>
The above command returns:
@@ -911,7 +958,7 @@ transaction id. Note that you must specify at least a 'channelId' or
Returns detailed information about a local channel.
HTTP Request
-POST http://example.com/channel
+POST http://localhost:8080/channel
Parameters
@@ -930,7 +977,10 @@ transaction id. Note that you must specify at least a 'channelId' or
Network
A set of API to query the network view of eclair.
-allnodes
curl "http://example.com/allnodes" -H "Authorization: meowmeowmeow"
+allnodes
curl -u :<eclair_api_password> -X POST "http://localhost:8080/allnodes"
+
+#with eclair-cli
+eclair-cli allnodes
The above command returns:
@@ -962,7 +1012,10 @@ transaction id. Note that you must specify at least a 'channelId' or
]
Returns information about all public nodes on the lightning network, this information is taken from the node_announcement network message.
-allchannels
curl "http://example.com/allchannels" -H "Authorization: meowmeowmeow"
+allchannels
curl -u :<eclair_api_password> -X POST "http://localhost:8080/allchannels"
+
+#with eclair-cli
+eclair-cli allchannels
The above command returns:
@@ -981,7 +1034,10 @@ transaction id. Note that you must specify at least a 'channelId' or
]
Returns non detailed information about all public channels in the network.
-allupdates
curl "http://example.com/allupdates" -H "Authorization: meowmeowmeow"
+allupdates
curl -u :<eclair_api_password> -X POST "http://localhost:8080/allupdates"
+
+#with eclair-cli
+eclair-cli allupdates
The above command returns:
@@ -1021,7 +1077,7 @@ transaction id. Note that you must specify at least a 'channelId' or
The allupdates API is CPU intensive for eclair and might slow down the application.
HTTP Request
-POST http://example.com/allupdates
+POST http://localhost:8080/allupdates
Parameters
@@ -1040,16 +1096,20 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Payments
Interfaces for sending and receiving payments through eclair.
-receive
curl "http://example.com/receive" -H "Authorization: meowmeowmeow"
+receive
curl -u :<eclair_api_password> -X POST -F description=<some_description> \
+ -F amountMsat=<some_amount> "http://localhost:8080/receive"
+
+#with eclair-cli
+eclair-cli receive --description=<some_description> --amountMsat=<some_amount>
The above command returns:
lnbc4200n1pwf36wlpp5dhysplnjqrqzsvlhct07csechwrz7usr5u69e68v5759m4qz46eqdzz2pshjmt9de6zqen0wgsrgv3sypcxj7r9d3ejqct5ypekzar0wd5xjuewwpkxzcm99cxqzjccqp2rzjqwe3ukal9nd7z9d5sk3tfq88pg0089g6phrd7jcjxtsw2meaecvdvzyu2sqq94gqqyqqqqlgqqqqqzsqpcptp3ys9qgxcfnazf7cqluus56anmur8jy2yzj4wcscpw08u8hl5hjwv0uhm7dv3vvqh623289chcen0a35ynjkk8kd6tz38syntfg2gp6nz0wa
-Create a BOLT11 payment invoice.
+Create a BOLT11 payment invoice.
HTTP Request
-POST http://example.com/receive
+POST http://localhost:8080/receive
Parameters
@@ -1078,7 +1138,7 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Seconds (integer)
-send
curl -F invoice=<some_invoice> "http://example.com/send" -H "Authorization: meowmeowmeow"
+send
curl -u :<eclair_api_password> -X POST -F invoice=<some_invoice> "http://localhost:8080/send"
The above command returns:
@@ -1125,9 +1185,9 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
]
}
-Pays a BOLT11 invoice sending the money to the recipient.
+Pays a BOLT11 invoice sending the money to the recipient.
HTTP Request
-POST http://example.com/send
+POST http://localhost:8080/send
Parameters
@@ -1150,7 +1210,7 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Millisatoshi (integer)
-sendToNode
curl -F nodeId=<some_invoice> -F amountMsat=<amount> -F paymentHash=<some_hash> "http://example.com/sendtonode" -H "Authorization: meowmeowmeow"
+sendToNode
curl -u :<eclair_api_password> -X POST -F nodeId=<some_invoice> -F amountMsat=<amount> -F paymentHash=<some_hash> "http://localhost:8080/sendtonode"
The above command returns:
@@ -1197,9 +1257,9 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
]
}
-Pays a BOLT11 invoice sending the money to the recipient.
+Pays a BOLT11 invoice sending the money to the recipient.
HTTP Request
-POST http://example.com/sendtonode
+POST http://localhost:8080/sendtonode
Parameters
@@ -1228,16 +1288,19 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
32bytes-HexString (String)
-checkpayment
curl -F paymentHash=<some_hash> "http://example.com/checkpayment" -H "Authorization: meowmeowmeow"
+checkpayment
curl -u :<eclair_api_password> -X POST -F paymentHash=<some_hash> "http://localhost:8080/checkpayment"
+
+#with eclair-cli
+eclair-cli checkpayment --paymentHash=<some_hash>
The above command returns:
true
-Check whether the given payment hash has been paid.
+Check whether the given payment_hash has been paid.
HTTP Request
-POST http://example.com/checkpayment
+POST http://localhost:8080/checkpayment
Parameters
@@ -1254,7 +1317,10 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
32bytes-HexString (String)
-parseinvoice
curl -F invoice=<some_bolt11invoice> "http://example.com/parseinvoice" -H "Authorization: meowmeowmeow"
+parseinvoice
curl -u :<eclair_api_password> -X POST -F invoice=<some_bolt11invoice> "http://localhost:8080/parseinvoice"
+
+#with eclair-cli
+eclair-cli parseinvoice --invoice=<some_bolt11invoice>
The above command returns:
@@ -1272,7 +1338,7 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Returns detailed information about the given invoice.
HTTP Request
-POST http://example.com/parseinvoice
+POST http://localhost:8080/parseinvoice
Parameters
@@ -1289,7 +1355,10 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
String
-Route
findroute
curl -F invoice=<some_bolt11invoice> "http://example.com/findroute" -H "Authorization: meowmeowmeow"
+Route
findroute
curl -u :<eclair_api_password> -X POST -F invoice=<some_bolt11invoice> "http://localhost:8080/findroute"
+
+#with eclair-cli
+eclair-cli findroute --invoice=<some_bolt11invoice>
The above command returns:
@@ -1302,7 +1371,7 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Finds a route to the node specified by the invoice.
HTTP Request
-POST http://example.com/findroute
+POST http://localhost:8080/findroute
Parameters
@@ -1325,7 +1394,11 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Millisatoshi (Integer)
-findrouteToNode
curl -F nodeId=<some_node> -F amountMsat=<some_amount> "http://example.com/findroutetonode" -H "Authorization: meowmeowmeow"
+findrouteToNode
curl -u :<eclair_api_password> -X POST -F nodeId=<some_node> \
+ -F amountMsat=<some_amount> "http://localhost:8080/findroutetonode"
+
+#with eclair-cli
+eclair-cli --nodeId=<some_node> --amountMsat=<some_amount>
The above command returns:
@@ -1338,7 +1411,7 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Finds a route to the node.
HTTP Request
-POST http://example.com/findroutetonode
+POST http://localhost:8080/findroutetonode
Parameters
@@ -1361,7 +1434,10 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Millisatoshi (Integer)
-Miscellaneous
audit
curl "http://example.com/audit" -H "Authorization: meowmeowmeow"
+Miscellaneous
audit
curl -u :<eclair_api_password> -X POST "http://localhost:8080/audit"
+
+#with eclair-cli
+eclair-cli audit
The above command returns:
@@ -1399,7 +1475,7 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Retrieves information about payments handled by this node such as: sent, received and relayed payments.
HTTP Request
-POST http://example.com/audit
+POST http://localhost:8080/audit
Parameters
@@ -1422,7 +1498,10 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Unix timestamp (Integer)
-networkfees
curl "http://example.com/networkfees" -H "Authorization: meowmeowmeow"
+networkfees
curl -u :<eclair_api_password> -X POST "http://localhost:8080/networkfees"
+
+#with eclair-cli
+eclair-cli networkfees
The above command returns:
@@ -1440,7 +1519,7 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Retrieves information about on-chain fees paid during channel operations.
HTTP Request
-POST http://example.com/networkfees
+POST http://localhost:8080/networkfees
Parameters
@@ -1463,7 +1542,10 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Unix timestamp (Integer)
-channelstats
curl "http://example.com/channelstats" -H "Authorization: meowmeowmeow"
+channelstats
curl -u :<eclair_api_password> -X POST "http://localhost:8080/channelstats"
+
+#with eclair-cli
+eclair-cli channelstats
The above command returns:
@@ -1481,7 +1563,11 @@ The allupdates API is CPU intensive for eclair and might slow down the applicati
Retrieves information about local channels, the information is then aggregated in order to display
statistics about the routing activity of the channels.
HTTP Request
-POST http://example.com/channelstats
+POST http://localhost:8080/channelstats
+Websocket
ws
+This is a simple websocket that will output the payment_hash of incoming payments as soon as they are received.
+HTTP Request
+POST http://localhost:8080/ws
Errors
Example error response:
diff --git a/docs/slate/index.html.md b/docs/slate/index.html.md
index f5a2077b5..062a6fe64 100644
--- a/docs/slate/index.html.md
+++ b/docs/slate/index.html.md
@@ -142,7 +142,7 @@ e872f515dc5d8a3d61ccbd2127f33141eaa115807271dcc5c5c727f3eca914d3
```
Open a channel to another lightning node, you must specify the target nodeId and the funding satoshis for the new channel. Optionally
-you can send to the remote a _pushMsat_ value and you can specify whether this should be a public or private channel (default is set in the config).
+you can send to the remote a _pushMsat_ value and you can specify wether this should be a public or private channel (default is set in the config).
### HTTP Request
@@ -241,7 +241,7 @@ eclair-cli updaterelayfee \
ok
```
-Updates the fee policy for the specified _channelId_, a new update for this channel will be broadcast to the network.
+Updates the fee policy for the specified _channelId_, a new update for this channel will be broadcasted to the network.
### HTTP Request
@@ -1129,4 +1129,14 @@ statistics about the routing activity of the channels.
`POST http://localhost:8080/channelstats`
+# Websocket
+
+## ws
+
+This is a simple [websocket](https://tools.ietf.org/html/rfc6455) that will output the _payment_hash_ of incoming payments as soon as they are received.
+
+### HTTP Request
+
+`POST http://localhost:8080/ws`
+