Authentication
Learn how to set up API keys and authenticate your applications with LiveI18n.
API Keys Overview
LiveI18n uses API keys for authentication. Each API key is associated with your organization and provides access to the translation API.
Key Components
Every API request requires two pieces of information:
- API Key: Authenticates your application
- Customer ID: Identifies your organization
Generating API Keys
1. Access the Dashboard
- Log in to your LiveI18n dashboard
- Navigate to "API Keys" in the sidebar
- Enter a discriptive name and click "Create API Key"
2. Secure Your Key
Your API key will only be displayed once. Copy it immediately and store it securely.
After generating your key:
- Copy the API key to your clipboard
- Store it in a secure location (password manager, environment variables)
- Never commit API keys to version control
Using API Keys
Environment Variables
The recommended approach is to store your credentials in a secret manager as environment variables or in .env files:
# Example .env file
REACT_APP_LIVEI18N_API_KEY=your_api_key_here
REACT_APP_LIVEI18N_CUSTOMER_ID=your_customer_id_here
React SDK Setup
import { initializeLiveI18n } from '@livei18n/react-sdk';
// Initialize with environment variables
initializeLiveI18n({
apiKey: process.env.REACT_APP_LIVEI18N_API_KEY,
customerId: process.env.REACT_APP_LIVEI18N_CUSTOMER_ID
});
Testing Your Setup
Using the Demo
Test your API keys with our interactive demo:
- Visit react-demo.livei18n.com
- Enter your API key and customer ID
- Try translating some text
- Verify the translations work correctly
API Testing
You can also test directly with the API:
curl -X POST https://api.livei18n.com/api/v1/translate \
-H "X-API-Key: your_api_key" \
-H "X-Customer-ID: your_customer_id" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, world!",
"locale": "spanish",
"cache_key": "test_key_123"
}'
Security Best Practices
Environment Management
It is best practice to use a separate API key for each environment your application supports.
Key Rotation
Rotate your API keys, regularly or if you suspect they have been compromised:
- Generate a new API key
- Update your applications
- Test thoroughly
- Deactivate the old key
Troubleshooting
Common Issues
401 Unauthorized Error
- Verify your API key is correct
- Check that the customer ID matches
- Ensure the key hasn't been deactivated
Rate Limit Exceeded
- Check your current usage in the dashboard
- Consider upgrading your plan
- Implement proper caching
Getting Help
If you're still having authentication issues:
- Test with the demo
- Contact our support team
Next Steps
Now that authentication is configured:
- Install the React SDK - Start integrating
- Learn basic usage - First translations
- Explore examples - Real-world use cases