Docs
Authentication
Authentication
Learn how to authenticate with the YT AI Thumbnail API using API keys.
Authentication
All API requests require authentication using an API key. API keys are scoped to your organization and provide access to all organization resources.
Creating an API Key
- Go to your Dashboard Settings
- Navigate to the "API Keys" section
- Click "Create API Key"
- Give your key a descriptive name (e.g., "Production App", "Development")
- Set an expiration date (optional)
- Copy the key immediately - it will only be shown once
Using Your API Key
Include your API key in the Authorization header of every request:
curl https://yourdomain.com/api/v1/auth/verify \
-H "Authorization: Bearer api_your_key_here"API Key Format
API keys follow this format:
- Prefix:
api_ - Length: 41 characters total
- Example:
api_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
Verifying Your Key
Test that your API key is valid:
curl https://yourdomain.com/api/v1/auth/verify \
-H "Authorization: Bearer api_your_key_here"Response:
{
"data": {
"valid": true,
"organization": {
"id": "uuid",
"name": "Your Organization",
"tier": "creator"
},
"user": {
"id": "uuid",
"name": "John Doe",
"email": "john@example.com"
}
}
}Security Best Practices
- Never expose API keys in client-side code - API keys should only be used server-side
- Use environment variables - Store keys in environment variables, not in code
- Rotate keys regularly - Create new keys periodically and revoke old ones
- Set expiration dates - Use key expiration for additional security
- Use separate keys for development and production - This allows you to revoke dev keys without affecting production
Error Responses
| Status | Error | Description |
|---|---|---|
| 401 | Missing Authorization header | No Authorization header provided |
| 401 | Invalid Authorization header format | Header doesn't match Bearer <token> format |
| 401 | API key not found or expired | Key is invalid, revoked, or expired |
Revoking Keys
To revoke an API key:
- Go to your Dashboard Settings
- Find the key in the "API Keys" section
- Click the delete/revoke button
- Confirm the action
Revoked keys immediately stop working for all requests.