Hanzo
OpenapiFunctions

Publishes a serverless function under the caller's org and answers 201 with it.

Publishes a serverless function under the caller's org and answers 201 with it.

POST /v1/functions

Addresshttps://api.hanzo.ai/v1/functions
MethodPOST
Operationpost_functions
AuthAuthorization: Bearer $HANZO_API_KEY

Publishes a serverless function under the caller's org and answers 201 with it.

The name is the key and is claimed once; the names that would shadow a collection route are reserved. runtime and environment are the same field — either spelling is accepted — and default to node.

Bounds are clamped rather than refused where a clamp is honest: a timeout above the 900-second ceiling becomes the ceiling instead of silently reverting to the 30-second default, and an omitted memory limit becomes 256Mi. target=fleet runs on the org's own GPU fleet and supports runtime=python only.

Requires a validated principal; the function is owned by that principal's org.

Request

11 fields, body application/json (required).

FieldInTypeRequiredDescription
codebodystringCode is the source to run, capped so one function cannot amplify the store.
envNamesbodystring[]EnvNames are the secret NAMES to mount.
environmentbodystringEnvironment is a second spelling of runtime, accepted so a console that says "environment" needs no translation.
handlerbodystringHandler is the entry point within the code.
imagebodystringImage names a prebuilt image to run instead of source.
memoryLimitbodystringMemoryLimit is the memory the function runs with, defaulting to 256Mi.
namebodystringyesName is the function's org-unique handle and the segment that addresses it, matching ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$.
namespacebodystringNamespace groups functions for display.
runtimebodystringRuntime is the language the code runs under: node, python or deno.
targetbodystringTarget is where the function runs: sandbox (the default) or fleet, the org's own GPU fleet.
timeoutSecbodyintegerTimeoutSec is the per-invocation deadline, defaulting to 30 and clamped at 900 — a larger value is capped rather than reset to the default.

Response

StatusBodyMeaning
201functionViewcreated

201 body — 16 fields.

FieldInTypeAlwaysDescription
avgDurationMsbodynumbermean wall-clock of those runs
createdAtbodystringwhen it was first published
endpointbodystringthe path that invokes it
envCountbodyintegerhow many secret NAMES it mounts; values are never carried
environmentbodystringthe language it runs under
errors7dbodyintegerhow many of those runs failed
imagebodystringthe prebuilt image it runs, when it runs one instead of source
invocations7dbodyintegerruns in the last 7 days; ABSENT, never 0, when it has not run
lastDeployedAtbodystringwhen its code last changed
memoryLimitbodystringthe memory it runs with, and the multiplier on its compute charge
namebodystringthe function's org-unique handle
namespacebodystringthe display group it belongs to; the org is the isolation key
statusbodystringwhether it is ready to serve
successRatebodynumbershare of those runs that succeeded, 0..1
targetbodystringwhere it runs: empty for the sandbox, "fleet" for the org's GPU fleet
timeoutSecbodyintegerits per-invocation deadline

Failure carries the platform error shape — see Errors.

Examples

hanzo functions create --name <name>

Functions API · All Hanzo APIs · Interactive reference

How is this guide?

On this page