POST
/
api
/
functions
{
"success": true,
"function": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"slug": "hello-world",
"name": "Hello World Function",
"description": "Returns a greeting message",
"status": "active",
"created_at": "2024-01-21T10:30:00Z"
}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required

Display name for the function

Minimum length: 1
Example:

"Hello World Function"

code
string
required

JavaScript/TypeScript code that exports an async function

Minimum length: 1
Example:

"export default async function(request) {\n const { name = 'World' } = await request.json();\n return new Response(\n JSON.stringify({ message:Hello, ${name}!}),\n { headers: { 'Content-Type': 'application/json' } }\n );\n}\n"

slug
string

URL-friendly identifier (auto-generated from name if not provided)

Example:

"hello-world"

description
string

Description of what the function does

Example:

"Returns a personalized greeting message"

status
enum<string>
default:active

Initial status (draft or active/deployed)

Available options:
draft,
active

Response

Function created successfully

success
boolean
function
object