---
title: "Create a website"
method: POST
path: "/websites"
tags: ["Websites"]
---

# Create a website

`POST /websites`

## Request

- Base URL: `https://api.cactal.ai/v1`
- URL: `https://api.cactal.ai/v1/websites`
- Auth: HTTP bearer

Creates a website in the organization. Provide either a `name` (trimmed, 1–200 characters) or a creation `prompt`; a prompt returns immediately with the temporary name `Untitled site`, which the built-in naming request attempts to replace on its next run together with a matching available slug and platform hostname. The hostname receives a short suffix when the clean hostname is unavailable. An omitted `slug` is allocated from the initial name; an explicit slug must be lowercase, URL-safe, unreserved, and unique among active websites in the organization. The website starts as an unpublished draft at `headVersion` 1. Send an `idempotencyKey` to make retries return the same website. Edit its source through the Source code operations, then publish with `websiteSourceCode.head.publish`.

## Request body

- object
  - `organizationId` string, required
  - `name` string
  - `prompt` string
  - `slug` string
  - `idempotencyKey` string: Caller-generated key, such as a UUID, that makes creation safe to retry. Send the same key on every retry of one creation attempt: when this organization already has a website created with the key, that website is returned and no second website is created. A key whose website is in the trash returns a 409 with `idempotencyKeyStatus: "deleted"`; retry with a new key.

## Response `200`

The newly created website, or the website an earlier request with the same `idempotencyKey` created.

- object
  - `id` string, required: Unique website id.
  - `organizationId` string, required: Id of the organization that owns the website.
  - `name` string, required: Display name, 1–200 characters.
  - `slug` string, required: URL-safe identifier unique among active websites in the organization.
  - `customDomainsEnabled` boolean, required: Whether custom domains are enabled. Enabling is owner-only and makes the website a billable site; custom domains can only be attached while `true`.
  - `headVersion` integer, required: Latest draft source version number; starts at 1.
  - `publishedVersion` integer, nullable, required: Currently published version. `null` when the website is not published.
  - `createdAt` string, date-time, required: When the website was created.
  - `updatedAt` string, date-time, required: When the website was last modified.

## Other responses

- `400`: Validation failed. The response `message` names the first invalid field.
- `401`: Missing, invalid, expired, or revoked API key.
- `403`: The authenticated principal lacks the required capability.
- `404`: The resource does not exist or is outside the principal’s access scope.
- `409`: The request conflicts with the current state of the resource.
- `429`: Rate limit exceeded. Retry after the number of seconds in the `Retry-After` header.

---

[API](https://skmtc.dev/cactal/apis/cactal-api.md) · [All operations](https://skmtc.dev/cactal/apis/cactal-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cactal/apis/cactal-api/revisions/9cd0fb5eacdd?raw)
