API for Developers

Add UIPunch to anything.

One API call. You describe the screen, we return production-ready code through our proprietary generation stack. Use it from Cursor, a script, your backend — anywhere.

Get Your API Key

How it works

1. You send a prompt

Describe the screen you want in plain English. “Dark mode paywall for a fitness app” — that's it.

2. We do the heavy lifting

Our backend interprets your request, applies proprietary design intelligence, and returns production-ready code optimized for your selected framework.

3. You get code back

Production-ready React, Tailwind, React Native, SwiftUI, or Flutter code. Drop it straight into your project.

You don't need an LLM to call this. It's a standard REST API. Call it from a Python script, a bash command, your app's backend, or any HTTP client. All the AI runs on our side.

Quick start

Get an API key from your dashboard, then make a POST request:

curl -X POST https://uipunch.com/api/v1/generate \
  -H "Authorization: Bearer uip_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Dark mode paywall for a fitness app",
    "framework": "react"
  }'

That's it. You get back code (production-ready component) in your requested framework.

To generate a new screen while staying consistent with existing app code, pass mode: "generate" + contextCode:

curl -X POST https://uipunch.com/api/v1/generate \
  -H "Authorization: Bearer uip_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "generate",
    "framework": "react",
    "prompt": "Add a settings screen matching our current style",
    "contextCode": "export function ExistingScreen() { ... }",
    "projectContext": "Design tokens + shared component conventions"
  }'

To enhance an existing screen, send your current code in existingCode:

curl -X POST https://uipunch.com/api/v1/generate \
  -H "Authorization: Bearer uip_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "enhance",
    "framework": "react",
    "prompt": "Improve visual hierarchy and CTA clarity",
    "existingCode": "export default function Screen() { ... }",
    "projectContext": "theme colors: #0B1220, #14B8A6; buttons use rounded-xl; spacing scale: 4,8,12,16..."
  }'

For website-quality parity

  • Use default mode (do not pass openrouterKey or model).
  • Pass framework explicitly when possible.
  • For generate-with-context, pass mode: "generate" + contextCode.
  • For enhance, pass mode: "enhance" + existingCode (+ optional projectContext).

Bring Your Own Model

Use any model. We provide the design intelligence.

By default, UIPunch uses our recommended managed model setup. If you prefer, you can bring your own model.

Pass your own openrouterKey and model in the request. We still handle request orchestration and generation flow. Your model handles final code generation.

Quality depends on the model you choose in BYOM mode. Fast/cheap models can look noticeably weaker than the website default stack.

Default mode

We run the full managed generation stack.

Cost: from 1 credit / min $3.00 overage per screen

BYOM mode

Your model, our orchestration. You pay your own LLM costs.

Cost: from 1 credit / min $0.50 overage per screen

curl -X POST https://uipunch.com/api/v1/generate \
  -H "Authorization: Bearer uip_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Profile page for a music app with stats and follow button",
    "framework": "react",
    "openrouterKey": "sk-or-v1-your-openrouter-key",
    "model": "anthropic/claude-sonnet-4"
  }'

Works with any model on OpenRouter — Claude, GPT-4o, Gemini, Llama, Mistral, and more.

Use with AI coding tools

Cursor, Windsurf, Claude Code, or any AI agent

You can tell your AI coding tool to call UIPunch whenever it needs to build UI. Instead of generating generic UI directly, it can request production-quality code from UIPunch.

Cursor Rules

Add this to your project's .cursor/rules so Cursor uses UIPunch automatically:

# .cursor/rules/uipunch.mdc
---
description: Use UIPunch API for UI generation
globs: ["**/*.tsx", "**/*.jsx", "**/*.html"]
---

When the user asks to generate or build any UI screen:

1. Call UIPunch:
   curl -X POST https://uipunch.com/api/v1/generate \
     -H "Authorization: Bearer ${UIPUNCH_API_KEY}" \
     -H "Content-Type: application/json" \
     -d '{"prompt": "<what the user asked for>", "framework": "react"}'

2. Use the "code" field from the response.
3. Don't change the design decisions — colors, spacing, layout
   are already production-ready. Adapt imports to fit the project.

Batch generation

Generate an entire app's UI in one script:

import requests, os

API_KEY = os.environ["UIPUNCH_API_KEY"]
SCREENS = [
    ("Onboarding", "Welcome screen with feature highlights"),
    ("Home", "Dashboard with daily stats and quick actions"),
    ("Profile", "User profile with avatar and settings"),
    ("Paywall", "Premium upgrade with plan toggle"),
]

for name, prompt in SCREENS:
    resp = requests.post(
        "https://uipunch.com/api/v1/generate",
        headers={"Authorization": f"Bearer {API_KEY}"},
        json={"prompt": prompt, "framework": "react"}
    )
    code = resp.json()["code"]
    with open(f"src/screens/{name}.tsx", "w") as f:
        f.write(code)
    print(f"✓ {name}.tsx")

API reference

Authentication

Pass your API key in the Authorization header:

Authorization: Bearer uip_your_api_key_here
POST

/api/v1/generate

ParameterTypeDescription
promptstringWhat to build or improve. Required for generation; optional in enhance mode.
frameworkstringhtml_tailwind, react, react_native, swiftui, flutter. If omitted, inferred from provided code when possible.
categorystringApp category for better pattern matching (Health, Finance, Social Media, etc.)
screenCountnumberNumber of screens, 1–8. Default: 1
imagestringOptional base64 screenshot for image-based enhancement
existingCodestringCode to enhance directly (used with mode: "enhance")
contextCodestringExisting code context for style/architecture alignment in generate mode
projectContextstringDesign tokens, shared components, brand rules, and constraints
modestring"generate" or "enhance"
openrouterKeystringBYOM: your OpenRouter API key
modelstringBYOM: model ID (e.g. anthropic/claude-sonnet-4, openai/gpt-4o)

Response

{
  "code": "export default function PaywallScreen() { ... }",
  "framework": "react",
  "frameworkSource": "explicit",
  "screenCount": 1,
  "operation": "generate",
  "mode": "default",
  "creditsRemaining": 29,
  "overageCharged": false
}
POST

/api/v1/audit

Upload a screenshot, get a detailed design audit scorecard.

ParameterTypeDescription
imagestringBase64-encoded screenshot. Required.

Error codes

StatusMeaning
401Invalid or missing API key
402No credits or balance remaining
409Concurrent billing conflict — retry the request
413Image payload too large
429Rate limit exceeded
400Missing required parameters
500Server error — retry

Pricing

API access requires Pro or higher. Credits are shared between the web app and API, and your dashboard shows a cycle-level web/API split.

Pro

50

credits/month

Business

50

credits/seat/month

Enterprise

Custom

volume pricing

OperationCreditsOverage
Generation / iterationfrom 1 per screen (metered)min $3.00
Generation (BYOM)from 1 per screen (metered)min $0.50
Design auditfrom 1 (metered)min $0.50

Included credits and overage are both metered by usage. If a request needs more credits than you have left, prepaid overage is used automatically.

Ready to integrate?

Sign up to create your API key. API access is included on Pro, Business, and Enterprise plans.

Get Your API Key