Generating API Keys
Navigate to the dashboard keys page and generate a key from the UI: fal.ai/dashboard/keysScopes
Platform APIs may require different API key scopes. Learn more about key-based authentication and scopes.API Scope
Most Platform APIs accept API scope keys. This scope is suitable for most use cases including model discovery, pricing, and analytics.
Admin Scope
Some Platform APIs require Admin scope keys for access to sensitive data.
Check the specific Platform API documentation to see which scope is required. If you’re unsure, start with an API scope key. You can always generate an Admin scope key later if needed.
Authentication Format
Include your API key in theAuthorization header with the Key prefix:
Usage Examples
cURL
Using an API scope key for model listing:Python
Using an API scope key:JavaScript
Using an API scope key:Best Practices
- Store API keys in environment variables
- Use the minimum required scope for your use case
- Rotate keys regularly
- Keep Admin API keys secure and never expose them client-side
Troubleshooting
401 Unauthorized
- Verify your API key is correct
- Ensure the
Authorizationheader includes theKeyprefix - Check that your API key hasn’t been revoked