Skip to main content
Version: 1.10.x (Next)

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.

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
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.

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

Read flow

Retrieves a specific flow by its ID.

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
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:

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

To retrieve flows from a specific project, use the project_id query parameter:

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

Read sample flows

Retrieves a list of sample flows:

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

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.

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
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.

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
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.

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
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:

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
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
]

Search