API Modules
LNbits API
Authentication, wallet management, payments, and invoices
Medusa Pricing API
Historical Bitcoin price data and fiat conversions
Boltz Swap API
Lightning to on-chain swaps via Boltz
Utility APIs
Lightning address resolution, blockchain data, and release management
Getting Started
The Medusa Wallet API is built on top of LNbits and provides additional functionality for pricing and swaps. All API functions are available through the imported modules:Base URL
The default base URL for the LNbits API is:Authentication
Most API endpoints require authentication using one of three key types:User session token obtained from
register() or login()Wallet admin key for privileged operations (payments, wallet management)
Wallet invoice key for read operations (viewing payments, creating invoices)
React Hooks
Medusa Wallet provides React Query hooks for all API functions:Query Hooks
useUser(accessToken)- Fetch user data and walletsusePayments(inkeys, enabled)- Fetch payment historyusePaginatedPayments(...)- Fetch paginated paymentsuseSwaps(adminkey)- Fetch swap historyuseAutoSwaps(adminkey)- Fetch auto-swap configurationsusePaylinks(inkey)- Fetch LNURL paylinks
Mutation Hooks
useCreateInvoice(inkey, amount, memo)- Create Lightning invoiceusePay(adminkey)- Pay Lightning invoice or LNURLuseCreateSwap(adminkey)- Create Boltz swapuseCreateAutoSwap(adminkey)- Create auto-swap configurationuseDeleteAutoSwap(adminkey)- Delete auto-swap
Error Handling
All API functions throw errors with descriptive messages. Use try/catch blocks or React Query’s error handling:TypeScript Support
All API functions are fully typed with TypeScript. Import types from the API modules:Next Steps
LNbits API
Explore authentication and payment functions
Medusa Pricing API
Learn about historical price lookups
Boltz Swap API
Integrate Lightning swaps
Utility APIs
Lightning address, blockchain data, and more