Skip to main content
POST
/
keys
Create API Key
curl --request POST \
  --url https://api.fal.ai/v1/keys \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "alias": "Production Key"
}
'
import requests

url = "https://api.fal.ai/v1/keys"

payload = { "alias": "Production Key" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({alias: 'Production Key'})
};

fetch('https://api.fal.ai/v1/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
{
  "key_id": "abc123def456",
  "key_secret": "sk_live_abc123def456xyz789",
  "key": "abc123def456:sk_live_abc123def456xyz789"
}
{
"error": {
"type": "validation_error",
"message": "Invalid request parameters"
}
}
{
"error": {
"type": "authorization_error",
"message": "Authentication required"
}
}
{
"error": {
"type": "authorization_error",
"message": "Access denied"
}
}
{
"error": {
"type": "rate_limited",
"message": "Rate limit exceeded"
}
}
{
"error": {
"type": "server_error",
"message": "An unexpected error occurred"
}
}

Authorizations

Authorization
string
header
required

Admin API key must be prefixed with "Key ", e.g. Authorization: Key YOUR_ADMIN_API_KEY

Body

application/json

Request body for creating a new API key

alias
string
required

Required friendly name for the API key

Required string length: 1 - 255
Example:

"Production Key"

Response

API key created successfully. Store the key_secret securely - it will not be shown again.

Response containing the newly created API key credentials. The key_secret is only returned once.

key_id
string
required

Unique identifier for the newly created API key

Example:

"abc123def456"

key_secret
string
required

Secret portion of the API key. IMPORTANT: This is only returned once at creation time and cannot be retrieved again.

Example:

"sk_live_abc123..."

key
string
required

Full API key in the format 'key_id:key_secret'. Use this value directly for API authorization. IMPORTANT: This is only returned once at creation time and cannot be retrieved again.

Example:

"abc123def456:sk_live_abc123..."