Update Chat Version Files

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

PATCH /chats/{chatId}/versions/{versionId}
import { v0 } from 'v0-sdk'

const result = await v0.chats.updateVersion()

console.log(result)
PATCH /chats/{chatId}/versions/{versionId}
curl -X PATCH https://api.v0.dev/chats/{chatId}/versions/{versionId} \
  -H "Authorization: Bearer $V0_API_KEY" \
  -H "Content-Type: application/json"

Parameters

Path Parameters

chatId string Required

The unique identifier of the chat containing the version to update. Provided as a path parameter.


versionId string Required

The unique identifier of the version (block) to update. Provided as a path parameter.


Request Body

files object[] Required

Array of files to update with their new content

Array items:

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

Response Body

id string Required

A unique identifier for the version.


object string Required

Fixed value identifying this object as a version.


status enum Required

The current status of the version generation process.

Possible values:

  • pending
  • completed
  • failed

demoUrl string

Optional URL for previewing the generated output.


createdAt string Required

The date and time when the version was created, in ISO 8601 format.


updatedAt string

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.

Array items:

object string 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.