Skip to main content

Generating API Keys

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

Scopes

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.
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:
For endpoints requiring Admin scope:

Usage Examples

cURL

Using an API scope key for model listing:
Using an Admin scope key for usage data:

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 Authorization header includes the Key prefix
  • Check that your API key hasn’t been revoked

403 Forbidden

Your API key may not have the required scope for the endpoint. Check the endpoint documentation to determine if it requires an Admin scope key, and generate one from the dashboard if needed.