Skip to main content

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

  1. Log in to your LiveI18n dashboard
  2. Navigate to "API Keys" in the sidebar
  3. Enter a discriptive name and click "Create API Key"

2. Secure Your Key

danger

Your API key will only be displayed once. Copy it immediately and store it securely.

After generating your key:

  1. Copy the API key to your clipboard
  2. Store it in a secure location (password manager, environment variables)
  3. 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:

  1. Visit react-demo.livei18n.com
  2. Enter your API key and customer ID
  3. Try translating some text
  4. 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:

  1. Generate a new API key
  2. Update your applications
  3. Test thoroughly
  4. 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:

  1. Test with the demo
  2. Contact our support team

Next Steps

Now that authentication is configured: