Development Tools
Lovable API: Building Applications with the Developer Platform
A practical guide to the Lovable developer API, authentication, and building custom integrations

The Lovable API gives developers programmatic access to the platform's AI-powered application builder. Instead of working exclusively through the chat interface, you can automate project creation, manage deployments, and integrate Lovable's capabilities into your own tools and workflows. This opens up possibilities for CI/CD pipelines, custom dashboards, and automated testing scenarios that the web UI alone cannot support.
Contents
- 1. What the Lovable API Enables
- 2. Authentication and API Key Management
- 2.1. Generating Your First API Key
- 3. Rate Limits and Usage Tiers
- 4. Core Endpoints and Capabilities
- 4.1. Project Management Endpoints
- 4.2. Code Generation and Deployment
- 5. Integrating with External Services
- 5.1. Supabase and Database Operations
- 5.2. GitHub Integration Workflows
- 6. Error Handling and Debugging
- 6.1. Common Error Codes
- 7. Security Best Practices
- 8. Webhook Configuration
- 9. Testing and Development Workflow
- 9.1. Local Development Setup
- 10. Production Deployment Considerations
- 10.1. Monitoring and Observability
- 11. Pricing and Usage Calculations
- 11.1. Comparing API Access Across Plans
- 12. Community Resources and Support
- 13. Final Assessment of the Lovable API
Most developers first encounter Lovable through the browser-based chat where you describe an application and watch it generate React components, configure Supabase tables, and set up authentication. The API exposes those same capabilities through REST endpoints. You send a prompt, receive a project identifier, and can then poll for completion or stream updates as the AI writes code. The mental model shifts from interactive conversation to asynchronous job processing.
This article covers the practical aspects of working with the Lovable developer API: authentication, key management, core endpoints, error handling, and integration patterns. It assumes familiarity with REST APIs, JSON, and basic TypeScript or JavaScript. If you are new to the platform entirely, spending an hour in the web interface first will make the API concepts more concrete.
What the Lovable API Enables
The API surface area focuses on three primary workflows: project lifecycle management, code generation triggers, and deployment control. You can create new projects from prompts, list existing projects, retrieve generated code, and initiate deployments to Lovable's hosting or export for self-hosting. Webhook support allows your systems to react when generation completes or when deployments succeed or fail.
- Create projects programmatically from natural language prompts
- Retrieve generated file trees and source code for review or modification
- Trigger deployments to preview or production environments
- Configure custom domains and SSL certificates via API
- Manage team members and project permissions
- Stream real-time generation progress for custom UIs
The API does not currently expose fine-grained control over individual file edits or the AI's reasoning process. You provide a prompt and receive a complete project snapshot. For iterative development, you create new project versions with refined prompts rather than patching individual files. This design reflects the platform's philosophy of treating applications as holistic generated artifacts.
Authentication and API Key Management
All API requests require a bearer token in the Authorization header. Keys are scoped to your account and inherit the permissions of your current plan. The Lovable dashboard provides a dedicated section for creating, labeling, and revoking keys. Each key can be named for its purpose — such as "CI/CD pipeline" or "internal dashboard" — which helps with auditing and rotation.

Keys do not expire automatically. You must revoke them manually when they are no longer needed or when a team member leaves. There is no built-in key rotation schedule or automatic expiration policy, so establishing your own rotation cadence is advisable for production systems. The dashboard shows the last used timestamp for each key, which helps identify stale credentials.
Generating Your First API Key
Navigate to the developer settings in your Lovable account. Click "Create API Key," provide a descriptive label, and copy the generated token immediately. The token is shown only once. Store it in your password manager or secrets vault. Do not commit it to version control. For CI/CD systems, use the platform's encrypted secrets storage rather than plain environment variables where possible.
- Use a unique key per integration point to limit blast radius
- Label keys with the service and environment (e.g., "github-actions-staging")
- Rotate keys quarterly or after any suspected exposure
- Monitor the last-used timestamp to detect unused keys
Rate Limits and Usage Tiers
Rate limits vary by plan tier. Free accounts face stricter limits suitable for experimentation, while paid tiers offer higher throughput for production workloads. Limits apply per key, not per IP address, so distributing load across multiple keys does not bypass restrictions. The API returns standard HTTP 429 responses with retry-after headers when limits are exceeded.
Scroll horizontally to see all columns
| Plan | Requests per Minute | Concurrent Generations | Daily Project Creates |
|---|---|---|---|
| Free | 30 | 1 | 10 |
| Starter | 60 | 2 | 50 |
| Launch | 120 | 3 | 200 |
| Scale | 300 | 5 | 1000 |
| Enterprise | Custom | Custom | Custom |
Core Endpoints and Capabilities
The base URL for all endpoints is https://api.lovable.dev/v1. Responses follow a consistent envelope format with a "data" field for successful results and an "error" field for failures. Pagination uses cursor-based navigation with "next_cursor" tokens. All timestamps are ISO 8601 in UTC. The OpenAPI specification is available from the developer portal for generating client SDKs.

The most frequently used endpoints center on project operations. Creating a project accepts a prompt string and optional configuration for framework, styling, and integrations. The response includes a project ID and initial status. You then poll the project endpoint or subscribe to Server-Sent Events for progress updates. Once generation completes, the project endpoint returns the full file manifest with download URLs for each generated asset.
Project Management Endpoints
Project endpoints follow REST conventions. POST /projects creates a new generation job. GET /projects lists your projects with filtering options for status, date range, and tags. GET /projects/{id} retrieves detailed status and the file tree. DELETE /projects/{id} removes a project from your dashboard. PATCH /projects/{id} updates metadata like name, description, and visibility settings.
- POST /projects — start a new generation from a prompt
- GET /projects — list projects with pagination and filters
- GET /projects/{id} — get status, file tree, and deployment info
- PATCH /projects/{id} — update project metadata
- DELETE /projects/{id} — remove project from account
- POST /projects/{id}/deploy — trigger deployment to hosting
Code Generation and Deployment
When you create a project, the API returns immediately with a "pending" status. The generation process runs asynchronously. You can poll GET /projects/{id} every few seconds or open an SSE connection to /projects/{id}/stream for real-time updates. The stream emits events for each phase: planning, file generation, dependency installation, type checking, and build verification. Deployment is a separate explicit step — generation does not auto-deploy.
Scroll horizontally to see all columns
| Phase | Event Type | Typical Duration |
|---|---|---|
| Planning | planning_started | 5-15 seconds |
| File Generation | files_generating | 30-120 seconds |
| Dependencies | installing_deps | 15-60 seconds |
| Type Check | type_checking | 10-30 seconds |
| Build | building | 20-60 seconds |
| Complete | generation_completed | N/A |
Integrating with External Services
Lovable's strength lies in its built-in integrations with Supabase, GitHub, Stripe, and other services. The API respects these integrations when they are configured in your account. When a prompt references Supabase, the generated project includes the client configuration and database schema. The API does not separately manage these connections — they are account-level settings that apply to all generated projects.
- Supabase: database, auth, storage, edge functions
- GitHub: repository creation, commits, pull requests
- Stripe: payment flows, subscription management
- Figma: design token extraction, component mapping
- Custom domains: DNS verification, SSL provisioning
Supabase and Database Operations
If your Lovable account has a linked Supabase project, generated applications automatically receive the necessary environment variables and client initialization code. The API does not expose direct Supabase management — you configure the connection once in the dashboard. When generating projects that need database tables, include schema requirements in your prompt. The AI will create migration files and TypeScript types as part of the generated codebase.
GitHub Integration Workflows
With GitHub connected, you can specify a repository target when creating a project. The API will push the generated code to a new or existing repository. This enables workflows where Lovable handles initial scaffolding and your team takes over for custom development. The generated repository includes a README with setup instructions and a GitHub Actions workflow for continuous deployment back to Lovable or to your own infrastructure.

The GitHub integration uses a Lovable-owned GitHub App installation. You grant repository access during setup. The API does not accept raw GitHub tokens. This design keeps credentials centralized and auditable. If you need to push to a specific organization or repository, configure the default target in the dashboard or include the repository identifier in your project creation request.
Error Handling and Debugging
API errors follow a consistent structure with a machine-readable code, human-readable message, and optional details object. HTTP status codes map to error categories: 400 for validation failures, 401 for authentication issues, 403 for permission problems, 404 for missing resources, 429 for rate limits, and 5xx for server errors. The details object may include field-level validation errors or suggestions for resolution.
- INVALID_PROMPT — prompt exceeds length or contains disallowed content
- GENERATION_FAILED — AI generation encountered an unrecoverable error
- BUILD_ERROR — generated code failed type checking or build
- DEPLOYMENT_FAILED — hosting deployment encountered an error
- INTEGRATION_MISSING — prompt requires a connected service not configured
- QUOTA_EXCEEDED — plan limits reached for projects or deployments
Common Error Codes
The most frequent error during development is GENERATION_FAILED, which usually means the prompt was ambiguous or requested something outside the platform's capabilities. The error details often include a suggested rephrasing. BUILD_ERROR indicates the generated code has TypeScript errors or missing dependencies — this can happen with complex prompts that push the AI's context window. INTEGRATION_MISSING appears when you reference Supabase or GitHub without those connections configured in your account.
Scroll horizontally to see all columns
| Code | HTTP Status | Typical Cause |
|---|---|---|
| INVALID_PROMPT | 400 | Prompt too long, empty, or violates content policy |
| UNAUTHORIZED | 401 | Missing or invalid API key |
| FORBIDDEN | 403 | Key lacks permission for this operation |
| NOT_FOUND | 404 | Project ID does not exist or access denied |
| RATE_LIMITED | 429 | Exceeded plan rate limits |
| GENERATION_FAILED | 500 | AI generation error, check details for suggestion |
| BUILD_ERROR | 500 | Generated code failed compilation |
Security Best Practices
Treat API keys as passwords. They grant full access to your account's generation quota and deployed applications. Never embed keys in client-side code, mobile apps, or public repositories. Use server-side proxies for any browser-initiated requests. Rotate keys immediately if they appear in logs, error reports, or version control history.
Webhook Configuration
Webhooks allow your systems to react to generation and deployment events without polling. Configure webhook endpoints in the developer settings. Each webhook receives a JSON payload with the event type, project ID, timestamp, and relevant metadata. Lovable signs each payload with an HMAC-SHA256 signature using your webhook secret. Verify the signature before processing to prevent spoofing.
- generation.completed — project generation finished successfully
- generation.failed — generation error with details
- deployment.started — deployment initiated
- deployment.completed — deployment succeeded with URL
- deployment.failed — deployment error with logs
- project.deleted — project removed from account
Testing and Development Workflow
Developing against the API involves a feedback loop: send a prompt, wait for generation, inspect the output, refine the prompt. The web interface is often faster for prompt iteration because you see visual previews. Use the API for automation once your prompts are stable. A practical pattern: prototype prompts in the browser, then copy the refined prompt into your API integration code.
The API is not a replacement for the chat interface — it is the automation layer for prompts you have already validated.
Local Development Setup
For local testing, create a dedicated API key labeled "local-dev" and store it in a .env file excluded from version control. Write a thin wrapper script that handles authentication, polling, and file download. The generated projects are standard Vite + React + TypeScript applications. You can run them locally with npm install && npm run dev after downloading the file tree. This lets you verify behavior before deploying.
- Create a dedicated development API key
- Build a small CLI tool for common operations
- Download generated projects for local inspection
- Test deployment to preview environments first
- Use webhook.site or ngrok for local webhook testing
Production Deployment Considerations
Production API usage differs from development in three ways: reliability, observability, and cost control. Implement exponential backoff with jitter for retries. Log every request and response for debugging. Set up alerts for rate limit approaches and generation failure rates. Track generation costs against your plan limits — each project creation consumes quota even if generation fails.
Monitoring and Observability
The API does not provide a built-in metrics endpoint. Build your own observability by logging request latency, success rates, and error categories. Correlate API logs with webhook events to measure end-to-end generation time. For high-volume integrations, consider a dedicated monitoring dashboard that tracks quota consumption across all your API keys. This prevents surprises when a runaway script consumes your monthly allocation.
Pricing and Usage Calculations
API usage draws from the same quotas as the web interface. Project creations, deployments, and generation time all count toward plan limits. The Free plan includes 10 project creates per day and 30 API requests per minute. Paid plans scale these limits proportionally. Enterprise plans offer custom quotas and dedicated support. There are no separate API-only pricing tiers — the API is included with your plan.
Scroll horizontally to see all columns
| Plan | Monthly Price | Daily Project Creates | Concurrent Generations |
|---|---|---|---|
| Free | $0 | 10 | 1 |
| Starter | $20 | 50 | 2 |
| Launch | $50 | 200 | 3 |
| Scale | $100 | 1000 | 5 |
| Enterprise | Custom | Custom | Custom |
Comparing API Access Across Plans
The main differentiator for API-heavy workflows is concurrent generations. Free and Starter plans allow only one or two simultaneous generations, which becomes a bottleneck for batch processing. Launch and Scale plans support three and five concurrent generations respectively, enabling parallel prompt processing. Enterprise removes this limit entirely. If your workflow involves generating dozens of projects in sequence, plan for the concurrency constraint or upgrade accordingly.
Concurrency limits matter more than rate limits for batch generation workflows.
Community Resources and Support
The Lovable developer community maintains several unofficial resources that complement the official documentation. The Discord server has a dedicated API channel where developers share prompt patterns, wrapper libraries, and integration examples. GitHub hosts community-built SDKs for Python, Go, and Rust. The official TypeScript SDK is generated from the OpenAPI spec and stays current with API changes.
- Official TypeScript SDK: npm install @lovable/dev-api
- Community Python wrapper: pip install lovable-api
- Discord: #api-development channel for questions
- GitHub Discussions: feature requests and bug reports
- OpenAPI spec: download from developer portal for custom SDKs
Frequently Asked Questions
Can I use the Lovable API without a paid plan?
Yes, the Free plan includes API access with 10 project creates per day and 30 requests per minute. All endpoints are available.
How do I authenticate API requests?
Include your API key as a Bearer token in the Authorization header: Authorization: Bearer YOUR_API_KEY.
What is the maximum prompt length for project creation?
Prompts are limited to 50,000 characters. For complex applications, consider breaking work into multiple focused prompts.
Can I modify generated code through the API?
The API does not support partial file edits. You create a new project version with an updated prompt for iterations.
Does the API support streaming generation progress?
Yes, use the Server-Sent Events endpoint at /projects/{id}/stream for real-time phase updates.
Are webhook deliveries retried on failure?
Lovable retries failed webhook deliveries with exponential backoff for up to 24 hours before giving up.
Can I deploy generated projects to my own infrastructure?
Yes, download the generated file tree and deploy to any platform that supports Vite React applications.
Final Assessment of the Lovable API
The Lovable API delivers on its core promise: programmatic access to AI-powered application generation. It is well-suited for teams that have validated prompts through the web interface and need to automate generation at scale. The authentication model is straightforward, the endpoint design follows REST conventions, and webhook support enables event-driven architectures. The main limitations are the lack of fine-grained editing endpoints, the concurrency constraints on lower tiers, and the absence of a dedicated API usage dashboard. For most integration scenarios, these are manageable trade-offs. If your workflow requires generating dozens of applications per day, the Scale or Enterprise plans provide the necessary throughput. For occasional automation, the Free tier is sufficient to experiment and build proof-of-concept integrations.

