---
title: "Live editing: apply edits made in the preview (text, links, pictures, sections, theme) to the files and the preview. No model, no Build Credits; saved as one version within 20 seconds (or before the next chat message, restore or publish). The answer carries the ops that undo exactly this change"
method: POST
path: "/builder/sessions/{sessionId}/edits"
tags: ["Builder"]
---

# Live editing: apply edits made in the preview (text, links, pictures, sections, theme) to the files and the preview. No model, no Build Credits; saved as one version within 20 seconds (or before the next chat message, restore or publish). The answer carries the ops that undo exactly this change

`POST /builder/sessions/{sessionId}/edits`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/builder/sessions/{sessionId}/edits`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

## Path parameters

- `sessionId` string, uuid, required

## Request body

- object
  - `ops` BuilderVisualOp[], required
    - `op` string, required: setContentText, setContentValue, setLink, setSiteText, setJsxText, setJsxProp, setClassTokens, moveSection, duplicateSection, deleteSection, insertSection, setThemeToken, setFontPairing, setSiteTheme, setImage or splice
  - `baseVersion` integer: The editVersion the editor saw; 409 (reason stale) when the files changed since
  - `label` string: What the customer did, in their words (kept for the history)

## Response `200`

Applied

- object
  - `changedFiles` string[], required
  - `inverseOps` BuilderVisualOp[], required
    - `op` string, required: setContentText, setContentValue, setLink, setSiteText, setJsxText, setJsxProp, setClassTokens, moveSection, duplicateSection, deleteSection, insertSection, setThemeToken, setFontPairing, setSiteTheme, setImage or splice
  - `version` integer, required: The new editVersion
  - `pendingChanges` integer, required: Edits not yet saved as a version
  - `needsTranslation` string[], required: Languages whose files got another language's text and should be translated
  - `preview` 'synced' | 'starting' | 'none', required: synced: the preview has the new files (it updates in place); starting: it is being started with them; none: no preview

## Other responses

- `400`: Invalid request (code invalid_request; details.reason: invalid, unmappable, not_found, secret_detected, unsupported, too_large, unreadable)
- `401`: Missing or invalid session/token (code unauthorized)
- `403`: Authenticated but not permitted (code forbidden)
- `404`: Not found or not visible to the caller (code not_found)
- `409`: Refused for now (code conflict; details.reason: turn_running while the AI changes the site, stale when the files changed since the editor loaded them (details.version: the current one), previewing_version, archived, in_use)
- `429`: Too many changes at once (code rate_limited); see Retry-After
- `501`: Not available on this server (code not_configured)

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
