API Documentation

Embed the Builder, Chat, and Image engines in any app via simple HTTPS requests.

Authentication

Pass your API key in the X-API-Key header (or as a Bearer token in Authorization). Keep keys secret — do not embed them in client-side code.

X-API-Key: lvb_live_xxxxxxxxxxxxxxxx

POST /api/public/v1/build

Generate a complete, standalone HTML document from a prompt.

curl -X POST https://your-app.lovable.app/api/public/v1/build \
  -H "X-API-Key: $LVB_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A premium landing page for a coffee subscription startup",
    "model": "openai/gpt-5.5"
  }'

Response: { html, model, bytes }

POST /api/public/v1/chat

OpenAI-compatible chat completion proxied through the Lovable AI gateway.

curl -X POST https://your-app.lovable.app/api/public/v1/chat \
  -H "X-API-Key: $LVB_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-2.5-flash",
    "messages": [
      { "role": "user", "content": "Write a haiku about TypeScript." }
    ]
  }'

POST /api/public/v1/image

Generate a high-quality image from a prompt.

curl -X POST https://your-app.lovable.app/api/public/v1/image \
  -H "X-API-Key: $LVB_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Futuristic skyline at golden hour, cinematic",
    "size": "1536x1024",
    "quality": "high"
  }'

Rate limits & errors

Every successful call is logged with token counts and latency on your API Keys page.