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

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.