Skip to content

Deploy function

View .md
POST

Publish the function. If sourceCode or dependencies are provided in the body, they replace the current draft before deployment. Returns immediately with a deployment ID — poll GET /v1/functions/deployments/{deploymentId} until status is active or failed.

Authorization

  • Authorizationheaderrequired

    Bearer YOUR_API_KEY. Create a key in the dashboard.

Path parameters

  • functionIdstringrequired

    Zavu Function ID.

Body

application/json · optional

  • 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

Responses

202Deployment queued.
  • deploymentobjectrequired
    10 properties
    • idstringrequired
    • functionIdstringrequired
    • versionintegerrequired

      Monotonically increasing deployment version, starting at 1.

    • statusstringrequired

      Stage of a function deployment.

      One ofpendingbundlinguploadingpublishingactivefailedsuperseded
    • sourceCodeBytesintegernullable

      Total size of the deployed source tree in bytes.

    • bundleBytesintegernullable

      Size of the built bundle in bytes. Null until the build finishes.

    • errorMessagestringnullable

      Failure reason when status is 'failed'.

    • buildLogsstringnullable

      What the build printed: dependency installation, the bundler's output, and the compiler's message when it failed. Returned when fetching a single deployment, omitted from the list. Read this first when a deploy fails — errorMessage is often the outer wrapper's summary, and the line that names the broken import or the syntax error is here.

    • deployedAtstring<date-time>nullable
    • createdAtstring<date-time>required
400Invalid request or function in a non-deployable state.
  • codestringrequired
  • messagestringrequired
  • detailsobject
401Unauthorized.
  • codestringrequired
  • messagestringrequired
  • detailsobject
404Function not found.
  • codestringrequired
  • messagestringrequired
  • detailsobject