Generating API Keys
Navigate to the dashboard keys page and generate a key from the UI: fal.ai/dashboard/keys
Required Scope
fal API endpoints require Admin scope API keys. When generating keys in the dashboard, select the ADMIN scope.
Admin keys provide:
- Full access to fal API endpoints
- Access to usage and analytics data
- Access to pricing and estimation endpoints
- Access to private models and CLI operations
Admin API keys have elevated permissions and should be kept secure. Never expose them in client-side code.
Include your Admin API key in the Authorization header with the Key prefix:
Authorization: Key YOUR_ADMIN_API_KEY
Usage Examples
cURL
curl -X GET "https://api.fal.ai/v1/model-apis?limit=10" \
-H "Authorization: Key YOUR_ADMIN_API_KEY"
Python
import requests
headers = {
"Authorization": "Key YOUR_ADMIN_API_KEY"
}
response = requests.get(
"https://api.fal.ai/v1/model-apis",
headers=headers,
params={"limit": 10}
)
print(response.json())
JavaScript
const response = await fetch('https://api.fal.ai/v1/model-apis?limit=10', {
headers: {
'Authorization': 'Key YOUR_ADMIN_API_KEY'
}
});
const data = await response.json();
console.log(data);
Best Practices
- Store API keys in environment variables
- Rotate keys regularly
- Keep Admin API keys secure and never expose them client-side
Troubleshooting
401 Unauthorized
- Verify your Admin API key is correct
- Ensure the
Authorization header includes the Key prefix
- Check that your API key hasn’t been revoked
403 Forbidden
Your API key may not have Admin permissions. Ensure you’re using an Admin API key from the dashboard.