From e41ebc1cebca326e11541c97841e3940c419d0ce Mon Sep 17 00:00:00 2001
From: "github-merge-queue[bot]"
stream to
| Parameter | Type | Description |
|---|---|---|
| inputs | object | Optional. Input values for flow components. |
| data | object | Optional. Flow data to override stored configuration. |
| files | array[string] | Optional. List of file paths to use. |
| stop_component_id | string | Optional. ID of the component where the execution should stop. |
| start_component_id | string | Optional. ID of the component where the execution should start. |
| log_builds | boolean | Optional. Control build logging. Default: true. |
The /build endpoint accepts optional values for start_component_id and stop_component_id to control where the flow run will start and stop.
+
The /build endpoint accepts optional values for start_component_id and stop_component_id to control where the flow run starts and stops.
Setting stop_component_id for a component triggers the same behavior as clicking the Play button on that component, where all dependent components leading up to that component are also run.
For example, to stop flow execution at the Open AI model component, run the following command:
_10curl -X POST \_10 "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \_10 -H "accept: application/json" \_10 -H "Content-Type: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 -d '{"stop_component_id": "OpenAIModel-Uksag"}'
_14curl -X POST \_14 "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \_14 -H "accept: application/json" \_14 -H "Content-Type: application/json" \_14 -d '{_14 "data": {_14 "nodes": [],_14 "edges": []_14 },_14 "inputs": {_14 "input_value": "Your custom input here",_14 "session": "session_id"_14 }_14 }'
_10{"job_id":"0bcc7f23-40b4-4bfa-9b8a-a44181fd1175"}
Use the /files endpoint to add or delete files between your local machine and Langflow.
Upload a file to an existing flow.
-This example uploads the_oscar_award.csv.
_10curl -X POST \_10 "$LANGFLOW_URL/api/v1/files/upload/$FLOW_ID" \_10 -H "accept: application/json" \_10 -H "Content-Type: multipart/form-data" \_10 -F "file=@the_oscar_award.csv"
_10{_10 "flowId": "92f9a4c5-cfc8-4656-ae63-1f0881163c28",_10 "file_path": "92f9a4c5-cfc8-4656-ae63-1f0881163c28/2024-12-30_15-19-43_the_oscar_award.csv"_10}
There are /v1 and /v2 versions of the /files endpoints.
+The v2/files version offers several improvements over /v1:
v1, files are organized by flow_id. In v2, files are organized by user_id.
+This means files are accessed based on user ownership, and not tied to specific flows.
+You can upload a file to Langflow one time, and use it with multiple flows.v2, files are tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one./v2 endpoint contain more descriptive metadata.v2 endpoints require authentication by an API key or JWT.Use the /files endpoint to add or delete files between your local machine and Langflow.
v1, files are organized by flow_id.v2, files are organized by user_id and tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one.Upload a file to the v1/files/upload/<YOUR-FLOW-ID> endpoint of your flow.
+Replace FILE_NAME with the uploaded file name.
_10curl -X POST \_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{_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}
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.
For more information, see Supported environment variables.
v1/files/upload/<YOUR-FLOW-ID> endpoint of your flow.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=@image-file.png"
_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"
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","file_path":"a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png"}
_12curl -X POST \_12 "$LANGFLOW_URL/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false" \_12 -H 'Content-Type: application/json'\_12 -d '{_12 "output_type": "chat",_12 "input_type": "chat",_12 "tweaks": {_12 "ChatInput-b67sL": {_12 "files": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png",_12 "input_value": "what do you see?"_12 }_12}}'
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.
-
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \_10 -H "accept: application/json"
_10{_10 "files": [_10 "2024-12-30_15-19-43_the_oscar_award.csv"_10 ]_10}
Download a specific file for a given flow.
-To look up the file name in Langflow, use the /list endpoint.
This example downloads the 2024-12-30_15-19-43_the_oscar_award.csv file from Langflow to a file named output-file.csv.
The --output flag is optional.
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/files/download/$FLOW_ID/2024-12-30_15-19-43_the_oscar_award.csv" \_10 -H "accept: application/json" \_10 --output output-file.csv
_10The file contents.
Download an image file for a given flow.
-To look up the file name in Langflow, use the /list endpoint.
This example downloads the 2024-12-30_15-42-44_image-file.png file from Langflow to a file named output-image.png.
The --output flag is optional.
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/files/images/$FLOW_ID/2024-12-30_15-42-44_image-file.png" \_10 -H "accept: application/json" \_10 --output output-image.png
_10Image file content.
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \_10 -H "accept: application/json"
_10{_10 "files": [_10 "2024-12-30_15-19-43_your_file.txt"_10 ]_10}
Download a specific file from a flow.
+
_10curl -X GET \_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
Delete a specific file from a flow.
-This example deletes the 2024-12-30_15-42-44_image-file.png file from Langflow.
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v1/files/delete/$FLOW_ID/2024-12-30_15-42-44_image-file.png" \_10 -H "accept: application/json"
_10{_10 "message": "File 2024-12-30_15-42-44_image-file.png deleted successfully"_10}
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v1/files/delete/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \_10 -H "accept: application/json"
_10{_10 "message": "File 2024-12-30_15-19-43_your_file.txt deleted successfully"_10}
In v2, files are organized by user_id and tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one.
+The v2 endpoints require authentication by an API key or JWT.
+To create a Langflow API key and export it as an environment variable, see Export values.
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 6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt.
+Replace FILE_NAME.EXTENSION with the uploaded file name and its extension.
_10curl -X POST \_10 "$LANGFLOW_URL/api/v2/files" \_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.EXTENSION"
_10{_10 "id": "c7b22c4c-d5e0-4ec9-af97-5d85b7657a34",_10 "name": "FILE_NAME.EXTENSION",_10 "path": "6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt",_10 "size": 1234,_10 "provider": null_10}
Send a file to your flow for analysis using the File component.
+The default file limit is 100 MB. To configure this value, change the LANGFLOW_MAX_FILE_SIZE_UPLOAD environment variable.
+For more information, see Supported environment variables.
/api/v2/files endpoint.
+Replace FILE_NAME with the uploaded file name.
_10curl -X POST "$LANGFLOW_URL/api/v2/files" \_10 -H "Content-Type: multipart/form-data" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 -F "file=@FILE_NAME.png"
The file is uploaded in the format USER_ID/FILE_ID.FILE_EXTENSION, and the API returns metadata about the uploaded file:
_10{_10 "id": "5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e",_10 "name": "FILE_NAME",_10 "path": "232f54ba-dd54-4760-977e-ed637f83e785/5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e.png",_10 "size": 84408,_10 "provider": null_10}
_16curl --request POST \_16 --url '$LANGFLOW_URL/api/v1/run/$FLOW_ID' \_16 --header 'Content-Type: application/json' \_16 --header 'x-api-key: $LANGFLOW_API_KEY' \_16 --data '{_16 "input_value": "what do you see?",_16 "output_type": "chat",_16 "input_type": "text",_16 "tweaks": {_16 "File-t2Ngc": {_16 "path": [_16 "232f54ba-dd54-4760-977e-ed637f83e785/5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e.png"_16 ]_16 }_16 }_16}'
List all files associated with your user account.
+
_10curl -X GET \_10 "$LANGFLOW_URL/api/v2/files" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10[_10 {_10 "id": "c7b22c4c-d5e0-4ec9-af97-5d85b7657a34",_10 "name": "your_file",_10 "path": "6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt",_10 "size": 1234,_10 "provider": null_10 }_10]
Download a specific file by its ID and file extension.
+You must specify the file type you expect in the --output value.
_10curl -X GET \_10 "$LANGFLOW_URL/api/v2/files/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34" \_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
Change a file name.
+
_10curl -X PUT \_10 "$LANGFLOW_URL/api/v2/files/$FILE_ID?name=new_file_name" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10{_10 "id":"76543e40-f388-4cb3-b0ee-a1e870aca3d3",_10 "name":"new_file_name",_10 "path":"6f17a73e-97d7-4519-a8d9-8e4c0be411bb/76543e40-f388-4cb3-b0ee-a1e870aca3d3.png",_10 "size":2728251,_10 "provider":null_10 }
Delete a specific file by its ID.
+
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v2/files/$FILE_ID" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10{_10 "message": "File deleted successfully"_10}
Delete all files associated with your user account.
+
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v2/files" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10{_10 "message": "All files deleted successfully"_10}
Use the /flows endpoint to create, read, update, and delete flows.
folder_id must already exist before uploading a flow. Ca
Retrieve details of a specific folder.
To find the UUID of your folder, call the read folders endpoint.
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/folders/$FOLDER_ID" \_10 -H "accept: application/json"
_10[_10 {_10 "name": "My Projects",_10 "description": "Manage your own projects. Download and upload folders.",_10 "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",_10 "parent_id": null_10 }_10]