API ReferenceChats

Create Chat From Template

Creates a new chat from a v0 template, the same way opening it from v0.app/templates does.

POST/v2/chats/from-template

Usage

TypeScript Example
import { v0 } from 'v0'const result = await v0.chats.createFromTemplate({  templateId: 'id_abc123',})console.log(result)

API Signature

Request

Request Body

templateId: string

ID of the v0 template to start from, as shown in its v0.app/templates URL.

Minimum length:
1
privacy?: 'public' | 'private' | 'team' | 'team-edit' | 'unlisted'

Visibility setting for the new chat.

title?: string

Title for the new chat.

metadata?: Record<string, string>

Arbitrary key-value data to attach to the chat.

Response

chat: object
id: string

Unique chat identifier.

title?: string

Chat title, if generated.

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

Visibility setting of the chat.

createdAt: string

ISO timestamp of when the chat was created.

updatedAt?: string

ISO timestamp of when the chat was last updated.

authorId: string

ID of the user who created the chat.

vercelProjectId?: string

Associated Vercel project ID, if any.

metadata: Record<string, string>

User-defined key-value metadata.

writePermission: boolean

Whether the caller has write access to this chat.

usage: object

Model, token usage, and credit cost for the prompt.

model: string | null

Model identifier used for the assistant message, or null when not applicable or unavailable.

tokens: object

Token counts for this message.

input: number

Prompt input value (non-cached).

output: number

Completion output value.

cacheRead: number

Cache-read input value.

cacheWrite: number

Cache-write input value.

total: number

Sum of input, output, cacheRead, and cacheWrite.

creditsCost: object

Credit cost for this message.

input: number

Prompt input value (non-cached).

output: number

Completion output value.

cacheRead: number

Cache-read input value.

cacheWrite: number

Cache-write input value.

total: number

Sum of input, output, cacheRead, and cacheWrite.