Skip to content
WoompaLoompa edited this page Aug 9, 2026 · 1 revision

API

All endpoints live under /clink. Protected endpoints require a valid LNbits user session — a Bearer access token, the session cookie, or (when the LNbits user_id_only auth method is enabled) a ?usr=<user_id> query parameter. The wallet referenced in the request body/query must belong to the authenticated user, otherwise you get 403.

Base URL examples below assume https://<your-lnbits>/clink.

Public

GET /api/v1/info

Extension health + listener status.

{
  "extension": "clink",
  "listener": { "enabled": true },
  "relays": ["wss://relay.damus.io"]
}

POST /api/v1/pay/parse

Parse a noffer1... without paying.

Body: {"noffer": "noffer1..."}{"pubkey", "relay", "offer", "price_type", "price"}. 400 if not a valid noffer.

POST /api/v1/checkout/{offer_id}

Create an invoice for an offer (public checkout flow).

Body (optional): {"amount_sats": 1000}{"bolt11", "payment_hash"}. 400 on invalid amount; 404 if the offer doesn't exist or is inactive.

Relays

Method Path Body Notes
GET /api/v1/relays list relays
POST /api/v1/relays {"url", "enabled": true} adds a relay (400 on bad/duplicate URL)
PUT /api/v1/relays/{relay_id} {"enabled": false} toggle
DELETE /api/v1/relays/{relay_id} remove

Offers

Method Path Body Notes
GET /api/v1/offers?wallet=<id> list offers
POST /api/v1/offers {"wallet", "name?", "amount_msat?", "description?", "relay?"} empty amount_msat → spontaneous offer; returns the noffer1...
PUT /api/v1/offers/{offer_id} {"active": false} activate/deactivate
DELETE /api/v1/offers/{offer_id} delete

Debits

Method Path Body Notes
GET /api/v1/debits?wallet=<id> list debit pointers
POST /api/v1/debits {"wallet", "amount_msat?", "frequency_number?", "frequency_unit?", "budget_msat?", "rules?", "state"?} mints the ndebit1...; rules is a JSON string
PUT /api/v1/debits/{debit_id} {"state": "active"|"pending"} toggle
DELETE /api/v1/debits/{debit_id} delete

rules example: {"allowed_pubkeys": ["<hex>"], "min_msat": 1000, "max_msat": 1000000}.

Pay

Method Path Body Notes
POST /api/v1/pay {"wallet", "noffer", "amount_sats?", "description?"} pays the offer with the wallet; 502 with the CLINK error payload on failure; returns {status, bolt11, payment_hash, offer_id, amount_sats, preimage?}

Plans

Method Path Body Notes
GET /api/v1/plans?wallet=<id> list plans
POST /api/v1/plans {"wallet", "name", "amount_msat", "frequency_number", "frequency_unit", "description?"} frequency_unitday/week/month
PUT /api/v1/plans/{plan_id} {"active": false} toggle
DELETE /api/v1/plans/{plan_id} delete

Subscriptions

Method Path Body Notes
GET /api/v1/subscriptions?wallet=<id> list, enriched with plan_name
POST /api/v1/subscriptions {"wallet", "plan_id", "ndebit", "payer_npub?"} ndebit must decode; first period end = now + plan frequency
PUT /api/v1/subscriptions/{subscription_id} {"state": "active"|"paused"|"cancelled"} resume resets attempts
POST /api/v1/subscriptions/{subscription_id}/renew bill the current period now
DELETE /api/v1/subscriptions/{subscription_id} delete

Pages

  • GET / — extension index (auth)
  • GET /pay — pay-an-offer page (auth)
  • GET /subscriptions — plans & subscriptions page (auth)
  • GET /checkout/{offer_id} — public checkout page

Clone this wiki locally