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.

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/$FLOW_ID endpoint: 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
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
-F "file=@FILE_NAME.txt"

Replace FILE_NAME.txt with the name and extension of the file you want to upload. Not all file types are supported.

Result

_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 Langflow to use them in flows.

The default file limit is 100 MB. To change this limit, set the LANGFLOW_MAX_FILE_SIZE_UPLOAD environment variable.

  1. Attach the image to a POST /v1/files/upload/$FLOW_ID request with --form (-F) and the file path:


    _10
    curl -X POST "$LANGFLOW_URL/api/v1/files/upload/$FLOW_ID" \
    _10
    -H "Content-Type: multipart/form-data" \
    _10
    -H "x-api-key: $LANGFLOW_API_KEY" \
    _10
    -F "file=@PATH/TO/FILE.png"

    A successful request returns the file_path for the image in the Langflow file management system in the format FLOW_ID/TIMESTAMP_FILENAME.TYPE. For example:


    _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
    }

  2. Use the returned file_path to send the image file to other components that can accept file input. Where you specify the file path depends on the component type.

    The following example runs the Basic Prompting template flow, passing the image file and the query describe this image as input for the Chat Input component. In this case, the file path is specified in tweaks.


    _14
    curl -X POST \
    _14
    "$LANGFLOW_URL/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false" \
    _14
    -H "Content-Type: application/json" \
    _14
    -H "x-api-key: $LANGFLOW_API_KEY" \
    _14
    -d '{
    _14
    "output_type": "chat",
    _14
    "input_type": "chat",
    _14
    "tweaks": {
    _14
    "ChatInput-b67sL": {
    _14
    "files": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png",
    _14
    "input_value": "describe this image"
    _14
    }
    _14
    }
    _14
    }'

    tip

    For help with tweaks, use the Input Schema in a flow's API access pane. Setting tweaks with Input Schema also automatically populates the required component IDs.

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" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

Result

_10
{
_10
"files": ["2024-12-30_15-19-43_your_file.txt"]
_10
}

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
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
--output downloaded_file.txt

Result

_10
File contents downloaded to 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" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

Result

_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/files endpoints can be authenticated 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.

  1. 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" \
    _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}}

  2. 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 can't send image files to flows. To send image files to your flows through the API, see Upload image files (v1).

This endpoint uploads files to your Langflow server's file management system. To use an uploaded file in a flow, send the file path to a flow with a File component.

The default file limit is 100 MB. To configure this value, change the LANGFLOW_MAX_FILE_SIZE_UPLOAD environment variable.

  1. To send a file to your flow with the API, POST the file to the /api/v2/files endpoint.

    Replace FILE_NAME.EXTENSION with the name and extension of the file you want to upload. 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
    }

  2. To use this file in your flow, add a File component to your flow. This component loads files into flows from your local machine or Langflow file management.

  3. Run the flow, passing the path to the File component in the tweaks object:


    _16
    curl --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-1olS3": {
    _16
    "path": [
    _16
    "07e5b864-e367-4f52-b647-a48035ae7e5e/3a290013-fe1e-4d3d-a454-cacae81288f3.pdf"
    _16
    ]
    _16
    }
    _16
    }
    _16
    }'

    To get the File component's ID, call the Read flow endpoint or inspect the component in the visual editor.

    If the file path is valid, the flow runs successfully.

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"

Result

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


_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

Result

_10
File contents downloaded to 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"

Result

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


_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"

Result

_10
{
_10
"message": "File deleted successfully"
_10
}

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"

Result

_10
{
_10
"message": "All files deleted successfully"
_10
}

Create upload file (Deprecated)

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

Search