Programmatic access to v0's app generation

The v0 Platform API exposes the same infrastructure behind v0.dev as a REST interface, currently in beta. Instead of operating through the chat UI, developers get a composable API for the entire code generation lifecycle: prompt → project → code files → deployment. Every generated app is tied to a v0.dev chat link for traceability.

The API covers nearly all v0.dev functionality through three groups of endpoints:

  • Generation: produce full-stack apps from natural language prompts, returning parsed code files plus a live demo URL
  • Context injection: seed a chat with existing files from source code, git, or the shadcn registry, and attach files per message
  • Deployment: create new Vercel projects, associate existing ones with a chat, and trigger releases

Typical use cases

As a headless app builder, v0's API enables products and workflows that previously required manual UI interaction. Current integrations from developers include:

  • Website generators that turn user descriptions into production-ready code
  • Slack and Discord bots that return fully deployed web apps from chat messages
  • VSCode plugins and command-line tools wrapped around the prompt-to-app pipeline
  • Embedded UI generation inside analytics or CRM products
  • Custom agents and development environments that parse intent and hand back live demos

Getting started with the SDK

The v0 SDK is a TypeScript library that simplifies calls to the Platform API. Start by installing the package:

pnpm install v0-sdk

API keys are issued from v0 account settings. Store your key as an environment variable in .env:

V0_API_KEY=your_api_key_here

A complete walkthrough is available in the Quickstart Guide.

import { v0 } from "v0-sdk"

export default async function V0Chat() {

// No initialization needed - uses V0_API_KEY automatically

const chat = await v0.chats.create({

message: "Build a todo app with React and TypeScript"

})

// Access the generated files

chat.files?.forEach((file) => {

console.log(`File: ${file.name}`)

console.log(`Content: ${file.content}`)

})

// Use the Demo URL in an iframe

return (

<iframe

src={chat.demo}

width="100%"

height="600">

</iframe>

)

}