Get Your API Key
- Visit Legnext Dashboard
- Log in to your account
- Navigate to API Keys section
- Create a new API key
- Copy and save it securely
Using Your API Key
Method 1: Direct Initialization
Method 2: Environment Variable (Recommended)
Set the environment variable:Method 3: Using dotenv Crate
Add toCargo.toml:
.env file:
Security Best Practices
⚠️ Never hardcode API keys in your code ✅ Always use environment variables or .env files ✅ Add.env to .gitignore
✅ Use expect() or proper error handling for missing keys
✅ Rotate keys regularly and revoke compromised ones