LSP REST API (BLIP-0051)
Magma's BLIP-0051-compatible REST endpoints for Lightning Service Provider integration. Buy inbound capacity from standard LSP clients.
Magma exposes a BLIP-0051–compatible REST interface so any LSP-aware Lightning client can purchase inbound capacity from the marketplace without speaking GraphQL.
This is the right surface to use when:
- Your client already implements LSPS1 (most LND, LDK, and Phoenix integrations do).
- You want a thin HTTP-only path without managing a GraphQL client.
- You're integrating with mobile wallets or embedded devices.
Otherwise, the GraphQL API gives you more control (custom asset types, marketplace browsing, conditional offers).
Endpoint
https://magma.amboss.tech/api/lsp/v1/{type}{type} selects which Magma seller pool fulfils the order:
type | Pool |
|---|---|
recommended | Amboss's recommended sellers - ranked by reliability and uptime. |
cheapest | The lowest-priced seller on the marketplace at request time. |
All endpoints are public - no API key required.
1. GET /{type}/get_info
Returns the LSP's capabilities and constraints. Call this once at startup to learn what the LSP supports.
curl https://magma.amboss.tech/api/lsp/v1/recommended/get_infoconst res = await fetch(
"https://magma.amboss.tech/api/lsp/v1/recommended/get_info",
);
const info = await res.json();
console.log("Min client balance:", info.min_initial_client_balance_sat);
console.log("Min LSP balance: ", info.min_initial_lsp_balance_sat);
console.log("LSP URIs: ", info.uris);Response
{
"min_required_channel_confirmations": 0,
"min_funding_confirms_within_blocks": 6,
"supports_zero_channel_reserve": false,
"max_channel_expiry_blocks": 12960,
"min_initial_client_balance_sat": "0",
"max_initial_client_balance_sat": "0",
"min_initial_lsp_balance_sat": "500000",
"max_initial_lsp_balance_sat": "100000000",
"min_channel_balance_sat": "500000",
"max_channel_balance_sat": "100000000",
"uris": [
"[email protected]:9735",
"[email protected]:9735"
]
}Field reference
| Field | Type | Meaning |
|---|---|---|
min_required_channel_confirmations | number | Confirmations the LSP requires before considering the channel open. |
min_funding_confirms_within_blocks | number | Max blocks the LSP will wait for the funding TX to confirm. |
supports_zero_channel_reserve | boolean | Whether the LSP can open a channel with 0 reserve. |
max_channel_expiry_blocks | number | The longest channel commitment available, in blocks. |
min_initial_client_balance_sat / max_initial_client_balance_sat | string | Range for the client side at open (currently 0 - Magma sells inbound only). |
min_initial_lsp_balance_sat / max_initial_lsp_balance_sat | string | Range for the LSP side at open (this is your inbound). |
min_channel_balance_sat / max_channel_balance_sat | string | Overall channel-size bounds. |
uris | string[] | Connection strings (pubkey@host:port) the LSP can be reached on. |
uris is a Magma extension to the BLIP-0051 spec - vanilla BLIP-0051 has uris only in the get_order response. Including it in get_info lets clients connect to the LSP before placing an order.
2. POST /{type}/create_order
Reserves an inbound channel. The response includes a BOLT11 invoice the client must pay.
curl -X POST https://magma.amboss.tech/api/lsp/v1/recommended/create_order \
-H "Content-Type: application/json" \
-d '{
"lsp_balance_sat": "2000000",
"client_balance_sat": "0",
"required_channel_confirmations": 6,
"funding_confirms_within_blocks": 6,
"channel_expiry_blocks": 4320,
"token": "",
"announce_channel": false,
"public_key": "03abc...xyz"
}'const res = await fetch(
"https://magma.amboss.tech/api/lsp/v1/recommended/create_order",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
lsp_balance_sat: "2000000", // 2M sats of inbound capacity
client_balance_sat: "0", // Magma doesn't push outbound to clients
required_channel_confirmations: 6,
funding_confirms_within_blocks: 6,
channel_expiry_blocks: 4320, // ~30 days
token: "", // Optional referral / customisation token
announce_channel: false, // Public or private channel
public_key: "03abc...xyz", // Your node's pubkey
}),
},
);
const order = await res.json();
console.log("Pay this invoice:", order.payment.bolt11.invoice);
console.log("Order ID: ", order.order_id);Request body
| Field | Required | Type | Description |
|---|---|---|---|
lsp_balance_sat | ✅ | string | LSP-side balance at channel open. This is your inbound capacity. |
client_balance_sat | ✅ | string | Client-side balance at channel open. Magma only sells inbound, so pass "0". |
required_channel_confirmations | ✅ | number | Confirmations before the client considers the channel live. |
funding_confirms_within_blocks | ✅ | number | Max blocks to wait for the funding TX. |
channel_expiry_blocks | ✅ | number | Lock duration in blocks. Must be ≤ max_channel_expiry_blocks from get_info. |
token | ✅ | string | Optional referral / opaque token. Pass "" if unused. |
refund_onchain_address | ❌ | string | On-chain address for refunds (when on-chain payment is used). |
announce_channel | ✅ | boolean | true for a publicly-announced channel; false for a private channel. |
public_key | ✅ | string | Your node's pubkey. The LSP will connect to and open a channel with this peer. |
Response
{
"order_id": "ec562479-a4b8-44f4-95b4-150b310832de",
"lsp_balance_sat": "2000000",
"client_balance_sat": "0",
"required_channel_confirmations": 6,
"funding_confirms_within_blocks": 6,
"channel_expiry_blocks": 4320,
"token": "",
"created_at": "2026-06-10T12:00:00.000Z",
"announce_channel": false,
"order_state": "CREATED",
"payment": {
"bolt11": {
"state": "EXPECT_PAYMENT",
"expires_at": "2026-06-12T12:00:00.000Z",
"fee_total_sat": "12500",
"order_total_sat": "12500",
"invoice": "lnbc125u1p..."
}
},
"channel": null
}Pay payment.bolt11.invoice from your Lightning wallet. Once it lands, the LSP opens the channel.
3. GET /{type}/get_order?order_id={id}
Polls an order's state. Call this until order_state is COMPLETED (channel opened) or FAILED.
curl "https://magma.amboss.tech/api/lsp/v1/recommended/get_order?order_id=ec562479-a4b8-44f4-95b4-150b310832de"const url = new URL(
"https://magma.amboss.tech/api/lsp/v1/recommended/get_order",
);
url.searchParams.set("order_id", orderId);
const order = await fetch(url).then((r) => r.json());
if (order.order_state === "COMPLETED") {
console.log("Channel funded:", order.channel.funding_outpoint);
}The response shape matches create_order. Once the channel is open, the channel field is populated:
{
"order_state": "COMPLETED",
"payment": { "bolt11": { "state": "PAID", "...": "..." } },
"channel": {
"funded_at": "2026-06-10T12:15:00.000Z",
"funding_outpoint": "5e8a3f...:0",
"expires_at": "2026-07-10T12:15:00.000Z"
}
}Order state reference
order_state
| Value | Meaning |
|---|---|
CREATED | Order created, awaiting payment. |
COMPLETED | LSP has published the funding transaction. |
FAILED | Order failed (payment timeout, LSP couldn't fund, etc.). |
payment.bolt11.state
| Value | Meaning |
|---|---|
EXPECT_PAYMENT | Invoice unpaid. |
HOLD | Payment landed and is held in the HODL invoice (LSP must open channel to claim). |
PAID | LSP has claimed the payment - channel is open. |
REFUNDED | Payment refunded (LSP failed to open channel). |
Errors
The LSP API uses standard HTTP status codes:
| Status | When |
|---|---|
400 Bad Request | Request body or query params malformed. |
404 Not Found | order_id doesn't exist or isn't associated with this type. |
500 Internal Server Error | LSP unable to satisfy the request (e.g. no node available, downstream failure). |
The body is a Nest exception object:
{ "statusCode": 404, "message": "Order not found" }Reference flow
Next steps
- BLIP-0051 spec - the underlying protocol
- Buy Liquidity (GraphQL) - equivalent flow with marketplace controls
- Order Lifecycle - how the LSP
order_statemaps to Magma's internal state machine