API Reference
Agents
The Agents API is the core of floow.design. Send a natural language prompt and receive streamed AI tool calls that generate pixel-perfect mobile app screens. The agent uses extended thinking (Gemini 2.5 Pro) and can plan, create, and iterate on entire app flows.
Send a Design Prompt
POST
/api/v1/chat🔑 Auth requiredStream a design generation session. The agent plans screens, creates HTML frames, and emits UI message stream events. Responses are Server-Sent Events (SSE).
- Responses are streamed as Server-Sent Events — consume with ReadableStream or EventSource.
- A single prompt may trigger multiple tool calls (plan → create → update). Each is emitted as a separate event.
- The agent may generate 1–10+ frames depending on the prompt complexity.
Body Parameters
| Name | Type | Required | Description |
|---|---|---|---|
messages | UIMessage[] | Yes | Conversation history. Each message has role (user | assistant) and parts array. |
projectId | string | Yes | Your floow.design project ID. Open a project in the dashboard — the ID is in the URL (/project/<id>). |
id | string | Yes | Client-generated unique chat session ID (UUID recommended). |
themeId | string | No | Optional saved theme ID to apply to generated screens. |
Request body
{ "id": "sess_01abc123", "projectId": "proj_xyz789", "messages": [ { "id": "msg_1", "role": "user", "parts": [ { "type": "text", "text": "Build me a fitness tracking app — home screen, workout log, and progress charts" } ] } ]}Response
// Server-Sent Events stream (text/event-stream)
data: {"type":"text","text":"I'll design three screens for your fitness app..."}
data: {"type":"tool-call","toolName":"plan_screens","args":{"screens":["Home","Workout Log","Progress"]}}
data: {"type":"tool-result","toolName":"create_screen","result":{"frameId":"frm_abc"}}
data: {"type":"finish","finishReason":"stop"}Consuming the Stream
TypeScript — reading the SSE stream
import { v4 as uuid } from "uuid";
const res = await fetch("https://www.floow.design/api/v1/chat", { method: "POST", headers: { Authorization: "Bearer fl_your_api_key_here", "Content-Type": "application/json", }, body: JSON.stringify({ id: uuid(), projectId: "proj_xyz789", messages: [ { id: uuid(), role: "user", parts: [{ type: "text", text: "Create a login screen for a banking app" }], }, ], }),});
if (!res.ok) { const { error } = await res.json(); throw new Error(error);}
const reader = res.body!.getReader();const decoder = new TextDecoder();
while (true) { const { done, value } = await reader.read(); if (done) break;
const chunk = decoder.decode(value); for (const line of chunk.split("\n")) { if (!line.startsWith("data: ")) continue; const event = JSON.parse(line.slice(6)); console.log(event); }}