Skip to content

Users & Accounts API

User authentication, registration, profile management, and access control lists (ACLs).

Login (Username & Password)

POST /api/v1/auth

Auth: None

Authenticate with username and password to obtain a Bearer token.

Parameters

FieldTypeRequiredDescription
usernamestringYesAccount username
passwordstringYesAccount password

Response 200

FieldTypeDescription
access_tokenstringJWT Bearer token
token_typestringAlways "bearer"
json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer"
}

Login (User ID)

POST /api/v1/auth/usr

Auth: None

Legacy login method using a user ID string.

Parameters

FieldTypeRequiredDescription
usrstringYesUser ID

Response 200

FieldTypeDescription
access_tokenstringJWT Bearer token
token_typestringAlways "bearer"
json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer"
}

Login (Nostr)

POST /api/v1/auth/nostr

Auth: None

Authenticate using a signed Nostr NIP-98 event.

Parameters

FieldTypeRequiredDescription
nostr_eventstringYesSigned NIP-98 event JSON

Response 200

FieldTypeDescription
access_tokenstringJWT Bearer token
token_typestringAlways "bearer"
json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer"
}

Login (OAuth)

POST /api/v1/auth/{provider}/token

Auth: None

Complete OAuth login flow. Supported providers: google, github, keycloak.

Parameters

FieldTypeRequiredDescription
providerstring (path)YesOAuth provider name

Response 200

FieldTypeDescription
access_tokenstringJWT Bearer token
token_typestringAlways "bearer"
json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer"
}

Get Current User

GET /api/v1/auth

Auth: Bearer token

Returns the authenticated user's profile.

Parameters

None.

Response 200

FieldTypeDescription
idstringUser ID
usernamestringUsername
emailstringEmail address (if set)
display_namestringDisplay name
is_adminbooleanWhether user is an admin
created_atstringISO 8601 creation timestamp
json
{
  "id": "user-uuid",
  "username": "satoshi",
  "email": "satoshi@example.com",
  "display_name": "Satoshi",
  "is_admin": false,
  "created_at": "2024-01-15T10:30:00Z"
}

Register

POST /api/v1/auth/register

Auth: None

Create a new user account. Registration must be enabled on the instance (LNBITS_ALLOW_NEW_ACCOUNTS=true).

Parameters

FieldTypeRequiredDescription
usernamestringYesDesired username
passwordstringYesAccount password
emailstringNoEmail address

Response 201

FieldTypeDescription
access_tokenstringJWT Bearer token
token_typestringAlways "bearer"
json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer"
}

Update Profile

PUT /api/v1/auth/me

Auth: Bearer token

Update the current user's profile.

Parameters

FieldTypeRequiredDescription
display_namestringNoNew display name
emailstringNoNew email address

Response 200

FieldTypeDescription
idstringUser ID
usernamestringUsername
emailstringUpdated email
display_namestringUpdated display name
json
{
  "id": "user-uuid",
  "username": "satoshi",
  "email": "new@example.com",
  "display_name": "Satoshi Nakamoto"
}

Update Password

PUT /api/v1/auth/update-password

Auth: Bearer token

Change the current user's password.

Parameters

FieldTypeRequiredDescription
old_passwordstringYesCurrent password
new_passwordstringYesNew password

Response 200

json
{
  "detail": "Password updated"
}

Reset Password

POST /api/v1/auth/reset-password

Auth: None

Request a password reset email. Requires SMTP to be configured on the instance.

Parameters

FieldTypeRequiredDescription
emailstringYesAccount email address

Response 200

json
{
  "detail": "Password reset email sent"
}

Delete Account

DELETE /api/v1/auth/me

Auth: Bearer token

Destructive Operation

This permanently deletes your account, all wallets, and all payment data. This action cannot be undone.

Parameters

None.

Response 200

json
{
  "detail": "Account deleted"
}

List ACLs

GET /api/v1/auth/acls

Auth: Bearer token

List all Access Control Lists for the current user.

Parameters

None.

Response 200

FieldTypeDescription
idstringACL ID
namestringACL name
allowed_endpointsstring[]List of allowed endpoint patterns
created_atstringISO 8601 creation timestamp
json
[
  {
    "id": "acl-uuid",
    "name": "read-only-dashboard",
    "allowed_endpoints": [
      "GET /api/v1/wallet",
      "GET /api/v1/payments"
    ],
    "created_at": "2024-01-15T10:30:00Z"
  }
]

Create ACL

POST /api/v1/auth/acls

Auth: Bearer token

Create a new Access Control List with specific endpoint permissions.

Parameters

FieldTypeRequiredDescription
namestringYesDescriptive name for the ACL
allowed_endpointsstring[]YesList of "METHOD /path" patterns

Response 201

FieldTypeDescription
idstringACL ID
namestringACL name
allowed_endpointsstring[]Allowed endpoint patterns
json
{
  "id": "acl-uuid",
  "name": "read-only-dashboard",
  "allowed_endpoints": [
    "GET /api/v1/wallet",
    "GET /api/v1/payments"
  ]
}

Update ACL

PUT /api/v1/auth/acls/{acl_id}

Auth: Bearer token

Update an existing ACL's name or allowed endpoints.

Parameters

FieldTypeRequiredDescription
acl_idstring (path)YesACL ID
namestringNoNew name
allowed_endpointsstring[]NoUpdated endpoint patterns

Response 200

json
{
  "id": "acl-uuid",
  "name": "updated-name",
  "allowed_endpoints": [
    "GET /api/v1/wallet"
  ]
}

Delete ACL

DELETE /api/v1/auth/acls/{acl_id}

Auth: Bearer token

Delete an ACL and revoke all its tokens.

Parameters

FieldTypeRequiredDescription
acl_idstring (path)YesACL ID

Response 200

json
{
  "detail": "ACL deleted"
}

Generate ACL Token

POST /api/v1/auth/acls/{acl_id}/tokens

Auth: Bearer token

Generate a new token for an existing ACL. Use this token as a Bearer token - it will only allow the endpoints defined in the ACL.

Parameters

FieldTypeRequiredDescription
acl_idstring (path)YesACL ID

Response 201

FieldTypeDescription
idstringToken ID
tokenstringThe Bearer token to use
acl_idstringParent ACL ID
created_atstringISO 8601 creation timestamp
json
{
  "id": "token-uuid",
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "acl_id": "acl-uuid",
  "created_at": "2024-01-15T10:30:00Z"
}

Revoke ACL Token

DELETE /api/v1/auth/acls/{acl_id}/tokens/{token_id}

Auth: Bearer token

Revoke a specific ACL token. The token will immediately stop working.

Parameters

FieldTypeRequiredDescription
acl_idstring (path)YesACL ID
token_idstring (path)YesToken ID to revoke

Response 200

json
{
  "detail": "Token revoked"
}

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