---
title: "Create, update or delete a preview URL"
method: POST
path: "/projects/{projectId}/previews"
tags: ["Previews and hostnames"]
---

# Create, update or delete a preview URL

`POST /projects/{projectId}/previews`

## Request

- Base URL: `https://studio.weaverse.io/api/v1/content`
- URL: `https://studio.weaverse.io/api/v1/content/projects/{projectId}/previews`
- Auth: HTTP bearer

One endpoint for preview URL writes, selected by `op`:

- `create` (`name`, `url`, optional `isDefault`): returns 201 `{ object: "preview_url", previewUrl }`. 409 when the project already has a preview with this URL. Setting `isDefault: true` unsets the previous default.
- `update` (`id`, optional `name`, `url`, `isDefault`): returns 200 `{ object: "preview_url", previewUrl }`. 409 when another preview of this project already has the new URL.
- `delete` (`id`): returns 200 `{ object: "preview_url_deleted", id }`. Permanent.

`name` is at most 191 characters and `url` at most 2048. Ids are resolved through this project; an id from another project returns 404.

Required scope: `project:manage`

## Request body

- union
  - object
    - `op` 'create', required
    - `name` string, required
    - `url` string, required
    - `isDefault` boolean
  - object
    - `op` 'update', required
    - `id` string, required
    - `name` string
    - `url` string
    - `isDefault` boolean
  - object
    - `op` 'delete', required
    - `id` string, required

## Response `200`

Operation result

- object

## Other responses

- `201`: Created
- `400`: Invalid body (INVALID_PARAMS)
- `401`: Missing or invalid credentials
- `403`: Foreign project or missing scope (INSUFFICIENT_SCOPE)
- `404`: Not found (never discloses other tenants)
- `409`: CONFLICT: another preview URL of this project has this address (create or update)

---

[API](https://skmtc.dev/weaverse/apis/weaverse-content-api.md) - [All operations](https://skmtc.dev/weaverse/apis/weaverse-content-api/llms.txt) - [OpenAPI document](https://skmtc.dev/weaverse/apis/weaverse-content-api/revisions/d189794169bb?raw)
