v1
latestOpenAPI 3.1.02026-07-22115189303.8 KBFunctions
Create function secret
Create a secret for this function. Secrets are injected as environment variables when your function executes.
Use secrets to store sensitive data without hardcoding in function code:
- API keys (Stripe, OpenAI, Twilio, etc.)
- External service connection strings
- OAuth credentials
- Service account tokens
Requirements:
- Function must be in 'deployed' status (422 if not)
- Secret name must be uppercase alphanumeric with underscores (e.g., STRIPE_API_KEY)
- Secret name must be unique within the function
Secret types are automatically detected:
- String values → text type
- Object/array values → json type
Important: The secret value is only returned in the creation response. It cannot be retrieved later. Store the value securely after creation if needed.
After creating a secret, it's immediately available in your function as an environment variable with the specified name.
post/functions/{function_id}/secrets
Request body
Example request
{
"secret": {
"name": "STRIPE_API_KEY"
}
}Response
Secret created successfully