Get your API key from cerevox.ai/lexa - it’s free to start.

All Authentication Methods

Test Your Authentication

Copy and run this to verify your setup works:
from cerevox import Lexa, LexaError

def test_auth():
    try:
        client = Lexa()
        
        # Test with sample content
        documents = client.parse(b"Authentication test content")
        
        if documents:
            print("✅ Authentication successful!")
            print(f"📄 Parsed: {documents[0].content}")
            return True
        
    except LexaError as e:
        print(f"❌ API Error: {e.message}")
        if "authentication" in e.message.lower():
            print("💡 Check your API key at cerevox.ai/lexa")
        return False
    except Exception as e:
        print(f"❌ Error: {e}")
        return False

# Run the test
test_auth()

Direct API Usage

Using the REST API directly? Include your API key in the Authorization header:
curl -X POST "https://data.cerevox.ai/v0/parse" \
  -H "Authorization: Bearer your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "files": ["https://example.com/document.pdf"]  
  }'

Common Issues & Solutions

Error: Authentication failed or Invalid API keyQuick fixes:
# Check for extra spaces/quotes
import os
api_key = os.getenv('CEREVOX_API_KEY', '').strip()
print(f"Key length: {len(api_key)}")
print(f"First 8 chars: {api_key[:8]}")

# Get a fresh key from cerevox.ai/lexa if needed
client = Lexa(api_key=api_key)
Error: No API key providedQuick fixes:
# Check if it's set
echo $CEREVOX_API_KEY

# Set it (Linux/Mac)
export CEREVOX_API_KEY="your-key"

# Set it (Windows)
set CEREVOX_API_KEY=your-key

# Verify in Python
import os; print(os.getenv('CEREVOX_API_KEY'))
Error: Connection timeout or network errorsQuick fixes:
# Increase timeout
client = Lexa(timeout=180.0)

# Check proxy settings if needed
import os
os.environ['HTTPS_PROXY'] = 'http://your-proxy:port'

# Test with smaller content first
client.parse(b"small test")
Error: Insufficient permissions or Access deniedQuick fixes:
  • Check your account status at cerevox.ai/lexa
  • Verify your plan includes the features you’re using
  • Check if you’ve hit rate limits (wait a minute and retry)
  • Contact support@cerevox.ai if issues persist

Security Best Practices

Use Environment Variables

Keep API keys out of your code with environment variables

Rotate Keys Regularly

Generate new keys every 90 days for enhanced security

Monitor Usage

Watch for unusual API usage patterns in your dashboard

Least Privilege

Use API keys with only the permissions you need

Production Setup Examples

FROM python:3.9-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

# API key provided at runtime, not in image
CMD ["python", "app.py"]
# Run with API key
docker run -e CEREVOX_API_KEY="your-key" my-lexa-app

Ready to parse? Head to the quickstart guide to make your first API call, or check out code examples.