---
title: "Create a site from an AI prompt"
method: POST
path: "/api/v1/sites/generate"
tags: ["sites-ai"]
---

# Create a site from an AI prompt

`POST /api/v1/sites/generate`

## Request

- Base URL: `https://slatehut.com`
- URL: `https://slatehut.com/api/v1/sites/generate`
- Auth: HTTP bearer

Runs structured LLM calls (Vercel AI Gateway): a site plan then **one blocks call per planned static page** (up to six: home plus optional about/pricing/contact/blog, etc.), then persists like `POST /api/v1/sites`. Generation uses baked.supply-inspired layout variants (floating-card heroes, collage heroes, dark-band features, tier-highlight pricing, etc.) and expressive block types when the brief fits. For a two-step flow with plan review, use `POST /api/v1/sites/generate/plan` then `POST /api/v1/sites/generate/from-plan`. Image URLs: Unsplash + Blob when configured; otherwise Picsum placeholders.

## Request body

- GenerateSiteRequest: Body for `POST /api/v1/sites/generate`. The model builds a plan then generates **each planned static page** (1–6) using **native** block types with baked.supply-inspired variants (photoFloatingCards hero, darkBandChecklist features, tierHighlightPill pricing, etc.) plus expressive blocks (spotlightHero, auroraHero, glowingPricing, marqueeTestimonials, etc.) and functional blocks (form, rich, newsletter, etc.). Images: Unsplash + Blob when configured; otherwise Picsum placeholders from alt/search text. `includeCms` is accepted for compatibility but ignored. Optional `brief` adds industry, audience, references, logo URL, avoid-list, and tone sliders.
  - `prompt` string, required: Natural-language description of the site to build (business, audience, tone).
  - `subdomain` string: Optional; same rules as `CreateSiteRequest.subdomain`. Random `site-xxxxxxxx` if omitted.
  - `includeCms` boolean: Deprecated; ignored. Generation produces one home page only.
  - `templateId` string: Optional; same ids as `GET /api/v1/templates` / `CreateSiteRequest.templateId`. Biases plan and theme toward that starter.
  - `brief` SiteGenerationBrief: Optional creative constraints for AI generation. Passed to the planner and block builder as structured instructions (invalid `http(s)` URLs are dropped server-side).
    - `industry` string: Industry or vertical (e.g. med spa, B2B analytics).
    - `audience` string: Primary audience or customer (who the site must speak to).
    - `inspirationUrls` string[]: Up to three `http` or `https` URLs for mood and pacing reference (not for copying text or marks).
    - `logoUrl` string: Public `http` or `https` logo image URL; may be applied in the generated navbar when appropriate.
    - `avoid` string: Explicit anti-patterns (e.g. generic purple gradient, startup three-column cliché).
    - `toneMinimalMaximal` integer: Visual density hint: 0 = airy/minimal, 100 = rich/maximal.
    - `toneEditorialPlayful` integer: Personality hint: 0 = editorial/refined, 100 = playful/experimental.

## Response `201`

Created

- object
  - `subdomain` string, required
  - `url` string, required
  - `generationWarnings` string[]: Optional post-generation quality hints (e.g. low block-type diversity). Site is still persisted.

## Other responses

- `400`: Validation or conflict error
- `401`: Missing or invalid credentials
- `402`: AI Gateway budget cap reached. Update billing limits and try again. `reason = budget_exceeded`.
- `409`: Validation or conflict error
- `422`: Model could not produce valid output. Try a shorter or clearer prompt. `reason = invalid_output`.
- `429`: AI provider is rate-limited right now. `reason = rate_limited`.
- `502`: AI provider is temporarily unavailable, credentials are misconfigured, or the request failed. `reason = upstream_unavailable | unauthorized | upstream_error | unknown`.
- `503`: AI provider is temporarily unavailable, credentials are misconfigured, or the request failed. `reason = upstream_unavailable | unauthorized | upstream_error | unknown`.
- `504`: AI provider timed out. Try again in a moment. `reason = upstream_timeout`.

---

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