v0 Platform API

Overview

Core concepts, capabilities, and architecture

v0 turns your ideas into real web apps using natural language—describe what you want and v0's intelligent agent builds it for you with modern frontend tools. The v0 Platform API gives you programmatic access to all of v0's capabilities, letting you integrate v0's AI-powered code generation, chat interface, project management, and deployment features into your own applications and workflows.

What can you build with the Platform API?

With the v0 Platform API, you can create your own experiences around v0's core functionality:

  • Custom chat interfaces - Build your own UI for v0's AI-powered code generation
  • Automated workflows - Trigger code generation, iterate on projects, and deploy automatically
  • Development tools - Integrate v0 into IDEs, CI/CD pipelines, or internal tools
  • Team dashboards - Create custom project management and collaboration interfaces
  • AI agents - Build autonomous systems that use v0 to generate and deploy code
  • Educational platforms - Create coding tutorials and interactive learning experiences

Core Concepts

Projects

Projects are containers for your code and development work. They can be:

  • Created from scratch with AI assistance
  • Imported from GitHub repositories
  • Initialized with existing files you upload
  • Built from community templates
// Create a new project
const project = await v0.projects.create({
  name: 'My React App',
})

// Most common: Initialize from existing files
const chat = await v0.chats.init({
  type: 'files',
  files: [
    { name: 'src/App.tsx', content: appCode },
    { name: 'package.json', content: packageJson },
  ],
  projectId: project.id,
})

Chats

Chats are AI-powered conversations that help you develop your projects:

  • v0.chats.create() - Start from scratch with AI code generation
  • v0.chats.init() - Start with existing files (fast, no tokens)
// Start chat with existing code (recommended)
const chat = await v0.chats.init({
  files: existingFiles,
  initialContext: 'Help me optimize this React component',
})

// Start chat from scratch with AI generation
const chat = await v0.chats.create({
  initialMessage: 'Create a todo app with React and TypeScript',
})

Messages

Messages flow through chats and can contain:

  • Text content with markdown formatting
  • Code blocks with syntax highlighting
  • Component previews with live rendering
  • System notifications and status updates

Deployments

Deploy your projects to production with built-in hosting:

const deployment = await v0.deployments.create({
  projectId: project.id,
  environment: 'production',
})

API Architecture

Base URL

All API requests are made to:

https://api.v0.dev

RESTful Design

The API follows REST principles with predictable resource URLs:

GET    https://api.v0.dev/v1/projects           # List projects
POST   https://api.v0.dev/v1/projects           # Create project
GET    https://api.v0.dev/v1/projects/:id       # Get project
PUT    https://api.v0.dev/v1/projects/:id       # Update project
DELETE https://api.v0.dev/v1/projects/:id       # Delete project

POST   https://api.v0.dev/v1/chats              # Create/init chat
GET    https://api.v0.dev/v1/chats/:id/messages # Get messages
POST   https://api.v0.dev/v1/chats/:id/messages # Send message

Authentication

All requests require API key authentication. The SDK provides two ways to authenticate:

The simplest approach uses the default v0 client, which automatically reads from the V0_API_KEY environment variable:

import { v0 } from 'v0-sdk'

// Automatically uses process.env.V0_API_KEY
const projects = await v0.projects.list()

Set your API key in your environment:

# .env file or environment
V0_API_KEY=your_api_key_here

Option 2: Custom Client Configuration

Use createClient() when you need to:

  • Use a different environment variable name
  • Use multiple API keys in the same application
  • Customize the base URL or other settings
import { createClient } from 'v0-sdk'

// Custom API key
const v0 = createClient({
  apiKey: process.env.CUSTOM_V0_KEY,
})

// Multiple clients for different accounts
const personalV0 = createClient({
  apiKey: process.env.PERSONAL_V0_KEY,
})

const teamV0 = createClient({
  apiKey: process.env.TEAM_V0_KEY,
})

// Custom base URL (for enterprise)
const enterpriseV0 = createClient({
  apiKey: process.env.V0_API_KEY,
  baseUrl: 'https://api.enterprise.v0.dev',
})

Get your API key from v0.dev/chat/settings/keys.

Error Handling

Consistent error responses across all endpoints:

{
  "error": {
    "code": "project_not_found",
    "type": "not_found_error",
    "message": "Project not found",
    "userMessage": "The project you're looking for doesn't exist."
  }
}

Key Capabilities

1. Code Generation & AI Chat

  • Natural language to code conversion
  • Context-aware suggestions and improvements
  • Multi-turn conversations for iterative development
  • Framework-specific optimizations (React, Next.js, Vue, etc.)

2. Project Management

  • Version control integration with Git
  • File management with conflict resolution
  • Template system for rapid project setup
  • Workspace organization for team collaboration

3. Import & Export

  • GitHub integration for repository imports
  • File uploads for existing codebases
  • Template creation from existing projects
  • Export capabilities for backup and migration

4. Deployment & Hosting

  • One-click deployments to v0's hosting platform
  • Custom domains and SSL certificates
  • Environment management (staging, production)
  • Deployment logs and monitoring

5. Team Collaboration

  • Shared projects with permission management
  • Real-time collaboration on code and chats
  • Activity feeds and notifications
  • Role-based access control

Integration Patterns

1. Direct API Usage

Use the core SDK for full control:

import { v0 } from 'v0-sdk'
// Or with custom configuration:
// import { createClient } from 'v0-sdk'
// const v0 = createClient({ apiKey: process.env.V0_API_KEY })

// Create project and chat
const project = await v0.projects.create({ name: 'My App' })
const chat = await v0.chats.init({
  type: 'files',
  files: myFiles,
  projectId: project.id,
})

2. AI Agent Integration

Build autonomous agents with AI SDK:

import { generateText } from 'ai'
import { v0Tools } from '@v0-sdk/ai-tools'

const result = await generateText({
  model: openai('gpt-4o-mini'),
  prompt: 'Create and deploy a React dashboard',
  tools: v0Tools({ apiKey: process.env.V0_API_KEY }),
})

3. Workflow Automation

Integrate with CI/CD and development tools:

// GitHub Actions integration
const project = await v0.projects.create({
  name: 'GitHub Project',
})

const chat = await v0.chats.init({
  type: 'repo',
  repo: {
    url: `https://github.com/${context.payload.repository.full_name}`,
  },
  projectId: project.id,
})

const deployment = await v0.deployments.create({
  projectId: project.id,
  chatId: chat.id,
  versionId: chat.latestVersion.id,
})

4. Custom Development Tools

Build custom interfaces and experiences:

// Custom project dashboard
function ProjectDashboard({ projectId }) {
  const { data: project } = useProject(projectId)
  const { data: chats } = useProjectChats(projectId)
  const { data: deployments } = useProjectDeployments(projectId)

  return (
    <div>
      <ProjectHeader project={project} />
      <ChatsList chats={chats} />
      <DeploymentStatus deployments={deployments} />
    </div>
  )
}

Development Workflow

Typical Development Flow

  1. Initialize Project

    • Import from GitHub or create from template
    • Set up project structure and dependencies
  2. Start Development Chat

    • Use init() for existing code or create() for new features
    • Provide context about requirements and goals
  3. Iterative Development

    • Chat with AI to generate and refine code
    • Review and modify generated components
    • Test and validate functionality
  4. Deploy and Monitor

    • Deploy to staging for testing
    • Deploy to production when ready
    • Monitor performance and usage

Best Practices

Performance Optimization

  • Use init() over create() when you have existing files
  • Batch operations when possible to reduce API calls
  • Cache responses for frequently accessed data
  • Use selective file imports to minimize payload sizes

Cost Management

  • Monitor token usage for AI operations
  • Use templates to reduce generation needs
  • Implement caching for repeated operations
  • Set reasonable timeouts for long-running operations

Error Resilience

  • Implement retry logic with exponential backoff
  • Handle API errors gracefully with proper error handling
  • Validate inputs before making API calls
  • Use proper error boundaries in React applications

Security & Privacy

API Security

  • API keys are scoped to your account and can be rotated
  • HTTPS encryption for all API communications
  • Input validation protects against malicious payloads

Data Privacy

  • Your code remains private and is not used for training
  • Project data is encrypted at rest and in transit
  • Access logs are maintained for security auditing
  • GDPR compliance for European users

Best Practices

  • Store API keys securely using environment variables
  • Use least-privilege access with scoped permissions
  • Rotate keys regularly for enhanced security
  • Monitor usage for unusual activity patterns

Limits & Quotas

API Limits

ResourceLimitNotes
Projects100 per accountContact support for higher limits
Chats1000 per projectArchived chats don't count
Messages10,000 per chatOlder messages are automatically archived
Files1000 per project10MB max file size
Deployments50 per projectActive deployments only

Usage Quotas

OperationQuotaReset Period
API Requests10,000Daily
Chat Messages1,000Daily
Deployments100Daily
File Uploads1GBDaily
GitHub Imports50Daily

Getting Started

1. Get Your API Key

Visit v0.dev/chat/settings/keys to generate your API key.

2. Install the SDK

npm install v0-sdk
# or
pnpm add v0-sdk

3. Make Your First Call

import { v0 } from 'v0-sdk'

// List your projects
const projects = await v0.projects.list()
console.log('Your projects:', projects.data)

4. Explore the Guides

5. Try the Examples

Support & Resources

Documentation

Community

Enterprise

  • Custom integrations for enterprise workflows
  • Dedicated support and priority assistance
  • On-premises deployment options
  • SLA guarantees and priority support

Contact enterprise@v0.dev for enterprise inquiries.

What's Next?

Ready to start building with the v0 Platform API? Here are some suggested next steps:

  1. Get Started with Quickstart - 5-minute setup guide
  2. Choose Your Integration Pattern - Find the right example for your use case
  3. Join the Community - Connect with other developers
  4. Build Something Amazing - Start creating with v0

The v0 Platform API opens up endless possibilities for AI-powered development. Whether you're building custom tools, automating workflows, or creating entirely new development experiences, we can't wait to see what you build!