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

Projects endpoints

Use the /projects endpoint to create, read, update, and delete Langflow projects.

Read projects

Get a list of Langflow projects, including project IDs, names, and descriptions.

1import os 2 3import requests 4 5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/projects/" 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 { 3 "name": "Starter Project", 4 "description": "Manage your own projects. Download and upload projects.", 5 "id": "1415de42-8f01-4f36-bf34-539f23e47466", 6 "parent_id": null 7 } 8] 9

Create project

Create a new project.

1import os 2 3import requests 4 5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/projects/" 6 7headers = { 8 "Content-Type": "application/json", 9 "x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}", 10} 11 12payload = {"name": "new_project_name", "description": "string", "components_list": [], "flows_list": []} 13 14response = requests.request("POST", url, headers=headers, json=payload) 15response.raise_for_status() 16 17print(response.text) 18
Result
1{ 2 "name": "new_project_name", 3 "description": "string", 4 "id": "b408ddb9-6266-4431-9be8-e04a62758331", 5 "parent_id": null 6} 7

To add flows and components at project creation, retrieve the components_list and flows_list values from the /all and /flows/read endpoints and add them to the request body.

Adding a flow to a project moves the flow from its previous location. The flow isn't copied.

1import os 2 3import requests 4 5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/projects/" 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": "new_project_name", 15 "description": "string", 16 "components_list": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"], 17 "flows_list": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"], 18} 19 20response = requests.request("POST", url, headers=headers, json=payload) 21response.raise_for_status() 22 23print(response.text) 24

Read project

Retrieve details of a specific project.

To find the UUID of your project, call the read projects endpoint.

1import os 2 3import requests 4 5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/projects/{os.getenv('PROJECT_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 { 3 "name": "Starter Project", 4 "description": "Manage your own projects. Download and upload projects.", 5 "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", 6 "parent_id": null 7 } 8] 9

Update project

Update the information of a specific project with a PATCH request.

Each PATCH request updates the project with the values you send. Only the fields you include in your request are updated. If you send the same values multiple times, the update is still processed, even if the values are unchanged.

1import os 2import uuid 3 4import requests 5 6base = os.environ.get("LANGFLOW_URL") or os.environ.get("LANGFLOW_SERVER_URL", "") 7project_id = os.environ.get("PROJECT_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-renamed-project-{uuid.uuid4().hex[:8]}", 14 "description": "Updated via API docs Python example", 15} 16 17response = requests.patch(f"{base}/api/v1/projects/{project_id}", headers=headers, json=payload, timeout=30) 18response.raise_for_status() 19print(response.text) 20
Result
1{ 2 "name": "string", 3 "description": "string", 4 "id": "b408ddb9-6266-4431-9be8-e04a62758331", 5 "parent_id": null 6} 7

Delete project

Delete a specific project.

1import os 2 3import requests 4 5base = os.environ.get("LANGFLOW_URL", "") 6api_key = os.environ.get("LANGFLOW_API_KEY", "") 7 8headers = {"accept": "*/*", "Content-Type": "application/json", "x-api-key": api_key} 9 10create = requests.post( 11 f"{base}/api/v1/projects/", 12 headers=headers, 13 json={ 14 "name": "docs-example-delete-me", 15 "description": "Temporary project", 16 "components_list": [], 17 "flows_list": [], 18 }, 19 timeout=30, 20) 21create.raise_for_status() 22project_id = create.json()["id"] 23 24delete = requests.delete(f"{base}/api/v1/projects/{project_id}", headers=headers, timeout=30) 25delete.raise_for_status() 26print(delete.text) 27
Result
1204 No Content 2

Export a project

Download all flows from a project as a zip file.

The --output flag is optional.

1import os 2 3import requests 4 5url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/projects/download/{os.getenv('PROJECT_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 15with open("langflow-project.zip", "wb") as f: 16 f.write(response.content) 17print("Saved response to langflow-project.zip") 18

Import a project

Import a project and its flows by uploading a Langflow project zip file:

1import os 2from pathlib import Path 3 4import requests 5 6base = os.environ.get("LANGFLOW_URL", "") 7api_key = os.environ.get("LANGFLOW_API_KEY", "") 8 9fixtures = Path(__file__).resolve().parents[2] / "fixtures" 10default_json = fixtures / "project-import.json" 11import_path = Path(os.environ.get("PROJECT_IMPORT_JSON", str(default_json))) 12 13headers = {"accept": "application/json", "x-api-key": api_key} 14 15files = {"file": (import_path.name, import_path.read_bytes(), "application/json")} 16response = requests.post(f"{base}/api/v1/projects/upload/", headers=headers, files=files, timeout=60) 17 18response.raise_for_status() 19print(response.text) 20
Search