Generating API Keys
Navigate to the dashboard keys page and generate a key from the UI: fal.ai/dashboard/keysPermissions
Platform APIs require different key permissions. Learn more about key-based authentication and permissions.API preset
Other presets
Match the preset to the surface you call. If you are not sure, start with a key on the
API preset. You can create a key with more permissions later.Authentication Format
Include your API key in theAuthorization header with the Key prefix:
Usage Examples
cURL
Using a key on theAPI preset for model listing:
BILLING preset for usage data:
Python
Using a key on theAPI preset:
JavaScript
Using a key on theAPI preset:
Best Practices
- Store API keys in environment variables
- Use the preset with the fewest permissions for your use case
- Rotate keys regularly
- Keep
FULLpreset 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
403 Forbidden
The key does not carry the permission the endpoint requires. Create a key on the preset that covers the surface you call, such asBILLING for billing endpoints or COMPUTE for compute endpoints.