Overview
The v0 API gives your product v0's app-building agent, including code generation, secure live previews, integrations, and deployment to Vercel.
Create a full-stack app from a prompt with one API call:
Why use the v0 API?
Building an app-generation experience requires more than just generating code. You need an agent that can plan and iterate, a secure environment for running its work, and a path from a prompt to a production application. The v0 API provides the complete workflow through one API.
Benefits include:
- Agentic app generation: Create full-stack applications from natural language, then continue iterating through follow-up messages.
- Secure live previews: Run generated applications and embed their previews without exposing credentials to the browser.
- Extensible workflows: Connect MCP servers, integrations, environment variables, and design systems.
- Built-in deployment: Deploy generated applications to Vercel without building separate deployment infrastructure.
The v0 API supports these primary workflows:
- Generate and iterate on apps with the Chats and Messages APIs.
- Build a custom chat interface with
@v0-sdk/reactand AI SDK. - Embed live previews securely in your product with authenticated iframe URLs.
- Add app generation to agents through the v0 MCP server or AI SDK tools.
Get Started
Start with a complete app-generation frontend:
The starter includes a full chat interface with live previews. Follow the Quickstart to configure the starter or add v0 to an existing app.
Error handling
When synchronously creating a chat,
sending a message, or
resolving a task, a model policy
refusal returns HTTP 422 with the following response body:
Do not automatically retry the unchanged request with the same model. Try
rephrasing your request or choosing a different model. Unexpected server failures
return HTTP 500 with
{ "message": "An unexpected error occurred" }.