Update Chat
Updates the metadata of an existing chat using its `chatId`. Supports changes to the chat name, privacy setting, and custom metadata.
Usage
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
The unique identifier of the chat to update. Provided as a path parameter.
Body
A new name to assign to the chat. Helps with identification and organization.
Sets the privacy level of the chat.
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
A unique identifier for the chat.
Fixed value identifying this object as a chat.
Indicates whether the chat can be shared via public link.
Defines the visibility of the chat—private, team-only, or public.
An optional name assigned to the chat by the user.
Deprecated title field preserved for backward compatibility.
The ISO timestamp representing when the chat was created.
The ISO timestamp of the last update to the chat.
Indicates whether the chat is marked as a favorite.
The ID of the user who created the chat.
Optional ID of the v0 project associated with this chat.
Web URL to view this chat in the browser.
API URL to access this chat via the API.
Full details of the most recent generated version, if available.
A unique identifier for the version.
Fixed value identifying this object as a version.
The current status of the version generation process.
Optional URL for previewing the generated output.
URL to retrieve a screenshot of this version.
The date and time when the version was created, in ISO 8601 format.
The date and time when the version was last updated, in ISO 8601 format.
A list of files that were generated or included in this version.
The canonical URL to access this chat.
All messages exchanged in the chat, including user and assistant entries.
A unique identifier for the message.
Fixed value identifying this object as a message.
The main text content of the message.
The parsed content of the message as an array structure containing AST nodes. This is an experimental field that may change.
The ISO timestamp representing when the message was created.
The ISO timestamp representing when the message was last updated.
Indicates the format or category of the message, such as plain text or code.
Specifies whether the message was sent by the user or the assistant.
The reason why the message generation finished.
API URL to access this message via the API.
The ID of the user who sent the message.
The ID of the parent message.
The URL where the attachment file can be accessed.
The original filename of the attachment.
The MIME type of the attachment file (e.g., image/png, application/pdf).
The size of the attachment file in bytes.
The base64-encoded content of the attachment file, if available.
Optional v0-specific attachment type for enhanced processing.
Optional array of files associated with the chat context.
Programming language used in the file (e.g., JavaScript, Python).
A key-value map of metadata associated with the file (e.g., path, type).
The origin or identifier of the file source (e.g., path or upload label).
Deprecated demo URL used for previewing the chat result.
The main user prompt or instruction that started the chat.
The configuration used to generate responses in this chat.
Deprecated Model ID field preserved for backward compatibility.
Enables image generations to generate up to 5 images per version.
Enables thinking to generate a response in multiple steps.
If true, the user has write access to the chat.
Arbitrary key-value data associated with this chat.