API Reference

RESTful API for generating full‑stack applications and managing billing programmatically.

Base URL: https://api.genesiscraft.ai
Authentication: All endpoints marked JWT require a valid bearer token in the Authorization header:
Authorization: Bearer <your_jwt>
Tokens are issued by the signup / login flow and stored client‑side. There is no API key required to use the dashboard experience.

JWT POST /api/generate

Start a new full‑stack generation task.

Request body (JSON):

{
  "prompt": "Build a task manager with drag-and-drop and team chat",
  "requirements": {
    "frontend": { "framework": "react" },
    "backend":  { "framework": "fastapi" },
    "database": "postgresql"
  }
}

Response:

{
  "task_id": "task_1699999999_-123456789",
  "status": "processing",
  "websocket_url": "/ws/tasks/task_1699999999_-123456789"
}

The websocket_url is a same‑host path. Connect with:

wss://app.genesiscraft.ai/ws/tasks/<task_id>
If your plan limit has been exceeded, the endpoint returns HTTP 403 with a message like “Usage limit exceeded. Please upgrade your plan.”

WS /ws/tasks/{task_id}

Real‑time task updates. Each message is a JSON object with the task state and, when complete, the artifacts.

{
  "status": "completed",
  "agent_states": {
    "planner": "completed",
    "frontend": "completed",
    "backend": "completed",
    "validator": "completed",
    "integrator": "completed",
    "deployer": "completed"
  },
  "current_agent": null,
  "error": null
}

When artifacts are ready, they can be downloaded from the dashboard or via the task metadata returned by the WebSocket stream.

GET /health

Health check endpoint used by the load balancer.

{"status": "ok"}

GET /

Root health check.

{"status": "ok", "service": "genesis-craft-backend"}

JWT GET /api/billing/subscription

Return the authenticated user’s current plan, limits, and usage.

{
  "plan": "pro_monthly",
  "status": "active",
  "limits": {
    "monthly_tokens": 100000,
    "monthly_requests": 1000,
    "max_projects": 50
  },
  "usage": {
    "tokens_used": 20400,
    "requests_used": 12,
    "overage_cost": 0.0,
    "is_over_limit": false
  }
}

JWT POST /api/billing/create-checkout-session

Create a Stripe Checkout session for a paid plan (Pro, Team, or Enterprise in fixed/hybrid mode). Returns a redirect URL.

{
  "plan": "pro_monthly"
}
{
  "success": true,
  "url": "https://checkout.stripe.com/pay/cs_test_...",
  "session_id": "cs_test_..."
}

GET /api/billing/public/plans

Public plans endpoint used by marketing pages (pricing.html, enterprise.html). No authentication required. Returns the available plans and the current enterprise_mode.

{
  "plans": { "...": {} },
  "enterprise_mode": "hybrid"
}