---
title: "Generate section block HTML with AI"
method: POST
path: "/api/v1/sites/{subdomain}/generate-section"
tags: ["sites-ai"]
---

# Generate section block HTML with AI

`POST /api/v1/sites/{subdomain}/generate-section`

## Request

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

Returns sanitized `html` and optional scoped `css` for a `section` block. Consumes workspace AI credits. Does not persist; PATCH the block afterward.

## Request body

- object
  - `prompt` string, required
  - `existingHtml` string
  - `existingCss` string
  - `intent` string

## Response `200`

Generated section

- object
  - `html` string
  - `css` string
  - `generationModel` string

## Other responses

- `401`: Missing or invalid credentials
- `402`: AI Gateway budget cap reached. Update billing limits and try again. `reason = budget_exceeded`.
- `403`: Not allowed for this resource
- `404`: Resource not found

---

[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)
