OpenAPI 3.0.3raw.githubusercontent.com2026-08-17184193610.6 KB

eb3dc75cc05b

Functions

Create function

Create a new Zavu Function. The function starts in draft status. A dedicated API key is auto-provisioned and injected as the ZAVU_API_KEY secret so the function can call back into the Zavu API without manual setup.

Provide sourceCode to seed the draft. Call POST /v1/functions/{functionId}/deploy afterwards to publish.

post/v1/functions

Request body

slugstring required

URL-safe identifier (lowercase, digits, hyphens). Must be unique per project.

namestring required
descriptionstring
runtime'nodejs24'

Runtime the function is deployed on.

timeoutSecinteger

Per-invocation timeout in seconds. Event and cron invocations are asynchronous, so a long timeout only bounds cost; a tool called during a live conversation holds up the reply, and a function exposed over HTTP is additionally bounded by the platform's HTTP response limit.

memoryMb128 | 256 | 512 | 1024
httpEnabledboolean

Whether to expose a public HTTPS URL for this function.

filesobject

The project's source files, keyed by path relative to the project root (e.g. index.ts, lib/orders.ts). Imports between them are resolved when the function is built, so a function can be split across as many files as it needs.

Paths must be relative and use forward slashes; .., node_modules/ and package.json are rejected. npm packages are not uploaded here — declare them under dependencies and Zavu installs them. Limits: 200 files and 900,000 bytes for the whole tree.

entrypointstring

Which file in files is the entry point. Defaults to index.ts.

sourceCodestring

Shortcut for a single-file function: exactly equivalent to sending files with one entry named after entrypoint (index.ts by default). Fully supported — use whichever fits. If both are sent, files wins.

dependenciesobject

npm dependencies. Keys are package names, values are semver ranges.

Example request

{
  "slug": "order-bot",
  "name": "Order Bot",
  "files": {
    "index.ts": "import { formatOrder } from './lib/orders';\n\nexport default async function handler(event) {\n  return { statusCode: 200, body: formatOrder(event) };\n}\n",
    "lib/orders.ts": "export function formatOrder(event) {\n  return JSON.stringify(event);\n}\n"
  },
  "entrypoint": "index.ts",
  "dependencies": {
    "openai": "^4.20.0"
  }
}

Response

Function created.

Example response

{
  "function": {
    "id": "fn_abc123",
    "slug": "order-bot",
    "name": "Order Bot",
    "timeoutSec": 10,
    "memoryMb": 256,
    "dependencies": {
      "openai": "^4.20.0"
    }
  }
}