---
title: "Update Chat Version Files"
method: PATCH
path: "/chats/{chatId}/versions/{versionId}"
tags: ["chats"]
---

# Update Chat Version Files

`PATCH /chats/{chatId}/versions/{versionId}`

Updates the source files of a specific chat version (block) manually. This allows editing generated files directly through the API.

## Path parameters

- `chatId` string, required
- `versionId` string, required

## Request body

- object
  - `files` object[], required — Array of files to update with their new content
    - `name` string, required — The full file path including extension (e.g., "components/test.tsx")
    - `content` string, required — The new content for the file
    - `locked` boolean — Whether to lock or unlock the file to prevent AI from overwriting it during generation

## Response `200`

Success

- VersionDetail — Detailed version data including file contents.
  - `id` string, required — A unique identifier for the version.
  - `object` 'version', required — Fixed value identifying this object as a version.
  - `status` 'pending' | 'completed' | 'failed', required — The current status of the version generation process.
  - `demoUrl` string — Optional URL for previewing the generated output.
  - `createdAt` string, date-time, required — The date and time when the version was created, in ISO 8601 format.
  - `updatedAt` string, date-time — The date and time when the version was last updated, in ISO 8601 format.
  - `files` object[], required — A list of files that were generated or included in this version.
    - `object` 'file', required — Fixed value identifying this object as a file.
    - `name` string, required — The name of the file, including its extension.
    - `content` string, required — The full contents of the file as a raw string.
    - `locked` boolean, required — Whether the file is locked to prevent AI from overwriting it during new version generation.
  - `screenshotUrl` string — URL to retrieve a screenshot of this version.

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `409` — Conflict
- `413` — Payload Too Large
- `422` — Unprocessable Entity
- `429` — Too Many Requests
- `500` — Internal Server Error

## Changes

- **2025-09-24** `fd6d8c3bee8a` — 1 info
  - added the optional property `screenshotUrl` to the response with the `200` status
- **2025-08-24** `3521652a43a7` — 1 breaking, 1 warning, 2 info
  - the `files` request property's minItems was increased to `1`
  - removed the optional property `screenshotUrl` from the response with the `200` status
  - the `createdAt` response's property pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$` was removed for the status `200`
  - the `updatedAt` response's property pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$` was removed for the status `200`

[Change history](https://skmtc.dev/vercel/apis/v0-platform-api-beta/changes/chats/:chatId/versions/:versionId/patch.md)

---

[API](https://skmtc.dev/vercel/apis/v0-platform-api-beta.md) · [All operations](https://skmtc.dev/vercel/apis/v0-platform-api-beta/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/vercel/v0-platform-api-beta/revisions/fd6d8c3bee8a/schema)
