docs: build OpenAPI spec and cut version 1.10 (#13537)

* build-api

* bump-version-to-1.10

* fix-broken-links
This commit is contained in:
Mendon Kissling
2026-06-08 14:25:14 -04:00
committed by GitHub
parent 60afa18f05
commit 2411d8036e
528 changed files with 41198 additions and 94 deletions

View File

@ -0,0 +1,30 @@
import os
import requests
url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
}
payload = {
"name": "string2",
"description": "string",
"icon": "string",
"icon_bg_color": "#FF0000",
"gradient": "string",
"data": {},
"is_component": False,
"updated_at": "2024-12-30T15:48:01.519Z",
"webhook": False,
"endpoint_name": "string",
"tags": ["string"],
}
response = requests.request("POST", url, headers=headers, json=payload)
response.raise_for_status()
print(response.text)

View File

@ -0,0 +1,28 @@
import os
import uuid
import requests
base = os.environ.get("LANGFLOW_URL", "")
api_key = os.environ.get("LANGFLOW_API_KEY", "")
folder_id = (os.environ.get("PROJECT_ID") or os.environ.get("FOLDER_ID") or "").strip()
headers = {"accept": "application/json", "Content-Type": "application/json", "x-api-key": api_key}
def _flow_doc(suffix: str) -> dict:
doc = {
"name": f"batch-flow-{uuid.uuid4().hex[:8]}",
"description": f"Docs batch example {suffix}",
"data": {"nodes": [], "edges": []},
}
if folder_id:
doc["folder_id"] = folder_id
return doc
payload = {"flows": [_flow_doc("A"), _flow_doc("B")]}
response = requests.post(f"{base}/api/v1/flows/batch/", headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.text)

View File

@ -0,0 +1,25 @@
import os
import requests
base = os.environ.get("LANGFLOW_URL", "")
api_key = os.environ.get("LANGFLOW_API_KEY", "")
headers = {"accept": "application/json", "Content-Type": "application/json", "x-api-key": api_key}
create = requests.post(
f"{base}/api/v1/flows/",
headers=headers,
json={
"name": "docs-example-delete-me",
"description": "Temporary flow for delete-flow example",
"data": {"nodes": [], "edges": []},
},
timeout=30,
)
create.raise_for_status()
flow_id = create.json()["id"]
delete = requests.delete(f"{base}/api/v1/flows/{flow_id}", headers=headers, timeout=30)
delete.raise_for_status()
print(delete.text)

View File

@ -0,0 +1,40 @@
import os
import requests
base = os.environ.get("LANGFLOW_URL", "")
api_key = os.environ.get("LANGFLOW_API_KEY", "")
flow_id = os.environ.get("FLOW_ID", "")
folder_id = os.environ.get("PROJECT_ID") or os.environ.get("FOLDER_ID", "")
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"x-api-key": api_key,
}
# Export needs at least two flows to return a ZIP; a single id returns JSON.
extra = requests.post(
f"{base}/api/v1/flows/",
headers=headers,
json={
"name": "docs-export-temp-flow",
"description": "Temporary second flow for export example",
"data": {"nodes": [], "edges": []},
**({"folder_id": folder_id} if folder_id else {}),
},
timeout=30,
)
extra.raise_for_status()
extra_id = extra.json()["id"]
payload = [flow_id, extra_id]
response = requests.post(f"{base}/api/v1/flows/download/", headers=headers, json=payload, timeout=60)
response.raise_for_status()
with open("langflow-flows.zip", "wb") as f:
f.write(response.content)
print("Saved response to langflow-flows.zip")
requests.delete(f"{base}/api/v1/flows/{extra_id}", headers=headers, timeout=30)

View File

@ -0,0 +1,23 @@
import os
import requests
url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/upload/?folder_id={os.getenv('FOLDER_ID', '')}"
headers = {
"accept": "application/json",
"x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
}
files = {
"file": open(os.getenv("FLOW_IMPORT_FILE", "docs/docs/API-Reference/fixtures/flow-import.json"), "rb"),
}
response = requests.request("POST", url, headers=headers, files=files)
response.raise_for_status()
print(response.text)
for _f in files.values():
if hasattr(_f, "close"):
_f.close()

View File

@ -0,0 +1,15 @@
import os
import requests
url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/{os.getenv('FLOW_ID', '')}"
headers = {
"accept": "application/json",
"x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
}
response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.text)

View File

@ -0,0 +1,15 @@
import os
import requests
url = 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"
headers = {
"accept": "application/json",
"x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
}
response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.text)

View File

@ -0,0 +1,15 @@
import os
import requests
url = 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"
headers = {
"accept": "application/json",
"x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
}
response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.text)

View File

@ -0,0 +1,15 @@
import os
import requests
url = f"{os.getenv('LANGFLOW_URL', '')}/api/v1/flows/basic_examples/"
headers = {
"accept": "application/json",
"x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}",
}
response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.text)

View File

@ -0,0 +1,20 @@
import os
import uuid
import requests
base = os.environ.get("LANGFLOW_URL") or os.environ.get("LANGFLOW_SERVER_URL", "")
flow_id = os.environ.get("FLOW_ID", "")
api_key = os.environ.get("LANGFLOW_API_KEY", "")
headers = {"accept": "application/json", "Content-Type": "application/json", "x-api-key": api_key}
payload = {
"name": f"docs-example-updated-flow-{uuid.uuid4().hex[:8]}",
"description": "Updated via API docs Python example",
"locked": False,
}
response = requests.patch(f"{base}/api/v1/flows/{flow_id}", headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.text)