Skip to main content
LibreChat provides powerful command-line tools for managing user accounts. All user management commands are run from the project root directory.

Available Commands

Create User

Create new user accounts with custom settings

Invite User

Send invitation emails to new users

List Users

View all registered users

Ban User

Ban or unban user accounts

Delete User

Permanently delete user accounts

Reset Password

Reset user passwords

Create User

Create a new user account with email, name, and username.

Usage

npm run create-user <email> <name> <username> [password] [--email-verified=true]

Interactive Mode

If you don’t provide arguments, you’ll be prompted for each value:
npm run create-user
The script will ask for:
  • Email: User’s email address (required)
  • Name: Display name (defaults to email prefix)
  • Username: Username (defaults to email prefix)
  • Password: Leave blank to auto-generate
  • Email Verified: Whether the email is pre-verified (Y/n)

Examples

npm run create-user [email protected] "John Doe" johndoe
Passing passwords as command-line arguments is not recommended for security reasons. Use interactive mode or leave blank to auto-generate.

Email Verification Behavior

The user can log in immediately without needing to verify their email.
  • If email service is configured: User receives a verification email
  • If email service is NOT configured: Set ALLOW_UNVERIFIED_EMAIL_LOGIN=true in your .env file, or the user must attempt login to receive a verification link

Invite User

Send an invitation email to a new user. Requires email service to be configured.

Usage

npm run invite-user <email> [name]

Example

npm run invite-user [email protected] "Jane Smith"
The invitation email includes a registration link with a secure token that expires after a set period.

List Users

Display all registered users in the system.

Usage

npm run list-users

Output

The command displays:
  • Email address
  • Username
  • Name
  • Account status (active/banned)
  • Email verification status
  • Registration date

Ban User

Ban or unban a user account. Banned users cannot log in.

Usage

npm run ban-user <email>

Interactive Mode

npm run ban-user
You’ll be prompted for:
  • Email: User’s email address
  • Ban: Whether to ban (true) or unban (false)

Examples

npm run ban-user [email protected]
Banned users retain all their data (conversations, files, etc.) but cannot access the system.

Delete User

Permanently delete a user account and all associated data.

Usage

npm run delete-user <email>

Interactive Mode

npm run delete-user
This action is irreversible!Deleting a user removes:
  • User account
  • All conversations
  • All messages
  • All files
  • All presets
  • All prompts
  • All bookmarks
  • Transaction history
Consider banning the user instead if you may need to restore access later.

Confirmation

The script will:
  1. Display the user’s information
  2. Ask for confirmation before proceeding
  3. Show a summary of deleted data

Reset Password

Reset a user’s password to a new value or auto-generate one.

Usage

npm run reset-password <email> [new_password]

Interactive Mode

npm run reset-password
You’ll be prompted for:
  • Email: User’s email address
  • New Password: Leave blank to auto-generate

Examples

npm run reset-password [email protected] NewSecurePass123
When auto-generating, the script will display the new password. Make sure to communicate it securely to the user.

User Statistics

View statistics about a specific user’s usage.

Usage

npm run user-stats <email>

Displayed Information

  • Total conversations
  • Total messages sent
  • Total tokens used
  • Files uploaded
  • Agents created
  • Prompts created
  • Account creation date
  • Last login

Best Practices

1

Use Interactive Mode for Sensitive Data

Avoid passing passwords or sensitive information as command-line arguments. Use interactive mode instead for better security.
2

Verify Before Deleting

Always verify user information before deletion. Consider banning instead of deleting to preserve data.
3

Document Admin Actions

Keep a log of administrative actions, especially user deletions and bans, for audit purposes.
4

Test in Development First

Test user management commands in a development environment before running them in production.

Troubleshooting

  • Verify the email address spelling
  • Check if the user was previously deleted
  • Use npm run list-users to see all registered users
The email must contain an @ symbol and be in a valid format.
  • Ensure MongoDB is running and accessible
  • Check your MONGO_URI in .env
  • Verify network connectivity to the database
  • Verify email service is configured in .env
  • Check EMAIL_SERVICE, EMAIL_USERNAME, EMAIL_PASSWORD
  • Test SMTP connection settings
See also:

Build docs developers (and LLMs) love