Authentication

Secure your API requests with API keys

All LTX-2 API requests require authentication using API keys. API keys are associated with your account and provide access to the API endpoints.

Getting Your API Key

Contact our team to obtain your API key. Each key is unique to your account and should be kept secure.

Using Your API Key

Include your API key in the Authorization header of every request using the Bearer token format:

$Authorization: Bearer YOUR_API_KEY

Example Request

cURL
$curl -X POST https://api.ltx.video/v1/text-to-video \
> -H "Authorization: Bearer YOUR_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "prompt": "A majestic eagle soaring through clouds",
> "model": "ltx-2-pro",
> "duration": 8,
> "resolution": "1280x720"
> }'
Python
1import requests
2
3headers = {
4 "Authorization": "Bearer YOUR_API_KEY",
5 "Content-Type": "application/json"
6}
7
8response = requests.post(
9 "https://api.ltx.video/v1/text-to-video",
10 headers=headers,
11 json={
12 "prompt": "A majestic eagle soaring through clouds",
13 "model": "ltx-2-pro",
14 "duration": 8,
15 "resolution": "1280x720"
16 }
17)

Security Best Practices

Keep your API key secure:

  • Never commit API keys to version control
  • Don’t expose keys in client-side code
  • Use environment variables to store keys
  • Rotate keys periodically

Environment Variables

Store your API key in environment variables:

Bash:

$export LTXV_API_KEY="your_api_key_here"

Python:

1import os
2
3api_key = os.environ.get("LTXV_API_KEY")

Node.js:

1const apiKey = process.env.LTXV_API_KEY;

Authentication Errors

If authentication fails, you’ll receive a 401 Unauthorized response:

1{
2 "type": "error",
3 "error": {
4 "type": "authentication_error",
5 "message": "Invalid API key"
6 }
7}

Common authentication issues:

ErrorCauseSolution
Missing authorization headerNo Authorization headerAdd the header to your request
Invalid API keyKey is incorrect or expiredVerify your API key
Malformed headerIncorrect formatUse Bearer YOUR_API_KEY format

Rate Limits

API keys are subject to rate limits based on your plan. If you exceed your rate limit, you’ll receive a 429 Too Many Requests response.

Contact our team to discuss rate limit increases for your use case.