Vercel

Update Chat

Updates the metadata of an existing chat using its `chatId`. Supports changes to the chat name, privacy setting, and custom metadata.

PATCH/v1/chats/{chatId}

Usage

TypeScript Example
import { v0 } from 'v0-sdk'const result = await v0.chats.update({  chatId: '123',  name: 'My Renamed Chat',  privacy: 'public',  metadata: {    userId: 'user_123',    sessionId: 'session_456'  }})console.log(result)

Metadata Management

The metadata field allows you to attach arbitrary key-value pairs to a chat. This is useful for storing external IDs, session information, or other custom data.

Merging Metadata

When you provide a metadata object, it will be merged with existing metadata. Existing keys not included in the update will be preserved:

// Initial metadata: { userId: '123', source: 'web' }
await v0.chats.update({
  chatId: '123',
  metadata: { sessionId: '456' }
})
// Result: { userId: '123', source: 'web', sessionId: '456' }

Updating Existing Keys

To update an existing metadata key, simply provide a new value:

// Initial metadata: { userId: '123', source: 'web' }
await v0.chats.update({
  chatId: '123',
  metadata: { userId: '789' }
})
// Result: { userId: '789', source: 'web' }

Deleting Specific Keys

To delete a specific metadata key, pass null as its value:

// Initial metadata: { userId: '123', source: 'web', sessionId: '456' }
await v0.chats.update({
  chatId: '123',
  metadata: { source: null }
})
// Result: { userId: '123', sessionId: '456' }

Deleting All Metadata

To delete all metadata, pass null instead of an object:

// Initial metadata: { userId: '123', source: 'web' }
await v0.chats.update({
  chatId: '123',
  metadata: null
})
// Result: {}

API Signature

Request

Path Parameters

chatId: string

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

Body

name?: string

A new name to assign to the chat. Helps with identification and organization.

privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'

Sets the privacy level of the chat.

metadata?: Record<string, string | null> | null

Arbitrary key-value data to attach to the chat. Useful for storing additional data about the chat, such as external user IDs. Metadata added will be merged with existing attributes. Pass null as the value to delete a specific key, or pass null instead of an object to delete all existing metadata. The total number of active metadata entries cannot exceed 50.

Response

id: string

A unique identifier for the chat.

object: 'chat'

Fixed value identifying this object as a chat.

shareable: boolean

Indicates whether the chat can be shared via public link.

privacy: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'

Defines the visibility of the chat—private, team-only, or public.

name?: string

An optional name assigned to the chat by the user.

title?: string
deprecated

Deprecated title field preserved for backward compatibility.

createdAt: string

The ISO timestamp representing when the chat was created.

updatedAt?: string

The ISO timestamp of the last update to the chat.

favorite: boolean

Indicates whether the chat is marked as a favorite.

authorId: string

The ID of the user who created the chat.

projectId?: string

Optional ID of the v0 project associated with this chat.

webUrl: string

Web URL to view this chat in the browser.

apiUrl: string

API URL to access this chat via the API.

latestVersion?: object

Full details of the most recent generated version, if available.

id: string

A unique identifier for the version.

object: 'version'

Fixed value identifying this object as a version.

status: 'pending' | 'completed' | 'failed'

The current status of the version generation process.

demoUrl?: string

Optional URL for previewing the generated output.

screenshotUrl?: string

URL to retrieve a screenshot of this version.

createdAt: string

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

A list of files that were generated or included in this version.

url: string
deprecated

The canonical URL to access this chat.

messages: object[]

All messages exchanged in the chat, including user and assistant entries.

id: string

A unique identifier for the message.

object: 'message'

Fixed value identifying this object as a message.

content: string

The main text content of the message.

experimental_content?: any[] | any[][]

The parsed content of the message as an array structure containing AST nodes. This is an experimental field that may change.

createdAt: string

The ISO timestamp representing when the message was created.

updatedAt?: string

The ISO timestamp representing when the message was last updated.

type: 'message' | 'forked-block' | 'forked-chat' | 'open-in-v0' | 'refinement' | 'added-environment-variables' | 'added-integration' | 'deleted-file' | 'moved-file' | 'renamed-file' | 'edited-file' | 'replace-src' | 'reverted-block' | 'fix-with-v0' | 'auto-fix-with-v0' | 'sync-git' | 'pull-changes' | 'fix-cve' | 'answered-questions'

Indicates the format or category of the message, such as plain text or code.

role: 'user' | 'assistant'

Specifies whether the message was sent by the user or the assistant.

finishReason?: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown'

The reason why the message generation finished.

apiUrl: string

API URL to access this message via the API.

authorId: stringnull

The ID of the user who sent the message.

parentId?: stringnull

The ID of the parent message.

attachments?: object[]
url: string

The URL where the attachment file can be accessed.

name?: string

The original filename of the attachment.

contentType?: string

The MIME type of the attachment file (e.g., image/png, application/pdf).

size: number

The size of the attachment file in bytes.

content?: string

The base64-encoded content of the attachment file, if available.

type?: 'screenshot' | 'figma' | 'zip'

Optional v0-specific attachment type for enhanced processing.

files?: object[]

Optional array of files associated with the chat context.

lang: string

Programming language used in the file (e.g., JavaScript, Python).

meta: object

A key-value map of metadata associated with the file (e.g., path, type).

source: string

The origin or identifier of the file source (e.g., path or upload label).

demo?: string
deprecated

Deprecated demo URL used for previewing the chat result.

text: string

The main user prompt or instruction that started the chat.

modelConfiguration?: object

The configuration used to generate responses in this chat.

modelId?: 'v0-mini' | 'v0-pro' | 'v0-max'
deprecated

Deprecated Model ID field preserved for backward compatibility.

imageGenerations?: boolean

Enables image generations to generate up to 5 images per version.

thinking?: boolean

Enables thinking to generate a response in multiple steps.

permissions: object
write: boolean

If true, the user has write access to the chat.

metadata: Record<string, string>

Arbitrary key-value data associated with this chat.