Skip to main content

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 by user_id instead of flow_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.


_10
curl -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"

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.

  1. 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.

_10
curl -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
}

  1. 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.

_12
curl -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.


_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \
_10
-H "accept: application/json"

Download file (v1)

Download a specific file from a flow.


_10
curl -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

Delete file (v1)

Delete a specific file from a flow.


_10
curl -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"

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.


_10
curl -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.


_10
curl -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)

important

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.

  1. 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.

_10
curl -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
}

  1. To use this file in your flow, add a File component to load a file into the flow.
  2. 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.

_15
curl --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.


_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v2/files" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

Download file (v2)

Download a specific file by its ID and file extension.

tip

You must specify the file type you expect in the --output value.


_10
curl -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

Edit file name (v2)

Change a file name.


_10
curl -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"

Delete file (v2)

Delete a specific file by its ID.


_10
curl -X DELETE \
_10
"$LANGFLOW_URL/api/v2/files/$FILE_ID" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

Delete all files (v2)

Delete all files associated with your user account.


_10
curl -X DELETE \
_10
"$LANGFLOW_URL/api/v2/files" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

Create upload file (Deprecated)

This endpoint is deprecated. Use the /files endpoints instead.

Search