Skip to content

Authentication

Authenticate API requests using API keys, Bearer tokens, or ACL tokens. Every endpoint states which auth method it requires.

LNbits supports three authentication methods. Which one you need depends on the endpoint:

MethodScopeHeaderUse Case
API KeySingle walletX-Api-Key: KEYWallet operations, payments
Bearer Token (JWT)User accountAuthorization: Bearer TOKENMulti-wallet management, account settings
ACL TokenCustomAuthorization: Bearer TOKENFine-grained access control

API Keys

Every wallet has two keys with different permission levels:

KeyPermissionsUse For
Admin keyRead + write + sendSending payments, deleting wallets, server-side operations
Invoice keyRead + receive onlyCreating invoices, checking balances, client-side apps

Using API Keys

Pass the key via the X-Api-Key header (recommended) or as a query parameter:

bash
# Header (recommended)
curl -H "X-Api-Key: YOUR_ADMIN_KEY" \
  https://your-lnbits.com/api/v1/wallet

# Query parameter
curl "https://your-lnbits.com/api/v1/wallet?api-key=YOUR_INVOICE_KEY"

Finding Your Keys

  1. Log in to the LNbits UI
  2. Select a wallet from the sidebar
  3. Click the eye icon next to "API info" to reveal the keys

Or retrieve them via the API (using an Invoice key):

bash
curl https://your-lnbits.com/api/v1/wallet \
  -H "X-Api-Key: YOUR_INVOICE_KEY"

Response:

json
{
  "id": "wallet-uuid",
  "name": "My Wallet",
  "balance": 50000,
  "adminkey": "a1b2c3...",
  "inkey": "d4e5f6..."
}

Bearer Tokens (JWT)

For user-level operations - managing multiple wallets, updating your profile, or installing extensions - authenticate with a Bearer token.

Obtain a Token

bash
curl -X POST https://your-lnbits.com/api/v1/auth \
  -H "Content-Type: application/json" \
  -d '{"username": "satoshi", "password": "your-password"}'

Response:

json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer"
}

Other login methods also return Bearer tokens:

MethodEndpoint
Username & passwordPOST /api/v1/auth
User ID (legacy)POST /api/v1/auth/usr
Nostr (NIP-98)POST /api/v1/auth/nostr
Google OAuthPOST /api/v1/auth/google/token
GitHub OAuthPOST /api/v1/auth/github/token
KeycloakPOST /api/v1/auth/keycloak/token

Use the Token

bash
curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  https://your-lnbits.com/api/v1/wallets

ACL Tokens

Access Control Lists (ACLs) let you create tokens with custom permissions - restrict access to specific endpoints.

Create an ACL

bash
curl -X POST https://your-lnbits.com/api/v1/auth/acls \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "read-only-dashboard",
    "allowed_endpoints": [
      "GET /api/v1/wallet",
      "GET /api/v1/payments"
    ]
  }'

Generate an ACL Token

bash
curl -X POST https://your-lnbits.com/api/v1/auth/acls/{acl_id}/tokens \
  -H "Authorization: Bearer YOUR_TOKEN"

Revoke an ACL Token

bash
curl -X DELETE https://your-lnbits.com/api/v1/auth/acls/{acl_id}/tokens/{token_id} \
  -H "Authorization: Bearer YOUR_TOKEN"

Permission Matrix

EndpointInvoice KeyAdmin KeyBearer TokenACL Token
GET /api/v1/wallet (balance)YesYesYesConfigurable
POST /api/v1/payments (receive)YesYesYesConfigurable
POST /api/v1/payments (send)NoYesYesConfigurable
PUT /api/v1/wallet (rename)NoYesYesConfigurable
DELETE /api/v1/walletNoYesYesConfigurable
GET /api/v1/wallets (list all)NoNoYesConfigurable
PUT /api/v1/auth/me (profile)NoNoYesConfigurable
POST /api/v1/extension (install)NoNoYesConfigurable
POST /api/v1/auth/registerNone required---
GET /admin/api/v1/*NoNoSuper UserNo

TIP

When in doubt, use the Admin key for server-side integrations and the Invoice key for anything exposed to end users (client-side apps, public kiosks).

News · Shop · SaaS · Telegram · Released under the MIT License.