---
title: "Generate a flow from text with AI"
method: POST
path: "/flows/generate"
tags: ["AI"]
---

# Generate a flow from text with AI

`POST /flows/generate`

## Request

- Base URL: `https://lnzcwfswvljbijqszxxn.supabase.co/functions/v1/api/v1`
- URL: `https://lnzcwfswvljbijqszxxn.supabase.co/functions/v1/api/v1/flows/generate`
- Auth: HTTP bearer

Turns a transcript, call notes, or a plain description into a new process flow diagram. Counts against the plan of the key owner.

## Request body

- object
  - `text` string, required: The transcript, notes, or process description.
  - `title` string: Optional. Wavelength picks a title when empty.
  - `direction` 'vertical' | 'horizontal'
  - `team_id` string, uuid

## Response `201`

The new flow.

- FlowResponse
  - `flow` Flow
    - `id` string, uuid
    - `title` string
    - `graph_nodes` Node[]
      - `id` string: Unique in the flow. Default n1, n2.
      - `type` 'start' | 'step' | 'decision' | 'data' | 'system' | 'actor' | 'end' | 'screen'
      - `label` string, required
      - `owner` string: Role or team that does the step. Used for swimlanes.
      - `x` number
      - `y` number
    - `graph_edges` Edge[]
      - `id` string
      - `source` string, required
      - `target` string, required
      - `label` string
    - `transcript` string, nullable
    - `diagram_code` string, nullable
    - `team_id` string, nullable
    - `folder_id` string, nullable
    - `is_public` boolean
    - `owner` string
    - `created_at` string, date-time
    - `updated_at` string, date-time

## Other responses

- `400`: Error. Codes: bad_request, bad_graph, unauthorized, key_expired, save_failed, missing_scope, not_found, rate_limited, internal.
- `401`: Error. Codes: bad_request, bad_graph, unauthorized, key_expired, save_failed, missing_scope, not_found, rate_limited, internal.
- `403`: Error. Codes: bad_request, bad_graph, unauthorized, key_expired, save_failed, missing_scope, not_found, rate_limited, internal.
- `404`: Error. Codes: bad_request, bad_graph, unauthorized, key_expired, save_failed, missing_scope, not_found, rate_limited, internal.
- `429`: Error. Codes: bad_request, bad_graph, unauthorized, key_expired, save_failed, missing_scope, not_found, rate_limited, internal.

---

[API](https://skmtc.dev/wavelengthflow/apis/wavelength-api.md) · [All operations](https://skmtc.dev/wavelengthflow/apis/wavelength-api/llms.txt) · [OpenAPI document](https://skmtc.dev/wavelengthflow/apis/wavelength-api/revisions/676f533e10d5?raw)
