Skip to main content

Authentication

Login, register, and manage your Trix account from the CLI.

Login

Authenticate with your Trix account to start using the CLI:

# Interactive login (prompts for email/password)
trix auth login

# Login with email
trix auth login --email [email protected]

# Login with API key
trix auth login --api-key gdb_xxx

Using an API key is recommended for scripts and CI/CD environments. Create one with trix keys create --name "my-app".

Registration

Create a new Trix account directly from the CLI:

# Interactive registration
trix auth register

# With flags
trix auth register --email [email protected] --password yourpass

# With invite code (if required)
trix auth register --invite-code TRIX-XXXXXX

Environment Variables

Alternatively, set credentials via environment variables:

# Set API key
export TRIX_API_KEY=your-api-key

# Or set JWT token
export TRIX_TOKEN=your-jwt-token

# Optional: Custom API URL
export TRIX_API_URL=https://api.trixdb.com

# Now run commands without login
trix remember "This works with env vars"

Environment variables take precedence over stored credentials. Useful for temporary authentication or multiple accounts.

Managing Accounts

Check Current User

# Show current user
trix whoami

# Or use auth status
trix auth status

View/Update Profile

# View profile
trix auth profile

# Update profile
trix auth profile --name "John Doe"
trix auth profile --email [email protected]

Switch Between Accounts

# Switch to another account
trix auth switch-account

# This prompts to select from saved accounts

Password Management

Change Password

# Interactive password change
trix auth change-password

# Requires current password for verification

Forgot Password

# Request password reset
trix auth forgot-password --email [email protected]

# Reset with token (from email)
trix auth reset-password --token abc123 --password newpass

Logout

# Logout and clear credentials
trix auth logout

# This only clears the current account credentials

Logging out clears stored credentials from ~/.trix/config.yaml. Environment variables are not affected.

Troubleshooting

Invalid credentials

  • Verify your email and password are correct
  • Check if your account is verified (check email for verification link)
  • Try resetting your password if needed

API key not working

  • Ensure the API key is not expired or revoked
  • Check key permissions in the dashboard
  • Verify the key starts with gdb_

Connection issues

# Test API connectivity
trix doctor

# Check auth status
trix auth status

# Try custom API URL
export TRIX_API_URL=https://api.trixdb.com
trix auth login

Next Steps