Skip to content

Update function draft

View .md
PATCH

Update an existing function. sourceCode / dependencies edit the draft without triggering a build — they go live on the next POST /v1/functions/{functionId}/deploy. httpEnabled is applied to the deployed function immediately, so turning the public endpoint on or off does not require a redeploy.

Authorization

  • Authorizationheaderrequired

    Bearer YOUR_API_KEY. Create a key in the dashboard.

Path parameters

  • functionIdstringrequired

    Zavu Function ID.

Body

application/json

  • 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.

    1 properties
    • {key}string
  • entrypointstring

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

    Defaultindex.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.

    Limitsmax length 900000
  • dependenciesobject

    New dependency map (replaces existing dependencies).

    1 properties
    • {key}string
  • httpEnabledboolean

    Expose the function on its public HTTPS URL, or take it down. Applies to the already-deployed function without redeploying; the URL is returned as publicUrl.

Responses

200Draft updated.
  • functionobjectrequired

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

    14 properties
    • idstringrequired
    • slugstringrequired

      URL-safe identifier, unique per project.

    • namestringrequired
    • descriptionstringnullable
    • runtimestringrequired

      Runtime the function is deployed on.

      One ofnodejs24
    • statusstringrequired

      Lifecycle status of a Zavu Function.

      One ofdraftbundlingdeployingactivefaileddisabled
    • timeoutSecintegerrequired

      Per-invocation timeout in seconds.

    • memoryMbintegerrequired

      Memory allocation in MB.

    • httpEnabledbooleanrequired

      Whether the function can be invoked over HTTPS via its public URL.

    • publicUrlstring<uri>nullable

      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.

    • dependenciesobjectrequired

      npm dependencies installed in the function bundle. Keys are package names, values are semver ranges.

      1 properties
      • {key}string
    • activeDeploymentIdstringnullable

      ID of the deployment currently serving traffic.

    • createdAtstring<date-time>required
    • updatedAtstring<date-time>required
400No fields provided.
  • codestringrequired
  • messagestringrequired
  • detailsobject
401Unauthorized.
  • codestringrequired
  • messagestringrequired
  • detailsobject
404Function not found.
  • codestringrequired
  • messagestringrequired
  • detailsobject