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.
Request body
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"
}
}
}Changes
Changed in 4 of the 66 revisions of this API.117
- ○
added the new optional request property
entrypointnew-optional-request-property
- ○
added the new optional request property
filesnew-optional-request-property
- ○
- ○
the
timeoutSecrequest property default value changed from10to30request-property-default-value-changed
- ○
the
timeoutSecrequest property's max was increased from30.00to180.00request-property-max-increased
- ○
- ▲
removed the enum value
nodejs20of the request propertyruntimerequest-property-enum-value-removed
- ●
added the new
nodejs24enum value to thefunction/runtimeresponse property for the response status201response-property-enum-value-added
- ○
added the new
nodejs24enum value to the request propertyruntimerequest-property-enum-value-added
- ○
removed the
nodejs20enum value from thefunction/runtimeresponse property for the response status201response-property-enum-value-removed
- ▲
- ○
endpoint added
endpoint-added
- ○