Start
Authentication
Authenticate requests with API keys, follow security practices, and handle auth errors.
All requests to Felo API Platform APIs require authentication using an API Key. This guide explains how to authenticate your requests and handle common authentication issues.
API Key Authentication
Felo uses API Key authentication for all v2 endpoints. Your API Key identifies your application and provides access to the platform's capabilities.
How It Works
- You obtain an API Key from the Felo API Platform API Keys page
- You include the API Key in the
Authorizationheader of every API request - The platform validates your API Key and processes your request
Header Format
Include your API Key in the Authorization header using the Bearer authentication scheme:
Authorization: Bearer YOUR_API_KEYExample Request
curl -X POST https://openapi.felo.ai/v2/chat \
-H "Authorization: Bearer sk_live_abc123xyz789" \
-H "Content-Type: application/json" \
-d '{"query": "What is machine learning?"}'Obtaining Your API Key
To get your API Key:
- Open the Felo API Platform API Keys page
- Sign in with your Felo account if prompted
- Enter a key name and click Create Key
- Copy the full key when it appears. It is only shown once
- Store the key securely and use it as
FELO_API_KEY
Security Best Practices
1. Store API Keys Securely
Don't hardcode API Keys in your source code:
# ❌ Bad - API Key exposed in code
api_key = "sk_live_abc123xyz789"Do use environment variables or secure configuration:
# ✅ Good - API Key from environment
import os
api_key = os.environ.get('FELO_API_KEY')2. Use Environment Variables
Store your API Key in environment variables:
Linux/macOS:
export FELO_API_KEY="sk_live_abc123xyz789"Windows (Command Prompt):
set FELO_API_KEY=sk_live_abc123xyz789Windows (PowerShell):
$env:FELO_API_KEY="sk_live_abc123xyz789"3. Rotate Keys Regularly
Periodically generate new API Keys and revoke old ones to minimize security risks.
4. Use Different Keys for Different Environments
Create separate API Keys for development, staging, and production environments.
5. Never Expose Keys in Client-Side Code
API Keys should only be used in server-side code. Never include them in:
- Frontend JavaScript code
- Mobile app source code
- Public repositories
- Client-side configuration files
Authentication Errors
For the full error envelope, rate-limit headers, and retry policy, see Errors, Limits, and Retries.
Common Error Codes
| HTTP | Code | Meaning |
|---|---|---|
| 401 | UNAUTHORIZED | Missing, invalid, expired, or revoked key |
| 429 | RATE_LIMITED | Too many requests; see the Errors, Limits, and Retries guide |
A rejected request returns the key status in message:
{
"status": 401,
"code": "UNAUTHORIZED",
"message": "API Key is required",
"request_id": "..."
}status is the HTTP status code. A revoked key reports API Key has been revoked (keyPrefix=...). Branch on the HTTP status and code, not on the exact wording of message.
Troubleshooting
If authentication fails:
- Check that the header is exactly
Authorization: Bearer YOUR_API_KEY. - Confirm the key has not been revoked on the API Keys page.
- Confirm the environment is using the key you expect.
- Generate a new key if the old one was deleted or rotated. A full key is shown only once, at creation.
For a symptom-first checklist that covers authentication and the rest of the platform, see Troubleshooting.
Example: Debugging Authentication
import requests
url = "https://openapi.felo.ai/v2/chat"
api_key = "YOUR_API_KEY"
# Correct format
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, json={"query": "test"})
if response.status_code == 401:
error = response.json()
print(f"Authentication failed: {error['code']}")
print(f"Message: {error['message']}")
print(f"Request ID: {error['request_id']}")
else:
print("Authentication successful!")Rate Limiting
Rate limits are enforced per endpoint, not globally per API Key. Currently only `/v2/chat` enforces them; users with an effective paid Felo subscription are exempt. Other /v2/** endpoints have no enforced rate limits.
A 429 response includes X-RateLimit-* headers and Retry-After. Always read effective limits from the response headers, not from documentation.
For the full rate-limit dimensions, headers, and retry policy, see Errors, Limits, and Retries.
Need Help?
If you're experiencing authentication issues:
- Review this guide carefully
- Check the Getting Started guide
- Verify your API Key on the API Keys page
- Contact support at [email protected] with your request ID
Next Steps
- Getting Started Guide - Learn how to make your first API call
- Chat API Reference - Explore the Chat API documentation
Need help?
- Contact Support for API, billing, and account questions.
- Chat with Felo developers on Discord.
- Check out our changelog.
- Need volume pricing or procurement help? Contact Sales.
- Building with an LLM? Read llms.txt.