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
Most Platform APIs accept a key with the
API preset. This preset
covers model discovery, model analytics, and the requests you submit.Other presets
Some Platform APIs read sensitive data and need more permissions. Billing
endpoints need the
BILLING preset, compute endpoints need the
COMPUTE preset, and a key with the FULL preset reaches every
endpoint.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.