Skip to main content
POST
Create function

Authorizations

Authorization
string
header
required

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

Body

application/json
slug
string
required

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

Required string length: 1 - 50
Example:

"order-bot"

name
string
required
Maximum string length: 80
Example:

"Order Bot"

description
string
Maximum string length: 280
runtime
enum<string>

Runtime the function is deployed on.

Available options:
nodejs24
timeoutSec
integer
default:30

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.

Required range: 1 <= x <= 180
memoryMb
enum<integer>
default:256
Available options:
128,
256,
512,
1024
httpEnabled
boolean
default:false

Whether to expose a public HTTPS URL for this function.

files
object

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.

Example:
entrypoint
string
default:index.ts

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

Example:

"index.ts"

sourceCode
string

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.

Maximum string length: 900000
dependencies
object

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

Example:

Response

Function created.

function
object
required

A Zavu Function — user-supplied TypeScript that runs in Zavu Cloud and reacts to messaging events or HTTP requests.