Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nayalsaurav/ai360/llms.txt

Use this file to discover all available pages before exploring further.

The Flowchart Generator endpoint converts a plain-language process or workflow description into a React Flow–compatible JSON structure containing nodes and edges arrays. Google’s Gemini 2.5 Flash model is guided by a strict system prompt that enforces flowchart rules: exactly one start and one end node, decision nodes with yes/no branches, top-to-bottom flow, and no dead ends. The model also performs input validation — off-topic, vague, or unsafe prompts return a structured error object inside the response body rather than raising an HTTP error.

Request

POST /api/utilities/flowchart-generator
Content-Type: application/json
prompt
string
required
A natural-language description of the process, workflow, algorithm, or system flow you want converted into a flowchart. The more detail you provide (steps, decision points, outcomes), the more accurate the generated chart will be.

Response

Successful generation — HTTP 200

nodes
Node[]
An array of React Flow node objects representing each step in the flowchart.
nodes[].id
string
Unique, meaningful identifier for the node (e.g. create_intent, verify_otp).
nodes[].type
string
Node type. One of: start, end, process, decision, input, output.
nodes[].data.label
string
Short human-readable label for the node (max 6–8 words).
nodes[].position
object
Absolute position on the canvas. x and y are numbers; y increments in steps of 150 for vertical top-to-bottom layout.
edges
Edge[]
An array of React Flow edge objects connecting the nodes.
edges[].id
string
Edge identifier following the pattern source-target (e.g. start-create_intent).
edges[].source
string
The id of the source node.
edges[].target
string
The id of the target node.
edges[].label
string
Optional label on the edge. Decision nodes always produce two edges labelled "yes" and "no".
edges[].animated
string
Optional. When present, set to "true" to animate the edge in React Flow.
{
  "nodes": [
    {
      "id": "start",
      "type": "start",
      "data": { "label": "Start" },
      "position": { "x": 0, "y": 0 }
    },
    {
      "id": "check_auth",
      "type": "decision",
      "data": { "label": "Is User Authenticated?" },
      "position": { "x": 0, "y": 150 }
    },
    {
      "id": "load_dashboard",
      "type": "process",
      "data": { "label": "Load Dashboard" },
      "position": { "x": 0, "y": 300 }
    },
    {
      "id": "redirect_login",
      "type": "process",
      "data": { "label": "Redirect to Login" },
      "position": { "x": 200, "y": 300 }
    },
    {
      "id": "end",
      "type": "end",
      "data": { "label": "End" },
      "position": { "x": 0, "y": 450 }
    }
  ],
  "edges": [
    { "id": "start-check_auth", "source": "start", "target": "check_auth", "animated": "true" },
    { "id": "check_auth-load_dashboard", "source": "check_auth", "target": "load_dashboard", "label": "yes", "animated": "true" },
    { "id": "check_auth-redirect_login", "source": "check_auth", "target": "redirect_login", "label": "no", "animated": "true" },
    { "id": "load_dashboard-end", "source": "load_dashboard", "target": "end", "animated": "true" },
    { "id": "redirect_login-end", "source": "redirect_login", "target": "end", "animated": "true" }
  ]
}

Model-level rejection — HTTP 200 with error body

When the prompt is off-topic, vague, or unsafe, the model returns a 200 response whose body contains only an error field — no nodes or edges are present.
{
  "error": "Invalid or unsafe request. Please provide a valid process or workflow to convert into a flowchart."
}
or
{
  "error": "Your request is unclear. Please describe the steps or process you want as a flowchart."
}
Always check whether the response body contains an error key before attempting to read nodes and edges. A model-level rejection returns HTTP 200, not 4xx.

Error Responses

StatusBodyCause
400{ "error": "Missing prompt" }prompt was absent or empty in the request body.
500{ "error": "Invalid JSON from model", "raw": "<string>" }Gemini returned output that could not be parsed as JSON. The raw text is included for debugging.
500{ "error": "<message>" }Network failure, quota exceeded, or another unexpected server error.
The model strictly validates input intent. Prompts that do not describe a process, workflow, or algorithm — or that request content related to hacking, illegal activity, or harmful topics — will receive a model-level rejection even though the HTTP status is 200.

Flowchart Rules Enforced by the Model

  • Exactly one start node and one end node per chart.
  • Allowed types: start, end, process, decision, input, output.
  • Every decision node has exactly two outgoing edges: "yes" and "no".
  • All paths must reach the end node — no dead ends.
  • Node labels are capped at 6–8 words.
  • Vertical layout: y positions increment in steps of 150.

Example

Request
curl -X POST https://your-domain.com/api/utilities/flowchart-generator \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "User login flow with email and password, including 2FA verification"
  }'
Response
{
  "nodes": [
    { "id": "start", "type": "start", "data": { "label": "Start" }, "position": { "x": 0, "y": 0 } },
    { "id": "enter_credentials", "type": "input", "data": { "label": "Enter Email & Password" }, "position": { "x": 0, "y": 150 } },
    { "id": "validate_credentials", "type": "decision", "data": { "label": "Credentials Valid?" }, "position": { "x": 0, "y": 300 } },
    { "id": "show_error", "type": "output", "data": { "label": "Show Error Message" }, "position": { "x": 200, "y": 300 } },
    { "id": "send_otp", "type": "process", "data": { "label": "Send 2FA OTP" }, "position": { "x": 0, "y": 450 } },
    { "id": "verify_otp", "type": "decision", "data": { "label": "OTP Correct?" }, "position": { "x": 0, "y": 600 } },
    { "id": "otp_error", "type": "output", "data": { "label": "Show OTP Error" }, "position": { "x": 200, "y": 600 } },
    { "id": "load_dashboard", "type": "process", "data": { "label": "Load User Dashboard" }, "position": { "x": 0, "y": 750 } },
    { "id": "end", "type": "end", "data": { "label": "End" }, "position": { "x": 0, "y": 900 } }
  ],
  "edges": [
    { "id": "start-enter_credentials", "source": "start", "target": "enter_credentials", "animated": "true" },
    { "id": "enter_credentials-validate_credentials", "source": "enter_credentials", "target": "validate_credentials", "animated": "true" },
    { "id": "validate_credentials-send_otp", "source": "validate_credentials", "target": "send_otp", "label": "yes", "animated": "true" },
    { "id": "validate_credentials-show_error", "source": "validate_credentials", "target": "show_error", "label": "no", "animated": "true" },
    { "id": "show_error-end", "source": "show_error", "target": "end", "animated": "true" },
    { "id": "send_otp-verify_otp", "source": "send_otp", "target": "verify_otp", "animated": "true" },
    { "id": "verify_otp-load_dashboard", "source": "verify_otp", "target": "load_dashboard", "label": "yes", "animated": "true" },
    { "id": "verify_otp-otp_error", "source": "verify_otp", "target": "otp_error", "label": "no", "animated": "true" },
    { "id": "otp_error-end", "source": "otp_error", "target": "end", "animated": "true" },
    { "id": "load_dashboard-end", "source": "load_dashboard", "target": "end", "animated": "true" }
  ]
}

Build docs developers (and LLMs) love