---
title: "Deploy function"
method: POST
path: "/v1/functions/{functionId}/deploy"
tags: ["Functions"]
---

# Deploy function

`POST /v1/functions/{functionId}/deploy`

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

## Path parameters

- `functionId` string, required

## Request body

- FunctionDeployRequest — Optional source/dependencies update applied before deploying. Omit both fields to redeploy the current draft as-is.
  - `sourceCode` string — New source code to publish (replaces the draft).
  - `dependencies` object — New dependency map (replaces existing dependencies).

## Response `202`

Deployment queued.

- FunctionDeploymentResponse
  - `deployment` FunctionDeployment, required
    - `id` string, required
    - `functionId` string, required
    - `version` integer, required — Monotonically increasing deployment version, starting at 1.
    - `status` 'pending' | 'bundling' | 'uploading' | 'publishing' | 'active' | 'failed' | 'superseded', required — Stage of a function deployment.
    - `sourceCodeBytes` integer, nullable
    - `bundleBytes` integer, nullable
    - `errorMessage` string, nullable — Failure reason when status is 'failed'.
    - `deployedAt` string, date-time, nullable
    - `createdAt` string, date-time, required

## Other responses

- `400` — Invalid request or function in a non-deployable state.
- `401` — Unauthorized.
- `404` — Function not found.

---

[API](https://skmtc.net/zavudev/apis/zavu-unified-messaging-layer-api.md) · [All operations](https://skmtc.net/zavudev/apis/zavu-unified-messaging-layer-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/zavudev/zavu-unified-messaging-layer-api/versions/07b87b6ae707/schema)
