v0 Platform API/API Reference/Chats

Find Chat Messages

Retrieves a list of all messages for a specific chat, ordered by creation date (newest first). Supports cursor-based pagination and includes message content, role, and type information.

GET/v1/chats/{chatId}/messages

Usage

TypeScript Example
import { v0 } from 'v0-sdk'

const result = await v0.chats.findMessages()

console.log(result)

API Signature

Request

Path Parameters

chatId: string

The unique identifier of the chat to retrieve messages for. Provided as a path parameter.

Query Parameters

limit?: number

Specifies the maximum number of message records to return in a single response. Useful for paginating results when there are many messages.

cursor?: string

Base64 encoded cursor containing pagination data

Response

object: 'list'
data: object[]
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?: string[]

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'

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.

parentId?: stringnull

The ID of the parent message.

pagination: object
hasMore: boolean
nextCursor?: string
nextUrl?: string