Skip to main content

Get Your API Key

  1. Visit Legnext Dashboard
  2. Log in to your account
  3. Navigate to API Keys section
  4. Create a new API key
  5. Copy and save it securely

Using Your API Key

Method 1: Direct Initialization

TypeScript:
Set the environment variable:
Then in your code:

Method 3: .env File (Node.js)

Create a .env file:
Install and use dotenv:

Method 4: ES Modules

Security Best Practices

⚠️ Never hardcode API keys in your code Always use environment variables Add .env to .gitignore Never expose API keys in client-side JavaScript Rotate keys regularly and revoke compromised ones

Next Steps