---
title: "Roll back to a previous deployment"
method: POST
path: "/v1/functions/{functionId}/rollback"
tags: ["Functions"]
---

# Roll back to a previous deployment

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

Re-deploy a previous version by copying its source, dependencies, and runtime pin onto the function's draft, then deploying. Returns immediately with a deployment ID — poll GET /v1/functions/deployments/{deploymentId} until status is active or failed. Secrets are not rolled back.

## Path parameters

- `functionId` string, required

## Request body

- object
  - `deploymentId` string, required — ID of the deployment to roll back to.

## Response `202`

Rollback deployment queued.

- object
  - `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
  - `rolledBackToVersion` integer
  - `previousDraft` object, nullable — The draft that was replaced, so a UI can offer to restore it.

## Other responses

- `400` — Invalid request or function in a non-deployable state.
- `401` — Unauthorized.
- `404` — Function or deployment 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)
