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.
Authorization
AuthorizationheaderrequiredBearer YOUR_API_KEY. Create a key in the dashboard.
Body
application/json
slugstringrequiredURL-safe identifier (lowercase, digits, hyphens). Must be unique per project.
Limitsmin length 1 · max length 50namestringrequiredLimitsmax length 80descriptionstringLimitsmax length 280runtimestringRuntime the function is deployed on.
One ofnodejs24timeoutSecintegerPer-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.
Default30Limitsmin 1 · max 180memoryMbintegerOne of1282565121024Default256httpEnabledbooleanWhether to expose a public HTTPS URL for this function.
DefaultfalsefilesobjectThe 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/andpackage.jsonare rejected. npm packages are not uploaded here — declare them underdependenciesand Zavu installs them. Limits: 200 files and 900,000 bytes for the whole tree.1 properties
{key}string
entrypointstringWhich file in
filesis the entry point. Defaults toindex.ts.Defaultindex.tssourceCodestringShortcut for a single-file function: exactly equivalent to sending
fileswith one entry named afterentrypoint(index.tsby default). Fully supported — use whichever fits. If both are sent,fileswins.Limitsmax length 900000dependenciesobjectnpm dependencies. Keys are package names, values are semver ranges.
1 properties
{key}string
Responses
201Function created.
functionobjectrequiredA Zavu Function — user-supplied TypeScript that runs in Zavu Cloud and reacts to messaging events or HTTP requests.
14 properties
idstringrequiredslugstringrequiredURL-safe identifier, unique per project.
namestringrequireddescriptionstringruntimestringrequiredRuntime the function is deployed on.
One ofnodejs24statusstringrequiredLifecycle status of a Zavu Function.
One ofdraftbundlingdeployingactivefaileddisabledtimeoutSecintegerrequiredPer-invocation timeout in seconds.
memoryMbintegerrequiredMemory allocation in MB.
httpEnabledbooleanrequiredWhether the function can be invoked over HTTPS via its public URL.
publicUrlstring<uri>HTTPS endpoint, present only while httpEnabled is true. Null otherwise, including for a function that was previously exposed — the stored URL stops serving the moment HTTP is turned off, so it is never returned.
dependenciesobjectrequirednpm dependencies installed in the function bundle. Keys are package names, values are semver ranges.
1 properties
{key}string
activeDeploymentIdstringID of the deployment currently serving traffic.
createdAtstring<date-time>requiredupdatedAtstring<date-time>required
400Invalid request (e.g. duplicate slug, invalid dependencies).
codestringrequiredmessagestringrequireddetailsobject
401Unauthorized.
codestringrequiredmessagestringrequireddetailsobject
409A function with this `slug` already exists in the project. Slugs are unique per project.
codestringrequiredmessagestringrequireddetailsobject