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. The call is idempotent. A URL with no live preview answers 204 too. That includes one that expired or was removed before, so a cleanup that races the expiry still succeeds.

The URL travels in the body rather than the path because an origin contains /. Take it from listProjectPreviews (GET /projects/{project_id}/previews).

Authorization

oauth2 deployment.write
headerAuthorizationBearer <token>

Scope: deployment.write

Path Parameters

project_id*string

The project ID: the id that createProject (POST /projects) returns, which zitadel setup also prints as project_id.

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

Request Body

application/json
  1. body

The preview to remove.

origin*Origin

The preview URL, exactly as listProjectPreviews (GET /projects/{project_id}/previews) returns it in origin.

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 { createZitadelApi, ZitadelClient } from "@zitadel/api/client";const api = createZitadelApi(  new ZitadelClient({    baseUrl: process.env.ZITADEL_URL ?? "http://localhost:8080",    token: process.env.ZITADEL_PROJECT_SECRET!, // server-side only  }),);await api.removeProjectPreview("proj_01KWH1P4MYS7F0N9WD3P2E4YM5", { origin: "https://acme-git-sso-acmeinc.vercel.app" });
Example Response
Empty

Was this helpful?