Authentication & API Keys
Every request to the FourA API requires authentication. This page explains how to get, use, and manage your API key.
Getting Your API Key
- Sign in to the FourA Dashboard
- Navigate to Settings
- Find your API key under the API Access section
- Click Copy to copy it to your clipboard
Your API key looks like this: fk_live_a1b2c3d4e5f6...
Using Your API Key
Include your API key in the Authorization header of every request:
curl -X POST https://eu.api.foura.ai/api/v1/tasks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "type": "single"}'
In Python:
import requests
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
response = requests.post(
"https://eu.api.foura.ai/api/v1/tasks",
headers=headers,
json={"url": "https://example.com", "type": "single"}
)
In Node.js:
const response = await fetch('https://eu.api.foura.ai/api/v1/tasks', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ url: 'https://example.com', type: 'single' })
});
API Key Security
Treat your API key like a password:
- Never commit it to version control. Use environment variables instead.
- Never expose it in client-side code. Only use it in server-side applications.
- Rotate if compromised. Generate a new key from the Dashboard and update your applications.
Using Environment Variables
Store your key in an environment variable:
export FOURA_API_KEY="fk_live_a1b2c3d4e5f6..."
Then reference it in your code:
import os
api_key = os.environ["FOURA_API_KEY"]
const apiKey = process.env.FOURA_API_KEY;
Common Authentication Errors
| Error | Cause | Fix |
|---|---|---|
| 401 Unauthorized | Missing or invalid API key | Check the Authorization header format |
| 401 Unauthorized | Extra whitespace in the key | Trim whitespace from the key string |
| 403 Forbidden | API key disabled or expired | Generate a new key from the Dashboard |
Next Steps
- Quick Start: Make your first request
- API Endpoints: Full endpoint reference
- Error Handling: Handle authentication errors gracefully