Docs

Remove a preview

POST
/projects/{project_id}/previews/remove

Ends a preview before it expires: the URL stops being served at once. The deployments to it stay in the history.

Idempotent: a URL with no live preview, including one that has already expired or was removed before, answers 204 too, so a cleanup that races the expiry still succeeds.

The URL travels in the body rather than the path because an origin contains /.

Authorization

oauth2 deployment.write
headerAuthorizationBearer <token>

Scope: deployment.write

Path Parameters

project_id*string

The unique identifier of the project.

Match^[a-zA-Z0-9_-]+$

Request Body

application/json
  1. body

The preview to remove.

origin*Origin

The preview URL, exactly as GET /projects/{project_id}/previews lists it.

Match^https?://(\[[0-9a-f:.]+\]|[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*)(:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3}))?$
Lengthlength <= 2048

Response Body

The URL has no live preview.

Example Request
import { createZitadelClient } from "@zitadel/api/client";const client = createZitadelClient({  baseUrl: process.env.ZITADEL_URL ?? "http://localhost:8080",  token: process.env.ZITADEL_PROJECT_SECRET!, // server-side only});await client.removePreview("proj_01KWH1P4MYS7F0N9WD3P2E4YM5", { origin: "https://acme-git-sso-acmeinc.vercel.app" });
Example Response
Empty

Was this helpful?