All posts
July 16, 2026 14 min read

Flowchart API Tutorial for AI Agents: Create and Export Diagrams Over HTTP

End-to-end tutorial for AI agents and scripts: create flowcharts, org charts, pie charts, mind maps, and Venn diagrams via the free FreeFlowCharts REST API — with curl examples and validation tips.

api ai-agents tutorial flowchart rest automation

AI agents are great at describing processes in prose and JSON — but humans still understand diagrams faster. FreeFlowCharts exposes a free REST API so agents, chatbots, and automation jobs can create shareable diagrams without a browser session.

This tutorial walks through request shapes, examples, exports, rate limits, and production hardening tips.

What the API gives you

  • Create endpoints for flowchart, Venn, org chart, pie chart, and mind map
  • Shareable links for interactive viewing
  • Export endpoints for JSON/SVG (diagram-type dependent)
  • No API key: for standard public rate limits (30 requests/hour per IP by default)
  • Validation and sanitization so agents cannot inject script payloads into labels
  • Full reference: API Docs.

    Base URL

    https://freeflowcharts.app

    All paths below are relative to that host.

    Create a flowchart (curl)

    curl -X POST https://freeflowcharts.app/api/create-flowchart \
      -H "Content-Type: application/json" \
      -d '{
        "title": "Password reset",
        "nodes": [
          { "id": "1", "label": "Start", "type": "start", "x": 0, "y": 0 },
          { "id": "2", "label": "Enter email", "type": "process", "x": 0, "y": 120 },
          { "id": "3", "label": "Email found?", "type": "decision", "x": 0, "y": 240 },
          { "id": "4", "label": "Send reset link", "type": "process", "x": -160, "y": 360 },
          { "id": "5", "label": "Show generic message", "type": "process", "x": 160, "y": 360 },
          { "id": "6", "label": "End", "type": "end", "x": 0, "y": 480 }
        ],
        "edges": [
          { "id": "e1", "source": "1", "target": "2" },
          { "id": "e2", "source": "2", "target": "3" },
          { "id": "e3", "source": "3", "target": "4", "label": "Yes" },
          { "id": "e4", "source": "3", "target": "5", "label": "No" },
          { "id": "e5", "source": "4", "target": "6" },
          { "id": "e6", "source": "5", "target": "6" }
        ]
      }'

    A successful response includes identifiers and a view URL you can return to the end user.

    Layout note for agents

    If you omit careful coordinates, use consistent spacing (for example 120px vertical gaps) or rely on server-side layout where applicable. For org charts and mind maps, the service applies auto-layout based on parent relationships — prefer parent IDs over hand-tuned x/y.

    Org chart example

    curl -X POST https://freeflowcharts.app/api/create-orgchart \
      -H "Content-Type: application/json" \
      -d '{
        "title": "Platform team",
        "nodes": [
          { "id": "1", "label": "VP Engineering", "title": "Vice President" },
          { "id": "2", "label": "Platform Lead", "title": "Manager", "parentId": "1" },
          { "id": "3", "label": "SRE", "title": "Engineer", "parentId": "2" },
          { "id": "4", "label": "Infra", "title": "Engineer", "parentId": "2" }
        ]
      }'

    Mind map example

    curl -X POST https://freeflowcharts.app/api/create-mindmap \
      -H "Content-Type: application/json" \
      -d '{
        "title": "Launch checklist",
        "nodes": [
          { "id": "1", "label": "Launch" },
          { "id": "2", "label": "Product", "parentId": "1" },
          { "id": "3", "label": "Marketing", "parentId": "1" },
          { "id": "4", "label": "QA sign-off", "parentId": "2" },
          { "id": "5", "label": "Press kit", "parentId": "3" }
        ]
      }'

    Pie chart example

    curl -X POST https://freeflowcharts.app/api/create-piechart \
      -H "Content-Type: application/json" \
      -d '{
        "title": "Q1 revenue mix",
        "slices": [
          { "label": "Product A", "value": 40 },
          { "label": "Product B", "value": 35 },
          { "label": "Services", "value": 25 }
        ],
        "donut": true
      }'

    Agent design pattern

  • Parse user intent — “Draw our refund process.”
  • Extract steps and decisions into structured JSON (nodes + edges).
  • Validate — every edge endpoint exists; every decision has ≥2 labeled exits; exactly one clear start.
  • POST to the create endpoint.
  • Return the share URL (and optionally fetch SVG/JSON export for embedding).
  • Offer edits — user says “add a fraud check after payment”; agent patches JSON and recreates or updates if your product flow supports it.
  • Validation checklist agents should run client-side

  • Unique node id values
  • No edges to missing IDs
  • Labels under a reasonable length (avoid dumping entire documents into a box)
  • Decision nodes have labels that read as questions
  • Strip HTML from labels (the API also escapes dangerous content server-side)
  • Rate limits and production use

    Public usage is rate-limited per IP. For higher throughput (internal tools, multi-tenant agents):

  • Cache generated diagrams when inputs are identical
  • Batch human-facing generation rather than per-token streaming calls
  • Contact [email protected] for higher limits when appropriate
  • Security notes for agent builders

  • Treat diagram labels as untrusted text if they include user content
  • Do not put secrets (API keys, tokens) into node labels or titles
  • Prefer share links with least privilege expectations (view-only)
  • Related deep dives

  • Free Flowchart API for AI Agents
  • Reliable Flowchart API: Dagre, Validation, XSS Defense
  • API documentation
  • Try it visually first

    If you are designing the schema an agent should emit, build one sample diagram in the editor, export JSON, and mirror that shape in your tool’s output parser. That reduces schema drift between human and agent paths.