Files endpoints
Use the /files
endpoints to move files between your local machine and Langflow.
Differences between /v1/files
and /v2/files
There are two versions of the /files
endpoints.
/v2/files
offers the following improvements over /v1/files
:
/v2
files are organized byuser_id
instead offlow_id
. This means files are owned by users, and they aren't attached 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./v2
supports bulk upload and delete./v2
responses contain more descriptive metadata./v2
endpoints have more strict security, requiring authentication by an API key or JWT.
However, /v2/files
doesn't support image files.
To send image files to your flows through the API, use Upload image files (v1).
Files/V1 endpoints
Use the /files
endpoints to move files between your local machine and Langflow.
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.
- curl
- Result
_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}
Upload image files (v1)
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.
- 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"
The API returns the image file path in the format "file_path":"<YOUR-FLOW-ID>/<TIMESTAMP>_<FILE-NAME>"}
.
_10{_10 "flowId": "a430cc57-06bb-4c11-be39-d3d4de68d2c4",_10 "file_path": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png"_10}
- Post the image file to the Chat Input component of a Basic prompting flow.
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.
_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 files (v1)
List all files associated with a specific flow.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \_10 -H "accept: application/json"
_10{_10 "files": ["2024-12-30_15-19-43_your_file.txt"]_10}
Download file (v1)
Download a specific file from a flow.
- curl
- Result
_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 file (v1)
Delete a specific file from a flow.
- curl
- Result
_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}
Files/V2 endpoints
Use the /files
endpoints to move files between your local machine and Langflow.
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 Get started with the Langflow API.
Upload file (v2)
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.
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/users/whoami" \_10 -H "accept: application/json"
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.
You must include the ampersand (@
) in the request to instruct curl to upload the contents of the file, not the string FILE_NAME.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"
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":"d44dc2e1-9ae9-4cf6-9114-8d34a6126c94",_10 "name":"engine_manual",_10 "path":"07e5b864-e367-4f52-b647-a48035ae7e5e/d44dc2e1-9ae9-4cf6-9114-8d34a6126c94.pdf",_10 "size":851160,_10 "provider":null_10}
Send files to your flows (v2)
The /v2/files
endpoint does not support sending image files to flows.
To send image files to your flows through the API, follow the procedure in Upload image files (v1).
Send a file to your flow for analysis using the File component and the API. Your flow must contain a File component to receive the file.
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.
- To send a file to your flow with the API, POST the file to the
/api/v2/files
endpoint. Replace FILE_NAME with the uploaded file name. This is the same step described in Upload file (v2), but since you need the filename to upload to your flow, it is included here.
_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"
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":"d44dc2e1-9ae9-4cf6-9114-8d34a6126c94",_10 "name":"engine_manual",_10 "path":"07e5b864-e367-4f52-b647-a48035ae7e5e/d44dc2e1-9ae9-4cf6-9114-8d34a6126c94.pdf",_10 "size":851160,_10 "provider": null_10}
- To use this file in your flow, add a File component to load a file into the flow.
- To load the file into your flow, send it to the File component.
To retrieve the 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.
_15curl --request POST \_15 --url "$LANGFLOW_URL/api/v1/run/$FLOW_ID" \_15 --header "Content-Type: application/json" \_15 --data '{_15 "input_value": "what do you see?",_15 "output_type": "chat",_15 "input_type": "text",_15 "tweaks": {_15 "File-1olS3": {_15 "path": [_15 "07e5b864-e367-4f52-b647-a48035ae7e5e/3a290013-fe1e-4d3d-a454-cacae81288f3.pdf"_15 ]_15 }_15 }_15}'
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."
List files (v2)
List all files associated with your user account.
- curl
- Result
_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 file (v2)
Download a specific file by its ID and file extension.
You must specify the file type you expect in the --output
value.
- curl
- Result
_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
Edit file name (v2)
Change a file name.
- curl
- Result
_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 file (v2)
Delete a specific file by its ID.
- curl
- Result
_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 (v2)
Delete all files associated with your user account.
- curl
- Result
_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}
Create upload file (Deprecated)
This endpoint is deprecated. Use the /files
endpoints instead.