Reference

API reference

Base URL: https://getmorphis.com (client-side SDK) and https://api.getmorphis.com (direct backend integration).

Authentication

Every generation request carries a tenant API key, either in the JSON body (public route) or in the Authorization: Bearer header (backend route). Keys are created in the dashboard under API Keys and are shown only once.

auth.sh
# Public platform API (key in body)
curl -X POST https://getmorphis.com/api/generate-ui \
  -H "Content-Type: application/json" \
  -d '{"apiKey":"mph_live_...","intent":"..."}'

# Backend directly (key in header)
curl -X POST https://api.getmorphis.com/v1/generate-ui \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer mph_live_..." \
  -d '{"prompt":"...","host_state":{}}'
Treat keys like passwords. Rotate immediately if leaked — the dashboard's "Delete key" revokes instantly since requests are re-validated on every call.

POST /api/generate-ui

Generate a sanitized UI component from a prompt and context data.

Request body (platform route)

request.json
{
  "apiKey": "mph_live_...",            // required — tenant API key
  "intent": "show a churn-risk table",  // required — what to generate (1–2000 chars)
  "contextData": { "mrr": 5400 },       // optional — live data for the UI
  "theme": "light"                      // optional — "light" | "dark" (default light)
}

Response 200

response.json
{
  "html": "<!DOCTYPE html><html>…</html>",
  "metadata": {
    "generationTime": 1830,             // ms, wall clock
    "tokensUsed": 1240,                 // LLM tokens (0 when source = fallback)
    "sanitized": true,                  // content passed the sanitizer
    "model": "nvidia/nemotron-3-ultra", // model used
    "source": "llm"                     // "llm" | "fallback"
  }
}

Error responses

CodeMeaningFix
400Invalid JSON body or missing fieldsCheck request shape; intent and apiKey are required.
401Invalid or missing API keyConfirm the key is active — it may have been revoked.
413contextData too largeKeep payloads under 50 KB on the platform route.
422Schema validation failedPrompt must be ≤ 2,000 chars; theme must be light or dark; host_state caps apply.
429Monthly quota exceededUpgrade your plan or wait for the next billing period.
500Generation failed or empty after sanitizationRetry — output was rejected by the sanitizer. Simplify the intent.
504LLM generation timed outRetry; the free-tier model sometimes runs slowly.

Rate limits & quotas

  • Monthly quota is per-tenant and enforced at the platform route with a 429 when exceeded.
  • Default free tier: 1,000 generations/month. Upgrade in Dashboard → Billing.
  • Every response includes metadata.source so you can monitor LLM vs fallback usage on your side.
Ready to try it? Open the live Playground for zero-config testing.