Skip to main content

Generating API Keys

Navigate to the dashboard keys page and generate a key from the UI: fal.ai/dashboard/keys

Permissions

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.
API keys should be kept secure and never exposed in client-side code or public repositories.

Authentication Format

Include your API key in the Authorization header with the Key prefix:
The header is the same for every preset. Only the permissions of the key change.

Usage Examples

cURL

Using a key on the API preset for model listing:
Using a key on the BILLING preset for usage data:

Python

Using a key on the API preset:

JavaScript

Using a key on the API preset:

Best Practices

  • Store API keys in environment variables
  • Use the preset with the fewest permissions for your use case
  • Rotate keys regularly
  • Keep FULL preset keys secure and never expose them client-side

Troubleshooting

401 Unauthorized

  • Verify your API key is correct
  • Ensure the Authorization header includes the Key prefix
  • 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 as BILLING for billing endpoints or COMPUTE for compute endpoints.