Flow management endpoints
Use the /flows endpoint to create, read, update, and delete flows.
If you want to use the Langflow API to run a flow, see Flow trigger endpoints.
Create flow
Creates a new flow.
- Python
- JavaScript
- curl
1import os
2
3import requests
4
5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/"
6
7headers = {
8 "accept": "application/json",
9 "Content-Type": "application/json",
10 "x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
11}
12
13payload = {
14 "name": "string2",
15 "description": "string",
16 "icon": "string",
17 "icon_bg_color": "#FF0000",
18 "gradient": "string",
19 "data": {},
20 "is_component": False,
21 "updated_at": "2024-12-30T15:48:01.519Z",
22 "webhook": False,
23 "endpoint_name": "string",
24 "tags": ["string"],
25}
26
27response = requests.request("POST", url, headers=headers, json=payload)
28response.raise_for_status()
29
30print(response.text)
31
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/`;
2
3const options = {
4 method: 'POST',
5 headers: {
6 "accept": `application/json`,
7 "Content-Type": `application/json`,
8 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
9 },
10 body: JSON.stringify({
11 "name": "string2",
12 "description": "string",
13 "icon": "string",
14 "icon_bg_color": "#FF0000",
15 "gradient": "string",
16 "data": {},
17 "is_component": false,
18 "updated_at": "2024-12-30T15:48:01.519Z",
19 "webhook": false,
20 "endpoint_name": "string",
21 "tags": [
22 "string"
23 ]
24}),
25};
26
27fetch(url, options)
28 .then(async (response) => {
29 if (!response.ok) {
30 throw new Error(`HTTP ${response.status}`);
31 }
32 const text = await response.text();
33 console.log(text);
34 })
35 .catch((error) => console.error(error));
36
1curl -X POST \
2 "$LANGFLOW_URL/api/v1/flows/" \
3 -H "accept: application/json" \
4 -H "Content-Type: application/json" \
5 -H "x-api-key: $LANGFLOW_API_KEY" \
6 -d '{
7 "name": "string2",
8 "description": "string",
9 "icon": "string",
10 "icon_bg_color": "#FF0000",
11 "gradient": "string",
12 "data": {},
13 "is_component": false,
14 "updated_at": "2024-12-30T15:48:01.519Z",
15 "webhook": false,
16 "endpoint_name": "string",
17 "tags": [
18 "string"
19 ]
20}'
21
Result
1{
2 "name": "string2",
3 "description": "string",
4 "icon": "string",
5 "icon_bg_color": "#FF0000",
6 "gradient": "string",
7 "data": {},
8 "is_component": false,
9 "updated_at": "2025-02-04T21:07:36+00:00",
10 "webhook": false,
11 "endpoint_name": "string",
12 "tags": ["string"],
13 "locked": false,
14 "id": "e8d81c37-714b-49ae-ba82-e61141f020ee",
15 "user_id": "f58396d4-a387-4bb8-b749-f40825c3d9f3",
16 "project_id": "1415de42-8f01-4f36-bf34-539f23e47466"
17}
18
Create flows
Creates multiple new flows, returning an array of flow objects.
- Python
- JavaScript
- curl
1import os
2import uuid
3
4import requests
5
6base = os.environ.get("LANGFLOW_URL", "")
7api_key = os.environ.get("LANGFLOW_API_KEY", "")
8folder_id = (os.environ.get("PROJECT_ID") or os.environ.get("FOLDER_ID") or "").strip()
9
10headers = {"accept": "application/json", "Content-Type": "application/json", "x-api-key": api_key}
11
12
13def _flow_doc(suffix: str) -> dict:
14 doc = {
15 "name": f"batch-flow-{uuid.uuid4().hex[:8]}",
16 "description": f"Docs batch example {suffix}",
17 "data": {"nodes": [], "edges": []},
18 }
19 if folder_id:
20 doc["folder_id"] = folder_id
21 return doc
22
23
24payload = {"flows": [_flow_doc("A"), _flow_doc("B")]}
25
26response = requests.post(f"{base}/api/v1/flows/batch/", headers=headers, json=payload, timeout=30)
27response.raise_for_status()
28print(response.text)
29
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/batch/`;
2
3const options = {
4 method: 'POST',
5 headers: {
6 "accept": `application/json`,
7 "Content-Type": `application/json`,
8 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
9 },
10 body: JSON.stringify({
11 "flows": [
12 {
13 "name": "string",
14 "description": "string",
15 "icon": "string",
16 "icon_bg_color": "string",
17 "gradient": "string",
18 "data": {},
19 "is_component": false,
20 "updated_at": "2024-12-30T18:36:02.737Z",
21 "webhook": false,
22 "endpoint_name": "string",
23 "tags": [
24 "string"
25 ],
26 "locked": false,
27 "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
28 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
29 },
30 {
31 "name": "string",
32 "description": "string",
33 "icon": "string",
34 "icon_bg_color": "string",
35 "gradient": "string",
36 "data": {},
37 "is_component": false,
38 "updated_at": "2024-12-30T18:36:02.737Z",
39 "webhook": false,
40 "endpoint_name": "string",
41 "tags": [
42 "string"
43 ],
44 "locked": false,
45 "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
46 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
47 }
48 ]
49}),
50};
51
52fetch(url, options)
53 .then(async (response) => {
54 if (!response.ok) {
55 throw new Error(`HTTP ${response.status}`);
56 }
57 const text = await response.text();
58 console.log(text);
59 })
60 .catch((error) => console.error(error));
61
1curl -X POST \
2 "$LANGFLOW_URL/api/v1/flows/batch/" \
3 -H "accept: application/json" \
4 -H "Content-Type: application/json" \
5 -H "x-api-key: $LANGFLOW_API_KEY" \
6 -d '{
7 "flows": [
8 {
9 "name": "string",
10 "description": "string",
11 "icon": "string",
12 "icon_bg_color": "string",
13 "gradient": "string",
14 "data": {},
15 "is_component": false,
16 "updated_at": "2024-12-30T18:36:02.737Z",
17 "webhook": false,
18 "endpoint_name": "string",
19 "tags": [
20 "string"
21 ],
22 "locked": false,
23 "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
24 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
25 },
26 {
27 "name": "string",
28 "description": "string",
29 "icon": "string",
30 "icon_bg_color": "string",
31 "gradient": "string",
32 "data": {},
33 "is_component": false,
34 "updated_at": "2024-12-30T18:36:02.737Z",
35 "webhook": false,
36 "endpoint_name": "string",
37 "tags": [
38 "string"
39 ],
40 "locked": false,
41 "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
42 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
43 }
44 ]
45}'
46
Read flow
Retrieves a specific flow by its ID.
- Python
- JavaScript
- curl
1import os
2
3import requests
4
5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/{os.getenv('FLOW_ID', '')}"
6
7headers = {
8 "accept": "application/json",
9 "x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
10}
11
12response = requests.request("GET", url, headers=headers)
13response.raise_for_status()
14
15print(response.text)
16
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/${process.env.FLOW_ID ?? ""}`;
2
3const options = {
4 method: 'GET',
5 headers: {
6 "accept": `application/json`,
7 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
8 },
9};
10
11fetch(url, options)
12 .then(async (response) => {
13 if (!response.ok) {
14 throw new Error(`HTTP ${response.status}`);
15 }
16 const text = await response.text();
17 console.log(text);
18 })
19 .catch((error) => console.error(error));
20
1curl -X GET \
2 "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \
3 -H "accept: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY"
5
Result
1{
2 "name": "Basic Prompting",
3 "description": "Perform basic prompting with an OpenAI model.",
4 "icon": "Braces",
5 "icon_bg_color": null,
6 "gradient": "2",
7 "data": {
8 "nodes": [
9 ...
10 ]
11 }
12}
13
Read flows
Returns a JSON object containing a list of flows.
Retrieve all flows with pagination:
- Python
- JavaScript
- curl
1import os
2
3import requests
4
5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/?remove_example_flows=false&components_only=false&get_all=true&header_flows=false&page=1&size=50"
6
7headers = {
8 "accept": "application/json",
9 "x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
10}
11
12response = requests.request("GET", url, headers=headers)
13response.raise_for_status()
14
15print(response.text)
16
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/?remove_example_flows=false&components_only=false&get_all=true&header_flows=false&page=1&size=50`;
2
3const options = {
4 method: 'GET',
5 headers: {
6 "accept": `application/json`,
7 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
8 },
9};
10
11fetch(url, options)
12 .then(async (response) => {
13 if (!response.ok) {
14 throw new Error(`HTTP ${response.status}`);
15 }
16 const text = await response.text();
17 console.log(text);
18 })
19 .catch((error) => console.error(error));
20
1curl -X GET \
2 "$LANGFLOW_URL/api/v1/flows/?remove_example_flows=false&components_only=false&get_all=true&header_flows=false&page=1&size=50" \
3 -H "accept: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY"
5
To retrieve flows from a specific project, use the project_id query parameter:
- Python
- JavaScript
- curl
1import os
2
3import requests
4
5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/?remove_example_flows=true&components_only=false&get_all=false&project_id={os.getenv('PROJECT_ID', '')}&header_flows=false&page=1&size=1"
6
7headers = {
8 "accept": "application/json",
9 "x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
10}
11
12response = requests.request("GET", url, headers=headers)
13response.raise_for_status()
14
15print(response.text)
16
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/?remove_example_flows=true&components_only=false&get_all=false&project_id=${process.env.PROJECT_ID ?? ""}&header_flows=false&page=1&size=1`;
2
3const options = {
4 method: 'GET',
5 headers: {
6 "accept": `application/json`,
7 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
8 },
9};
10
11fetch(url, options)
12 .then(async (response) => {
13 if (!response.ok) {
14 throw new Error(`HTTP ${response.status}`);
15 }
16 const text = await response.text();
17 console.log(text);
18 })
19 .catch((error) => console.error(error));
20
1curl -X GET \
2 "$LANGFLOW_URL/api/v1/flows/?remove_example_flows=true&components_only=false&get_all=false&project_id=$PROJECT_ID&header_flows=false&page=1&size=1" \
3 -H "accept: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY"
5
Read sample flows
Retrieves a list of sample flows:
- Python
- JavaScript
- curl
1import os
2
3import requests
4
5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/basic_examples/"
6
7headers = {
8 "accept": "application/json",
9 "x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
10}
11
12response = requests.request("GET", url, headers=headers)
13response.raise_for_status()
14
15print(response.text)
16
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/basic_examples/`;
2
3const options = {
4 method: 'GET',
5 headers: {
6 "accept": `application/json`,
7 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
8 },
9};
10
11fetch(url, options)
12 .then(async (response) => {
13 if (!response.ok) {
14 throw new Error(`HTTP ${response.status}`);
15 }
16 const text = await response.text();
17 console.log(text);
18 })
19 .catch((error) => console.error(error));
20
1curl -X GET \
2 "$LANGFLOW_URL/api/v1/flows/basic_examples/" \
3 -H "accept: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY"
5
Update flow
Updates an existing flow by its ID.
This example changes the value for endpoint_name from a random UUID to my_new_endpoint_name.
- Python
- JavaScript
- curl
1import os
2import uuid
3
4import requests
5
6base = os.environ.get("LANGFLOW_URL") or os.environ.get("LANGFLOW_SERVER_URL", "")
7flow_id = os.environ.get("FLOW_ID", "")
8api_key = os.environ.get("LANGFLOW_API_KEY", "")
9
10headers = {"accept": "application/json", "Content-Type": "application/json", "x-api-key": api_key}
11
12payload = {
13 "name": f"docs-example-updated-flow-{uuid.uuid4().hex[:8]}",
14 "description": "Updated via API docs Python example",
15 "locked": False,
16}
17
18response = requests.patch(f"{base}/api/v1/flows/{flow_id}", headers=headers, json=payload, timeout=30)
19response.raise_for_status()
20print(response.text)
21
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/${process.env.FLOW_ID ?? ""}`;
2
3const options = {
4 method: 'PATCH',
5 headers: {
6 "accept": `application/json`,
7 "Content-Type": `application/json`,
8 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
9 },
10 body: JSON.stringify({
11 "name": "string",
12 "description": "string",
13 "data": {},
14 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
15 "endpoint_name": "my_new_endpoint_name",
16 "locked": true
17}),
18};
19
20fetch(url, options)
21 .then(async (response) => {
22 if (!response.ok) {
23 throw new Error(`HTTP ${response.status}`);
24 }
25 const text = await response.text();
26 console.log(text);
27 })
28 .catch((error) => console.error(error));
29
1curl -X PATCH \
2 "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \
3 -H "accept: application/json" \
4 -H "Content-Type: application/json" \
5 -H "x-api-key: $LANGFLOW_API_KEY" \
6 -d '{
7 "name": "string",
8 "description": "string",
9 "data": {},
10 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
11 "endpoint_name": "my_new_endpoint_name",
12 "locked": true
13}'
14
Result
1{
2 "name": "string",
3 "description": "string",
4 "icon": "Braces",
5 "icon_bg_color": null,
6 "gradient": "2",
7 "data": {},
8 "is_component": false,
9 "updated_at": "2024-12-30T18:30:22+00:00",
10 "webhook": false,
11 "endpoint_name": "my_new_endpoint_name",
12 "tags": null,
13 "locked": true,
14 "id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",
15 "user_id": "f58396d4-a387-4bb8-b749-f40825c3d9f3",
16 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
17}
18
Delete flow
Deletes a specific flow by its ID.
- Python
- JavaScript
- curl
1import os
2
3import requests
4
5base = os.environ.get("LANGFLOW_URL", "")
6api_key = os.environ.get("LANGFLOW_API_KEY", "")
7
8headers = {"accept": "application/json", "Content-Type": "application/json", "x-api-key": api_key}
9
10create = requests.post(
11 f"{base}/api/v1/flows/",
12 headers=headers,
13 json={
14 "name": "docs-example-delete-me",
15 "description": "Temporary flow for delete-flow example",
16 "data": {"nodes": [], "edges": []},
17 },
18 timeout=30,
19)
20create.raise_for_status()
21flow_id = create.json()["id"]
22
23delete = requests.delete(f"{base}/api/v1/flows/{flow_id}", headers=headers, timeout=30)
24delete.raise_for_status()
25print(delete.text)
26
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/${process.env.FLOW_ID ?? ""}`;
2
3const options = {
4 method: 'DELETE',
5 headers: {
6 "accept": `application/json`,
7 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
8 },
9};
10
11fetch(url, options)
12 .then(async (response) => {
13 if (!response.ok) {
14 throw new Error(`HTTP ${response.status}`);
15 }
16 const text = await response.text();
17 console.log(text);
18 })
19 .catch((error) => console.error(error));
20
1curl -X DELETE \
2 "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \
3 -H "accept: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY"
5
Result
1{
2 "message": "Flow deleted successfully"
3}
4
Export flows
Exports specified flows to a ZIP file.
This endpoint downloads a ZIP file containing Langflow JSON files for each flow ID listed in the request body.
- Python
- JavaScript
- curl
1import os
2
3import requests
4
5base = os.environ.get("LANGFLOW_URL", "")
6api_key = os.environ.get("LANGFLOW_API_KEY", "")
7flow_id = os.environ.get("FLOW_ID", "")
8folder_id = os.environ.get("PROJECT_ID") or os.environ.get("FOLDER_ID", "")
9
10headers = {
11 "accept": "application/json",
12 "Content-Type": "application/json",
13 "x-api-key": api_key,
14}
15
16# Export needs at least two flows to return a ZIP; a single id returns JSON.
17extra = requests.post(
18 f"{base}/api/v1/flows/",
19 headers=headers,
20 json={
21 "name": "docs-export-temp-flow",
22 "description": "Temporary second flow for export example",
23 "data": {"nodes": [], "edges": []},
24 **({"folder_id": folder_id} if folder_id else {}),
25 },
26 timeout=30,
27)
28extra.raise_for_status()
29extra_id = extra.json()["id"]
30
31payload = [flow_id, extra_id]
32
33response = requests.post(f"{base}/api/v1/flows/download/", headers=headers, json=payload, timeout=60)
34response.raise_for_status()
35
36with open("langflow-flows.zip", "wb") as f:
37 f.write(response.content)
38print("Saved response to langflow-flows.zip")
39
40requests.delete(f"{base}/api/v1/flows/{extra_id}", headers=headers, timeout=30)
41
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/download/`;
2
3const options = {
4 method: 'POST',
5 headers: {
6 "accept": `application/json`,
7 "Content-Type": `application/json`,
8 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
9 },
10 body: JSON.stringify([
11 "e1e40c77-0541-41a9-88ab-ddb3419398b5",
12 "92f9a4c5-cfc8-4656-ae63-1f0881163c28"
13]),
14};
15
16fetch(url, options)
17 .then(async (response) => {
18 if (!response.ok) {
19 throw new Error(`HTTP ${response.status}`);
20 }
21 const data = await response.arrayBuffer();
22 console.log("Received binary response for langflow-flows.zip", data.byteLength);
23 })
24 .catch((error) => console.error(error));
25
1curl -X POST \
2 "$LANGFLOW_URL/api/v1/flows/download/" \
3 -H "accept: application/json" \
4 -H "Content-Type: application/json" \
5 -H "x-api-key: $LANGFLOW_API_KEY" \
6 -d '[
7 "e1e40c77-0541-41a9-88ab-ddb3419398b5",
8 "92f9a4c5-cfc8-4656-ae63-1f0881163c28"
9]' \
10 --output langflow-flows.zip
11
Result
1 % Total % Received % Xferd Average Speed Time Time Time Current
2 Dload Upload Total Spent Left Speed
3100 76437 0 76353 100 84 4516k 5088 --:--:-- --:--:-- --:--:-- 4665k
4
Import flows
Imports flows by uploading a Langflow-compatible JSON file.
To specify a target project for the flow, include the query parameter folder_id.
The target folder_id must already exist before uploading a flow. Call the /api/v1/projects/ endpoint for a list of available folders and projects.
This example uploads a local file named agent-with-astra-db-tool.json to a folder specified by a FOLDER_ID variable:
- Python
- JavaScript
- curl
1import os
2
3import requests
4
5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/upload/?folder_id={os.getenv('FOLDER_ID', '')}"
6
7headers = {
8 "accept": "application/json",
9 "x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
10}
11
12files = {
13 "file": open(os.getenv("FLOW_IMPORT_FILE", "docs/docs/API-Reference/fixtures/flow-import.json"), "rb"),
14}
15
16response = requests.request("POST", url, headers=headers, files=files)
17response.raise_for_status()
18
19print(response.text)
20
21for _f in files.values():
22 if hasattr(_f, "close"):
23 _f.close()
24
1const fs = require("fs");
2const path = require("path");
3
4const fixturesDir = path.join(__dirname, "../../fixtures");
5const defaultFlowImport = path.join(fixturesDir, "flow-import.json");
6const flowImportPath = process.env.FLOW_IMPORT_FILE || defaultFlowImport;
7const flowBuf = fs.readFileSync(flowImportPath);
8const flowName = path.basename(flowImportPath);
9
10const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/flows/upload/?folder_id=${process.env.FOLDER_ID ?? ""}`;
11
12const formData = new FormData();
13formData.append("file", new Blob([flowBuf], { type: "application/json" }), flowName);
14
15const options = {
16 method: "POST",
17 headers: {
18 accept: "application/json",
19 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
20 },
21 body: formData,
22};
23
24fetch(url, options)
25 .then(async (response) => {
26 if (!response.ok) {
27 throw new Error(`HTTP ${response.status}`);
28 }
29 const text = await response.text();
30 console.log(text);
31 })
32 .catch((error) => console.error(error));
33
1SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2DEFAULT_FLOW_IMPORT_FILE="$SCRIPT_DIR/../../fixtures/flow-import.json"
3FLOW_IMPORT_FILE="${FLOW_IMPORT_FILE:-$DEFAULT_FLOW_IMPORT_FILE}"
4
5curl -X POST \
6 "$LANGFLOW_URL/api/v1/flows/upload/?folder_id=$FOLDER_ID" \
7 -H "accept: application/json" \
8 -H "Content-Type: multipart/form-data" \
9 -H "x-api-key: $LANGFLOW_API_KEY" \
10 -F "file=@${FLOW_IMPORT_FILE};type=application/json"
11
Result
_11[_11 {_11 "name": "agent-with-astra-db-tool",_11 "description": "",_11 "icon": null,_11 "icon_bg_color": null,_11 "gradient": null,_11 "data": {}_11 ..._11 }_11]