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.
- Python
- JavaScript
- curl
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
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/`;
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/projects/" \
3 -H "accept: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY"
5
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.
- Python
- JavaScript
- curl
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
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/`;
2
3const options = {
4 method: 'POST',
5 headers: {
6 "Content-Type": `application/json`,
7 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
8 },
9 body: JSON.stringify({
10 "name": "new_project_name",
11 "description": "string",
12 "components_list": [],
13 "flows_list": []
14}),
15};
16
17fetch(url, options)
18 .then(async (response) => {
19 if (!response.ok) {
20 throw new Error(`HTTP ${response.status}`);
21 }
22 const text = await response.text();
23 console.log(text);
24 })
25 .catch((error) => console.error(error));
26
1curl -X POST \
2 "$LANGFLOW_URL/api/v1/projects/" \
3 -H "Content-Type: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY" \
5 -d '{
6 "name": "new_project_name",
7 "description": "string",
8 "components_list": [],
9 "flows_list": []
10}'
11
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.
- Python
- JavaScript
- curl
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
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/`;
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": "new_project_name",
12 "description": "string",
13 "components_list": [
14 "3fa85f64-5717-4562-b3fc-2c963f66afa6"
15 ],
16 "flows_list": [
17 "3fa85f64-5717-4562-b3fc-2c963f66afa6"
18 ]
19}),
20};
21
22fetch(url, options)
23 .then(async (response) => {
24 if (!response.ok) {
25 throw new Error(`HTTP ${response.status}`);
26 }
27 const text = await response.text();
28 console.log(text);
29 })
30 .catch((error) => console.error(error));
31
1curl -X POST \
2 "$LANGFLOW_URL/api/v1/projects/" \
3 -H "accept: application/json" \
4 -H "Content-Type: application/json" \
5 -H "x-api-key: $LANGFLOW_API_KEY" \
6 -d '{
7 "name": "new_project_name",
8 "description": "string",
9 "components_list": [
10 "3fa85f64-5717-4562-b3fc-2c963f66afa6"
11 ],
12 "flows_list": [
13 "3fa85f64-5717-4562-b3fc-2c963f66afa6"
14 ]
15}'
16
Read project
Retrieve details of a specific project.
To find the UUID of your project, call the read projects endpoint.
- Python
- JavaScript
- curl
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
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/${process.env.PROJECT_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/projects/$PROJECT_ID" \
3 -H "accept: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY"
5
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.
- Python
- JavaScript
- curl
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
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/b408ddb9-6266-4431-9be8-e04a62758331`;
2
3const options = {
4 method: 'PATCH',
5 headers: {
6 "accept": `application/json`,
7 "x-api-key": `${process.env.LANGFLOW_API_KEY ?? ""}`,
8 },
9 body: JSON.stringify({
10 "name": "string",
11 "description": "string",
12 "parent_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
13 "components": [
14 "3fa85f64-5717-4562-b3fc-2c963f66afa6"
15 ],
16 "flows": [
17 "3fa85f64-5717-4562-b3fc-2c963f66afa6"
18 ]
19}),
20};
21
22fetch(url, options)
23 .then(async (response) => {
24 if (!response.ok) {
25 throw new Error(`HTTP ${response.status}`);
26 }
27 const text = await response.text();
28 console.log(text);
29 })
30 .catch((error) => console.error(error));
31
1curl -X PATCH \
2 "$LANGFLOW_URL/api/v1/projects/b408ddb9-6266-4431-9be8-e04a62758331" \
3 -H "accept: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY" \
5 -d '{
6 "name": "string",
7 "description": "string",
8 "parent_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
9 "components": [
10 "3fa85f64-5717-4562-b3fc-2c963f66afa6"
11 ],
12 "flows": [
13 "3fa85f64-5717-4562-b3fc-2c963f66afa6"
14 ]
15}'
16
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.
- 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": "*/*", "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
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/${process.env.PROJECT_ID ?? ""}`;
2
3const options = {
4 method: 'DELETE',
5 headers: {
6 "accept": `*/*`,
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/projects/$PROJECT_ID" \
3 -H "accept: */*" \
4 -H "x-api-key: $LANGFLOW_API_KEY"
5
Result
1204 No Content
2
Export a project
Download all flows from a project as a zip file.
The --output flag is optional.
- Python
- JavaScript
- curl
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
1const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/download/${process.env.PROJECT_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 data = await response.arrayBuffer();
17 console.log("Received binary response for langflow-project.zip", data.byteLength);
18 })
19 .catch((error) => console.error(error));
20
1curl -X GET \
2 "$LANGFLOW_URL/api/v1/projects/download/$PROJECT_ID" \
3 -H "accept: application/json" \
4 -H "x-api-key: $LANGFLOW_API_KEY" \
5 --output langflow-project.zip
6
Import a project
Import a project and its flows by uploading a Langflow project zip file:
- Python
- JavaScript
- curl
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
1const fs = require("fs");
2const path = require("path");
3
4const fixturesDir = path.join(__dirname, "../../fixtures");
5const defaultProjectZip = path.join(fixturesDir, "project-import.zip");
6const projectPath = process.env.PROJECT_IMPORT_FILE || defaultProjectZip;
7const projectBuf = fs.readFileSync(projectPath);
8const projectName = path.basename(projectPath);
9
10const url = `${process.env.LANGFLOW_URL ?? ""}/api/v1/projects/upload/`;
11
12const formData = new FormData();
13formData.append("file", new Blob([projectBuf], { type: "application/zip" }), projectName);
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_PROJECT_IMPORT_FILE="$SCRIPT_DIR/../../fixtures/project-import.json"
3PROJECT_IMPORT_FILE="${PROJECT_IMPORT_JSON:-${PROJECT_IMPORT_FILE:-$DEFAULT_PROJECT_IMPORT_FILE}}"
4
5curl -X POST \
6 "$LANGFLOW_URL/api/v1/projects/upload/" \
7 -H "accept: application/json" \
8 -H "Content-Type: multipart/form-data" \
9 -H "x-api-key: $LANGFLOW_API_KEY" \
10 -F "file=@${PROJECT_IMPORT_FILE};type=application/json"
11