Files
langflow/docs/versioned_docs/version-1.9.0/API-Reference/api-files.mdx
Antônio Alexandre Borges Lima 415323ec6d docs: migrate code blocks to native Prism and restyle API reference pages (#13299)
* docs: migrate code blocks from CodeSnippet to native Prism

Replace the custom CodeSnippet component (@code-hike/lighter) with
Docusaurus's native @theme/CodeBlock across all MDX files (current and
versioned docs). Add bash to additionalLanguages and swizzle
prism-include-languages.js to add custom token highlighting for shell
commands and flags. Remove @code-hike/mdx dependency.

* docs: improve inline code styling

Darken inline code background, increase horizontal padding to 0.4em,
fix vertical alignment, and remove border in light mode.

* docs: address PR review — fix code slice regression and CSS/regex polish

- Inline RecursiveCharacterTextSplitter inputs and methods as literal
  code blocks in concepts-components.mdx (current + 1.8.0 + 1.9.0),
  restoring the focused slices lost when migrating from CodeSnippet
- Scope bash-plain Prism regex to unambiguous CLI subcommands only,
  removing generic bash builtins (run, add, get, set, start, stop, etc.)
- Merge duplicate .theme-code-block CSS rules into a single declaration

* fix(docs): prevent horizontal scroll on API docs pages

The Redoc two-column layout (sidebar 300px + api-content 1300px)
totals 1600px, expanding .main-wrapper beyond narrower viewports
because it has overflow:visible. Clips at .main-wrapper using the
html.plugin-redoc class that Docusaurus adds on API pages only.

* fix(docs): API docs sidebar and layout fixes

- Disable Redoc built-in search (disableSearch: true)
- Pin sidebar top to navbar height (top: 60px) so it never hides behind navbar
- Remove hardcoded #111 background from dark mode sidebar

* fix(docs): render markdown correctly in API docs descriptions

The _clean_descriptions function was converting newlines to <br> tags,
mixing HTML with Markdown. CommonMark stops parsing Markdown headings
(###) inside HTML blocks, causing them to appear as literal text in Redoc.

Replace the <br> conversion with a simple strip() so descriptions remain
pure Markdown and Redoc renders headings, lists, and code blocks correctly.

* feat(docs): align API docs colors with Langflow brand

- Set primaryColor to #F471B5 (Langflow pink)
- Add HTTP method badge colors matching Langflow palette
- Set schema.linesColor and requireLabelColor to brand pink
- Set inline code color to pink, headers to #e3e3e3
- Set sidebar background to #18181b (matches frontend dark bg)
- Set rightPanel background to #0d0d0f, codeBlock to #161618
- Refactor: move color config from CSS to theme.theme where safe
- Remove dead search input CSS (search disabled via disableSearch:true)
- Consolidate duplicate .menu-content rules

* wip(docs): API docs styling — colors, components, light/dark themes

* fix(docs): fix Response samples h3 title padding and refactor HTTP method button CSS

* feat(docs): add sidebar dark background, active item styles, and right panel color adjustments

* fix(docs): add sidebar borders and remove operation divider border

* fix(docs): fix expanded response background and align dark/light theme colors

* refactor(docs): standardize selectors, comments and remove duplicate rules in redocusaurus.css

* refactor(docs): apply PR review — CSS custom properties, version pin, dom version comments, fix overflow

* fix(docs): fix Redocly badge visibility covered by sidebar background

* fix(docs): extend sidebar border-right to Redocly badge area

* refactor(docs): replace hardcoded #ffffff label color with --redoc-text-label variable

* fix(docs): lighten inline code background in API docs dark theme

Redoc's default typography.code.backgroundColor (rgba(38, 50, 56, 0.05))
is nearly invisible over the dark background. Override it with
rgba(255, 255, 255, 0.05) in dark theme only, excluding pre > code so
code sample blocks stay unaffected.

* feat(docs): align docs primary pink with API spec brand color

Use #f471b5 (API spec primaryColor) as --ifm-color-primary in dark theme
and #e44fa0 (slightly darkened for contrast on white) in light theme.
Remove dark-theme pink overrides in sidebar.css (#ff6ad0 CTA and
hsla(329, 55%, 68%) active TOC link) — they compensated for the old
muted pink and are redundant now that the primary itself is bright.

* feat(docs): lighten dark theme text colors for better readability

Bump body text (#a8a8b0 -> #bcbcc4), headings (#cdcdd4 -> #dcdce2)
and sidebar menu (#8a8a92 -> #9c9ca4) one step brighter.

* chore(docs): add IBM Equal Access accessibility-checker setup

Add accessibility-checker as devDependency with aceconfig.js (policy
IBM_Accessibility, JSON reports in docs/a11y-results/, gitignored).
Scan with: npx achecker <url> against a built docs site.

* fix(docs): WCAG AA contrast and ARIA fixes across docs and API reference

Validated with IBM Equal Access scans (light theme): home, quickstart and
component pages at 0 violations; /api from 3382 down to 167 (all remaining
are Redoc-internal DOM: schema table headers, svg/select labels).

Docs site:
- Light primary pink #d11074 — passes 4.5:1 on white and inline-code bg
- Light Prism palette darkened per-token to pass 4.5:1 on #f9f9fd
- TabItem swizzled to give tabpanels an accessible name (aria-label)
- codeBlockA11y client module: scrollable code blocks get role=region +
  unique label; non-scrollable ones lose the needless tabindex

API reference (Redocusaurus):
- redocA11y client module: role=main on api-content, role=navigation on
  sidebar — fixes 1924 aria_content_in_landmark violations
- HTTP method badges and response chips darkened to pass with white text
- Light-theme overrides: accessible pink #cd1072 for links, required
  markers, constraint chips, schema tree lines; darker grays for utility
  buttons and type labels (incl. 0.7-opacity wrapper fix)
- Sidebar active/hover items use regular text color, method badges keep
  their own colors; expandable property names match non-expandable ones

* fix(docs): WCAG AA contrast fixes for dark theme

Validated with IBM Equal Access scans in dark mode (temporary
colorMode.defaultMode flip during scanning): home, quickstart and
component pages at 0 violations; /api matches light at 167 remaining
(all Redoc-internal DOM: table headers, svg/select labels).

- Code block comments/line numbers #4a5060 -> #798197 (4.56:1 on #18181a)
- Redoc dark sample tokens: boolean/null #e95c59, number #5392b8
- Status-code tabs: lift docusaurus-theme-redoc's #303846 !important
  selected-tab rule with a higher-specificity override
- oneOf variant buttons: dark text in both themes (their white/pink
  backgrounds are theme-independent)
- redocA11y client module: patch response chip colors (success green /
  error red) to dark-accessible variants when data-theme=dark — a single
  Redoc theme color cannot pass on both light and dark derived
  backgrounds, and status is only distinguishable by computed color

* fix(docs): resolve remaining Redoc-internal accessibility violations

Extend the redocA11y client module with semantic patches for Redoc DOM
the theme cannot reach (validated: 0 IBM Equal Access violations on all
scanned pages in both light and dark themes):

- Decorative svg chevrons/arrows: aria-hidden=true (svg_graphics_labelled)
- Content-type dropdowns: aria-label (input_label_exists)
- Schema field tables (2-col name|description layout, no <th> anywhere):
  role=presentation — content reads in DOM order; role=rowheader on <td>
  is invalid ARIA inside a native table (table_headers_exists/related)
- Semantic patches run on the next animation frame after DOM changes so
  Redoc's lazy-rendered operations are covered immediately; the heavier
  color patch stays debounced

* ci(docs): gate docs accessibility with IBM Equal Access scans

Add test-docs-accessibility job to docs_test.yml (rides the existing
docs/** path filter from ci.yml): build + scan 4 representative pages
(home, quickstart, component page, /api) in light theme, then flip
colorMode.defaultMode to dark, rebuild and scan again.

- scripts/a11y-ci.sh: serves the build and runs npx achecker per page
  with one retry to absorb Redoc lazy-render timing flakes; any real
  violation fails the job (failLevels: violation)
- aceconfig.js: pin ruleArchive to 19May2026 so IBM rule updates don't
  break CI without a deliberate bump

* ci(docs): fix Chrome sandbox launch on Ubuntu 24.04 runners

Ubuntu 24.04 restricts unprivileged user namespaces via AppArmor, which
prevents puppeteer's Chrome (used by the IBM checker) from starting its
sandbox. Re-enable them with the documented sysctl workaround instead of
weakening the browser with --no-sandbox.

* fix(docs): align response status code with description text

Redoc sets vertical-align: top and a smaller line-height on the status
code <strong> inside response buttons, leaving "200" visually higher
than "Successful Response". Align both to the shared text baseline.

* refactor(docs): apply PR review feedback

- redocA11y: match only real Redoc routes (/api, /api/workflow) — a bare
  startsWith("/api") also matched docs pages like /api-request and
  leaked one body MutationObserver per navigation
- codeBlockA11y: also observe the hidden attribute — Docusaurus tabs
  toggle panels via hidden (no childList mutation), so scrollable blocks
  inside an initially hidden tab were never re-evaluated for tabindex
- Extract Prism themes to src/prismThemes.js (docusaurus.config.js was
  past the 600-line red flag)
- concepts-components.mdx (current + 1.9.0 + 1.8.0): comment pointing
  hardcoded snippets to recursive_character.py to mitigate drift

Validated: clean build + IBM Equal Access scans 4/4 passing.

* replace-openapi-file-with-1.10

* migrate-prism-changes-to-1.10-version

* a11y-script-dont-block

---------

Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
2026-06-12 13:58:04 +00:00

577 lines
22 KiB
Plaintext

---
title: Files endpoints
slug: /api-files
---
import CodeBlock from '@theme/CodeBlock';
import exampleApiFilesUploadFileV1 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/upload-file-v1.sh';
import resultApiFilesResultUploadFileV1 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-upload-file-v1.json';
import exampleApiFilesUploadImageFilesV1 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/upload-image-files-v1.sh';
import exampleApiFilesUploadImageFilesV12 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/upload-image-files-v1-2.sh';
import exampleApiFilesListFilesV1 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/list-files-v1.sh';
import resultApiFilesResultListFilesV1 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-list-files-v1.json';
import exampleApiFilesDownloadFileV1 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/download-file-v1.sh';
import resultApiFilesResultDownloadFileV1 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-download-file-v1.txt';
import exampleApiFilesDeleteFileV1 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/delete-file-v1.sh';
import resultApiFilesResultDeleteFileV1 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-delete-file-v1.json';
import exampleApiFilesUploadFileV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/upload-file-v2.sh';
import resultApiFilesResultUploadFileV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-upload-file-v2.txt';
import exampleApiFilesUploadFileV22 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/upload-file-v2-2.sh';
import exampleApiFilesSendFilesToYourFlowsV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/send-files-to-your-flows-v2.sh';
import exampleApiFilesSendFilesToYourFlowsV22 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/send-files-to-your-flows-v2-2.sh';
import exampleApiFilesListFilesV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/list-files-v2.sh';
import resultApiFilesResultListFilesV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-list-files-v2.json';
import exampleApiFilesDownloadFileV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/download-file-v2.sh';
import resultApiFilesResultDownloadFileV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-download-file-v2.txt';
import exampleApiFilesEditFileNameV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/edit-file-name-v2.sh';
import resultApiFilesResultEditFileNameV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-edit-file-name-v2.json';
import exampleApiFilesDeleteFileV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/delete-file-v2.sh';
import resultApiFilesResultDeleteFileV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-delete-file-v2.json';
import exampleApiFilesDeleteAllFilesV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/delete-all-files-v2.sh';
import resultApiFilesResultDeleteAllFilesV2 from '!!raw-loader!@site/docs/API-Reference/curl-examples/api-files/result-delete-all-files-v2.json';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import examplePythonApiFilesUploadFileV1 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/upload-file-v1.py';
import exampleJavascriptApiFilesUploadFileV1 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/upload-file-v1.js';
import examplePythonApiFilesUploadImageFilesV1 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/upload-image-files-v1.py';
import exampleJavascriptApiFilesUploadImageFilesV1 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/upload-image-files-v1.js';
import examplePythonApiFilesUploadImageFilesV12 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/upload-image-files-v1-2.py';
import exampleJavascriptApiFilesUploadImageFilesV12 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/upload-image-files-v1-2.js';
import examplePythonApiFilesListFilesV1 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/list-files-v1.py';
import exampleJavascriptApiFilesListFilesV1 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/list-files-v1.js';
import examplePythonApiFilesDownloadFileV1 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/download-file-v1.py';
import exampleJavascriptApiFilesDownloadFileV1 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/download-file-v1.js';
import examplePythonApiFilesDeleteFileV1 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/delete-file-v1.py';
import exampleJavascriptApiFilesDeleteFileV1 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/delete-file-v1.js';
import examplePythonApiFilesUploadFileV2 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/upload-file-v2.py';
import exampleJavascriptApiFilesUploadFileV2 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/upload-file-v2.js';
import examplePythonApiFilesUploadFileV22 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/upload-file-v2-2.py';
import exampleJavascriptApiFilesUploadFileV22 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/upload-file-v2-2.js';
import examplePythonApiFilesSendFilesToYourFlowsV2 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/send-files-to-your-flows-v2.py';
import exampleJavascriptApiFilesSendFilesToYourFlowsV2 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/send-files-to-your-flows-v2.js';
import examplePythonApiFilesSendFilesToYourFlowsV22 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/send-files-to-your-flows-v2-2.py';
import exampleJavascriptApiFilesSendFilesToYourFlowsV22 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/send-files-to-your-flows-v2-2.js';
import examplePythonApiFilesListFilesV2 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/list-files-v2.py';
import exampleJavascriptApiFilesListFilesV2 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/list-files-v2.js';
import examplePythonApiFilesDownloadFileV2 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/download-file-v2.py';
import exampleJavascriptApiFilesDownloadFileV2 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/download-file-v2.js';
import examplePythonApiFilesEditFileNameV2 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/edit-file-name-v2.py';
import exampleJavascriptApiFilesEditFileNameV2 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/edit-file-name-v2.js';
import examplePythonApiFilesDeleteFileV2 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/delete-file-v2.py';
import exampleJavascriptApiFilesDeleteFileV2 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/delete-file-v2.js';
import examplePythonApiFilesDeleteAllFilesV2 from '!!raw-loader!@site/docs/API-Reference/python-examples/api-files/delete-all-files-v2.py';
import exampleJavascriptApiFilesDeleteAllFilesV2 from '!!raw-loader!@site/docs/API-Reference/javascript-examples/api-files/delete-all-files-v2.js';
Use the `/files` endpoints to move files between your local machine and Langflow.
All `/files` endpoints (both `/v1/files` and `/v2/files`) require authentication with a Langflow API key.
You can only access files that belong to your own user account, even as a superuser.
## 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)](#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.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesUploadFileV1}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesUploadFileV1}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesUploadFileV1}</CodeBlock>
</TabItem>
</Tabs>
Replace `FILE_NAME.txt` with the name and extension of the file you want to upload.
Not all file types are supported.
<details>
<summary>Result</summary>
<CodeBlock language="json">{resultApiFilesResultUploadFileV1}</CodeBlock>
</details>
### Upload image files (v1)
Send image files to Langflow to use them in flows.
The default file limit is 1024 MB.
To change this limit, set the `LANGFLOW_MAX_FILE_SIZE_UPLOAD` [environment variable](/environment-variables).
1. Attach the image to a `POST /v1/files/upload/$FLOW_ID` request with `--form` (`-F`) and the file path:
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesUploadImageFilesV1}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesUploadImageFilesV1}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesUploadImageFilesV1}</CodeBlock>
</TabItem>
</Tabs>
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:
```json
{
"flowId": "a430cc57-06bb-4c11-be39-d3d4de68d2c4",
"file_path": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png"
}
```
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`.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesUploadImageFilesV12}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesUploadImageFilesV12}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesUploadImageFilesV12}</CodeBlock>
</TabItem>
</Tabs>
:::tip
For help with tweaks, use the **Input Schema** in a flow's [**API access** pane](/concepts-publish#api-access).
Setting tweaks with **Input Schema** also automatically populates the required component IDs.
:::
### List files (v1)
List all files associated with a specific flow.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesListFilesV1}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesListFilesV1}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesListFilesV1}</CodeBlock>
</TabItem>
</Tabs>
<details>
<summary>Result</summary>
<CodeBlock language="json">{resultApiFilesResultListFilesV1}</CodeBlock>
</details>
### Download file (v1)
Download a specific file from a flow.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesDownloadFileV1}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesDownloadFileV1}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesDownloadFileV1}</CodeBlock>
</TabItem>
</Tabs>
<details>
<summary>Result</summary>
<CodeBlock language="text">{resultApiFilesResultDownloadFileV1}</CodeBlock>
</details>
### Delete file (v1)
Delete a specific file from a flow.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesDeleteFileV1}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesDeleteFileV1}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesDeleteFileV1}</CodeBlock>
</TabItem>
</Tabs>
<details>
<summary>Result</summary>
<CodeBlock language="json">{resultApiFilesResultDeleteFileV1}</CodeBlock>
</details>
## 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](/api-reference-api-examples).
### 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:
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesUploadFileV2}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesUploadFileV2}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesUploadFileV2}</CodeBlock>
</TabItem>
</Tabs>
<details>
<summary>Result</summary>
<CodeBlock language="text">{resultApiFilesResultUploadFileV2}</CodeBlock>
</details>
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`.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesUploadFileV22}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesUploadFileV22}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesUploadFileV22}</CodeBlock>
</TabItem>
</Tabs>
The file is uploaded in the format `USER_ID/FILE_ID.FILE_EXTENSION`, and the API returns metadata about the uploaded file:
```json
{
"id":"d44dc2e1-9ae9-4cf6-9114-8d34a6126c94",
"name":"engine_manual",
"path":"07e5b864-e367-4f52-b647-a48035ae7e5e/d44dc2e1-9ae9-4cf6-9114-8d34a6126c94.pdf",
"size":851160,
"provider":null
}
```
### Send files to your flows (v2)
:::info
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)](#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 [**Read File** component](/read-file).
The default file limit is 1024 MB. To configure this value, change the `LANGFLOW_MAX_FILE_SIZE_UPLOAD` [environment variable](/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.EXTENSION** with the name and extension of the file you want to upload.
This is the same step described in [Upload file (v2)](#upload-file-v2), but since you need the filename to upload to your flow, it is included here.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesSendFilesToYourFlowsV2}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesSendFilesToYourFlowsV2}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesSendFilesToYourFlowsV2}</CodeBlock>
</TabItem>
</Tabs>
The file is uploaded in the format `USER_ID/FILE_ID.FILE_EXTENSION`, and the API returns metadata about the uploaded file:
```json
{
"id":"d44dc2e1-9ae9-4cf6-9114-8d34a6126c94",
"name":"engine_manual",
"path":"07e5b864-e367-4f52-b647-a48035ae7e5e/d44dc2e1-9ae9-4cf6-9114-8d34a6126c94.pdf",
"size":851160,
"provider": null
}
```
2. To use this file in your flow, add a **Read 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 `Read-File` component in the `tweaks` object:
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesSendFilesToYourFlowsV22}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesSendFilesToYourFlowsV22}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesSendFilesToYourFlowsV22}</CodeBlock>
</TabItem>
</Tabs>
To get the `Read-File` component's ID, call the [Read flow](/api-flows#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.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesListFilesV2}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesListFilesV2}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesListFilesV2}</CodeBlock>
</TabItem>
</Tabs>
<details>
<summary>Result</summary>
<CodeBlock language="json">{resultApiFilesResultListFilesV2}</CodeBlock>
</details>
### 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.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesDownloadFileV2}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesDownloadFileV2}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesDownloadFileV2}</CodeBlock>
</TabItem>
</Tabs>
<details>
<summary>Result</summary>
<CodeBlock language="text">{resultApiFilesResultDownloadFileV2}</CodeBlock>
</details>
### Edit file name (v2)
Change a file name.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesEditFileNameV2}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesEditFileNameV2}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesEditFileNameV2}</CodeBlock>
</TabItem>
</Tabs>
<details>
<summary>Result</summary>
<CodeBlock language="json">{resultApiFilesResultEditFileNameV2}</CodeBlock>
</details>
### Delete file (v2)
Delete a specific file by its ID.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesDeleteFileV2}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesDeleteFileV2}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesDeleteFileV2}</CodeBlock>
</TabItem>
</Tabs>
<details>
<summary>Result</summary>
<CodeBlock language="json">{resultApiFilesResultDeleteFileV2}</CodeBlock>
</details>
### Delete all files (v2)
Delete all files associated with your user account.
<Tabs>
<TabItem value="Python" label="Python" default>
<CodeBlock language="python">{examplePythonApiFilesDeleteAllFilesV2}</CodeBlock>
</TabItem>
<TabItem value="JavaScript" label="JavaScript">
<CodeBlock language="javascript">{exampleJavascriptApiFilesDeleteAllFilesV2}</CodeBlock>
</TabItem>
<TabItem value="curl" label="curl">
<CodeBlock language="bash">{exampleApiFilesDeleteAllFilesV2}</CodeBlock>
</TabItem>
</Tabs>
<details>
<summary>Result</summary>
<CodeBlock language="json">{resultApiFilesResultDeleteAllFilesV2}</CodeBlock>
</details>
## Create upload file (Deprecated)
This endpoint is deprecated. Use the `/files` endpoints instead.
## See also
* [Manage files](/concepts-file-management)