v1

latestOpenAPI 3.0.32026-07-26172157253.6 KB
Admin

Create new function

Create a new function with code that runs in Deno runtime

post/api/functions

Request body

namestring required

Display name for the function

slugstring

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

codestring required

JavaScript/TypeScript code that exports an async function

descriptionstring

Description of what the function does

status'draft' | 'active'

Initial status (draft or active/deployed)

Example request

{
  "name": "Hello World Function",
  "slug": "hello-world",
  "code": "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",
  "description": "Returns a personalized greeting message"
}

Response

Function created successfully

successboolean

Example response

{
  "function": {
    "slug": "hello-world",
    "name": "Hello World Function"
  }
}