@@ -58,7 +58,7 @@ To send image files to your flows through the API, use Upload file (v1)
Upload a file to the v1/files/upload/<YOUR-FLOW-ID> endpoint of your flow.
Replace FILE_NAME with the uploaded file name.
-
_10 "$LANGFLOW_URL/api/v1/files/upload/$FLOW_ID" \
_10 -H "accept: application/json" \
_10 -H "Content-Type: multipart/form-data" \
_10 -F "file=@FILE_NAME.txt"
_10 "flowId": "92f9a4c5-cfc8-4656-ae63-1f0881163c28",
_10 "file_path": "92f9a4c5-cfc8-4656-ae63-1f0881163c28/2024-12-30_15-19-43_your_file.txt"
+
_10 "$LANGFLOW_URL/api/v1/files/upload/$FLOW_ID" \
_10 -H "accept: application/json" \
_10 -H "Content-Type: multipart/form-data" \
_10 -H "x-api-key: $LANGFLOW_API_KEY" \
_10 -F "file=@FILE_NAME.txt"
_10 "flowId": "92f9a4c5-cfc8-4656-ae63-1f0881163c28",
_10 "file_path": "92f9a4c5-cfc8-4656-ae63-1f0881163c28/2024-12-30_15-19-43_your_file.txt"
Send image files to the Langflow API for AI analysis.
The default file limit is 100 MB. To configure this value, change the LANGFLOW_MAX_FILE_SIZE_UPLOAD environment variable.
@@ -67,7 +67,7 @@ For more information, see S
To send an image to your flow with the API, POST the image file to the v1/files/upload/<YOUR-FLOW-ID> endpoint of your flow.
Replace FILE_NAME with the uploaded file name.
-
_10curl -X POST "$LANGFLOW_URL/api/v1/files/upload/a430cc57-06bb-4c11-be39-d3d4de68d2c4" \
_10 -H "Content-Type: multipart/form-data" \
_10 -F "file=@FILE_NAME.png"
+
_10curl -X POST "$LANGFLOW_URL/api/v1/files/upload/a430cc57-06bb-4c11-be39-d3d4de68d2c4" \
_10 -H "Content-Type: multipart/form-data" \
_10 -H "x-api-key: $LANGFLOW_API_KEY" \
_10 -F "file=@FILE_NAME.png"
The API returns the image file path in the format "file_path":"<YOUR-FLOW-ID>/<TIMESTAMP>_<FILE-NAME>"}.
_10 "flowId": "a430cc57-06bb-4c11-be39-d3d4de68d2c4",
_10 "file_path": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png"
@@ -75,18 +75,18 @@ Replace FILE_NAME with the uploaded file name.
Pass the file path value as an input in the Tweaks section of the curl call to Langflow.
Component id values can be found in Langflow JSON files.
-
_12 "$LANGFLOW_URL/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false" \
_12 -H 'Content-Type: application/json'\
_12 "output_type": "chat",
_12 "input_type": "chat",
_12 "files": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png",
_12 "input_value": "what do you see?"
+
_13 "$LANGFLOW_URL/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false" \
_13 -H 'Content-Type: application/json' \
_13 -H "x-api-key: $LANGFLOW_API_KEY" \
_13 "output_type": "chat",
_13 "input_type": "chat",
_13 "files": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png",
_13 "input_value": "what do you see?"
Your chatbot describes the image file you sent.
_10"text": "This flowchart appears to represent a complex system for processing financial inquiries using various AI agents and tools. Here's a breakdown of its components and how they might work together..."
List all files associated with a specific flow.
-
_10 "$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \
_10 -H "accept: application/json"
_10 "files": ["2024-12-30_15-19-43_your_file.txt"]
+
_10 "$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \
_10 -H "accept: application/json" \
_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10 "files": ["2024-12-30_15-19-43_your_file.txt"]
Download a specific file from a flow.
-
_10 "$LANGFLOW_URL/api/v1/files/download/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \
_10 -H "accept: application/json" \
_10 --output downloaded_file.txt
_10File contents downloaded to downloaded_file.txt
+
_10 "$LANGFLOW_URL/api/v1/files/download/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \
_10 -H "accept: application/json" \
_10 -H "x-api-key: $LANGFLOW_API_KEY" \
_10 --output downloaded_file.txt
_10File contents downloaded to downloaded_file.txt
Delete a specific file from a flow.
-
_10 "$LANGFLOW_URL/api/v1/files/delete/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \
_10 -H "accept: application/json"
_10 "message": "File 2024-12-30_15-19-43_your_file.txt deleted successfully"
+
_10 "$LANGFLOW_URL/api/v1/files/delete/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \
_10 -H "accept: application/json" \
_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10 "message": "File 2024-12-30_15-19-43_your_file.txt deleted successfully"
Use the /files endpoints to move files between your local machine and Langflow.
The v2 endpoints require authentication by an API key or JWT.
@@ -95,7 +95,7 @@ To create a Langflow API key and export it as an environment variable, see Upload a file to your user account. The file can be used across multiple flows.
The file is uploaded in the format USER_ID/FILE_ID.FILE_EXTENSION, such as 07e5b864-e367-4f52-b647-a48035ae7e5e/d44dc2e1-9ae9-4cf6-9114-8d34a6126c94.pdf.
To retrieve your current user_id, call the /whoami endpoint.
-
_10 "$LANGFLOW_URL/api/v1/users/whoami" \
_10 -H "accept: application/json"
+
_10 "$LANGFLOW_URL/api/v1/users/whoami" \
_10 -H "accept: application/json" \
_10 -H "x-api-key: $LANGFLOW_API_KEY"
Result:
_10{"id":"07e5b864-e367-4f52-b647-a48035ae7e5e","username":"langflow","profile_image":null,"store_api_key":null,"is_active":true,"is_superuser":true,"create_at":"2025-05-08T17:59:07.855965","updated_at":"2025-05-28T19:00:42.556460","last_login_at":"2025-05-28T19:00:42.554338","optins":{"github_starred":false,"dialog_dismissed":true,"discord_clicked":false,"mcp_dialog_dismissed":true}}
In the POST request to v2/files, replace @FILE_NAME.EXTENSION with the uploaded file name and its extension.
@@ -124,7 +124,7 @@ This is the same step described in Upload file (v2)File component's full name with the UUID attached, call the Read flow endpoint, and then include your File component and the file path as a tweak with the /v1/run POST request.
In this example, the file uploaded to /v2/files is included with the /v1/run POST request.
-
_15 --url "$LANGFLOW_URL/api/v1/run/$FLOW_ID" \
_15 --header "Content-Type: application/json" \
_15 "input_value": "what do you see?",
_15 "output_type": "chat",
_15 "input_type": "text",
_15 "07e5b864-e367-4f52-b647-a48035ae7e5e/3a290013-fe1e-4d3d-a454-cacae81288f3.pdf"
+
_16 --url "$LANGFLOW_URL/api/v1/run/$FLOW_ID" \
_16 --header "Content-Type: application/json" \
_16 --header "x-api-key: $LANGFLOW_API_KEY" \
_16 "input_value": "what do you see?",
_16 "output_type": "chat",
_16 "input_type": "text",
_16 "07e5b864-e367-4f52-b647-a48035ae7e5e/3a290013-fe1e-4d3d-a454-cacae81288f3.pdf"
Result:
_10"text":"This document provides important safety information and instructions for selecting, installing, and operating Briggs & Stratton engines. It includes warnings and guidelines to prevent injury, fire, or damage, such as choosing the correct engine model, proper installation procedures, safe fuel handling, and correct engine operation. The document emphasizes following all safety precautions and using authorized parts to ensure safe and effective engine use."
diff --git a/api-flows-run.html b/api-flows-run.html
index 3a0fae5b72..e448837189 100644
--- a/api-flows-run.html
+++ b/api-flows-run.html
@@ -21,8 +21,8 @@
-
-
+
+
The following example runs a Basic Prompting flow with flow parameters passed in the request body.
This flow requires a chat input string (input_value), and uses default values for all other parameters.
-
_11 "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID" \
_11 -H "Content-Type: application/json" \
_11 "input_value": "Tell me about something interesting!",
_11 "session_id": "chat-123",
_11 "input_type": "chat",
_11 "output_type": "chat",
_11 "output_component": "",
+
_12 "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID" \
_12 -H "Content-Type: application/json" \
_12 -H "x-api-key: $LANGFLOW_API_KEY" \
_12 "input_value": "Tell me about something interesting!",
_12 "session_id": "chat-123",
_12 "input_type": "chat",
_12 "output_type": "chat",
_12 "output_component": "",
The response from /v1/run/$FLOW_ID includes metadata, inputs, and outputs for the run.
Result
The following example illustrates a response from a Basic Prompting flow:
_29 "session_id": "chat-123",
_29 "input_value": "Tell me about something interesting!"
_29 "text": "Sure! Have you ever heard of the phenomenon known as \"bioluminescence\"? It's a fascinating natural occurrence where living organisms produce and emit light. This ability is found in various species, including certain types of jellyfish, fireflies, and deep-sea creatures like anglerfish.\n\nBioluminescence occurs through a chemical reaction in which a light-emitting molecule called luciferin reacts with oxygen, catalyzed by an enzyme called luciferase. The result is a beautiful glow that can serve various purposes, such as attracting mates, deterring predators, or luring prey.\n\nOne of the most stunning displays of bioluminescence can be seen in the ocean, where certain plankton emit light when disturbed, creating a mesmerizing blue glow in the water. This phenomenon is often referred to as \"sea sparkle\" and can be seen in coastal areas around the world.\n\nBioluminescence not only captivates our imagination but also has practical applications in science and medicine, including the development of biosensors and imaging techniques. It's a remarkable example of nature's creativity and complexity!",
_29 "session_id": "chat-123",
_29 "timestamp": "2025-03-03T17:17:37+00:00",
_29 "flow_id": "d2bbd92b-187e-4c84-b2d4-5df365704201",
_29 "id": "OpenAIModel-d1wOZ",
_29 "display_name": "OpenAI",
_29 "source": "gpt-4o-mini"
_29 "component_id": "ChatOutput-ylMzN"
If you are parsing the response in an application, you most likely need to extract the relevant content from the response, rather than pass the entire response back to the user.
@@ -53,7 +53,7 @@ For an example of a script that extracts data from a Langflow API response, see
With /v1/run/$FLOW_ID, the flow is executed as a batch with optional LLM token response streaming.
To stream LLM token responses, append the ?stream=true query parameter to the request:
-
_10 "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \
_10 -H "accept: application/json" \
_10 -H "Content-Type: application/json" \
_10 "message": "Tell me something interesting!",
_10 "session_id": "chat-123"
+
_10 "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \
_10 -H "accept: application/json" \
_10 -H "Content-Type: application/json" \
_10 -H "x-api-key: $LANGFLOW_API_KEY" \
_10 "message": "Tell me something interesting!",
_10 "session_id": "chat-123"
LLM chat responses are streamed back as token events, culminating in a final end event that closes the connection.
Result
The following example is truncated to illustrate a series of token events as well as the final end event that closes the LLM's token streaming response:
_19{"event": "add_message", "data": {"timestamp": "2025-03-03T17:20:18", "sender": "User", "sender_name": "User", "session_id": "chat-123", "text": "Tell me about something interesting!", "files": [], "error": false, "edit": false, "properties": {"text_color": "", "background_color": "", "edited": false, "source": {"id": null, "display_name": null, "source": null}, "icon": "", "allow_markdown": false, "positive_feedback": null, "state": "complete", "targets": []}, "category": "message", "content_blocks": [], "id": "0103a21b-ebf7-4c02-9d72-017fb297f812", "flow_id": "d2bbd92b-187e-4c84-b2d4-5df365704201"}}
_19{"event": "add_message", "data": {"timestamp": "2025-03-03T17:20:18", "sender": "Machine", "sender_name": "AI", "session_id": "chat-123", "text": "", "files": [], "error": false, "edit": false, "properties": {"text_color": "", "background_color": "", "edited": false, "source": {"id": "OpenAIModel-d1wOZ", "display_name": "OpenAI", "source": "gpt-4o-mini"}, "icon": "OpenAI", "allow_markdown": false, "positive_feedback": null, "state": "complete", "targets": []}, "category": "message", "content_blocks": [], "id": "27b66789-e673-4c65-9e81-021752925161", "flow_id": "d2bbd92b-187e-4c84-b2d4-5df365704201"}}
_19{"event": "token", "data": {"chunk": " Have", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19{"event": "token", "data": {"chunk": " you", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19{"event": "token", "data": {"chunk": " ever", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19{"event": "token", "data": {"chunk": " heard", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19{"event": "token", "data": {"chunk": " of", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19{"event": "token", "data": {"chunk": " the", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19{"event": "token", "data": {"chunk": " phenomenon", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19{"event": "end", "data": {"result": {"session_id": "chat-123", "message": "Sure! Have you ever heard of the phenomenon known as \"bioluminescence\"?..."}}}
@@ -61,11 +61,11 @@ For an example of a script that extracts data from a Langflow API response, see
| Parameter | Type | Info |
|---|
| flow_id | UUID/string | Required. Part of URL: /run/$FLOW_ID |
| stream | boolean | Optional. Query parameter: /run/$FLOW_ID?stream=true |
| input_value | string | Optional. JSON body field. Main input text/prompt. Default: null |
| input_type | string | Optional. JSON body field. Input type ("chat" or "text"). Default: "chat" |
| output_type | string | Optional. JSON body field. Output type ("chat", "any", "debug"). Default: "chat" |
| output_component | string | Optional. JSON body field. Target component for output. Default: "" |
| tweaks | object | Optional. JSON body field. Component adjustments. Default: null |
| session_id | string | Optional. JSON body field. Conversation context ID. See Session ID. Default: null |
-
_17 "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \
_17 -H "Content-Type: application/json" \
_17 -H "accept: application/json" \
_17 -H "x-api-key: sk-..." \
_17 "input_value": "Tell me a story",
_17 "input_type": "chat",
_17 "output_type": "chat",
_17 "output_component": "chat_output",
_17 "session_id": "chat-123",
_17 "parameter_name": "value"
+
_17 "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \
_17 -H "Content-Type: application/json" \
_17 -H "accept: application/json" \
_17 -H "x-api-key: $LANGFLOW_API_KEY" \
_17 "input_value": "Tell me a story",
_17 "input_type": "chat",
_17 "output_type": "chat",
_17 "output_component": "chat_output",
_17 "session_id": "chat-123",
_17 "parameter_name": "value"
Use the /webhook endpoint to start a flow by sending an HTTP POST request.
After you add a Webhook component to a flow, open the API access pane, and then click the Webhook cURL tab to get an automatically generated POST /webhook request for your flow.
-
_10 "$LANGFLOW_SERVER_URL/api/v1/webhook/$FLOW_ID" \
_10 -H "Content-Type: application/json" \
_10 -d '{"data": "example-data"}'
+
_10 "$LANGFLOW_SERVER_URL/api/v1/webhook/$FLOW_ID" \
_10 -H "Content-Type: application/json" \
_10 -H "x-api-key: $LANGFLOW_API_KEY" \
_10 -d '{"data": "example-data"}'
Result
_10 "message": "Task started in the background",
_10 "status": "in progress"
For more information, see Webhook component and Trigger flows with webhooks.
diff --git a/api-flows.html b/api-flows.html
index bee87a3434..afce45109e 100644
--- a/api-flows.html
+++ b/api-flows.html
@@ -21,8 +21,8 @@
-
-
+
+