mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-25 03:52:19 +08:00
369 lines
303 KiB
HTML
369 lines
303 KiB
HTML
<!doctype html>
|
||
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-API-Reference/api-reference-api-examples" data-has-hydrated="false">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="generator" content="Docusaurus v3.7.0">
|
||
<title data-rh="true">API examples | Langflow Documentation</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://docs.langflow.org/api-reference-api-examples"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="API examples | Langflow Documentation"><meta data-rh="true" name="description" content="This page provides examples and practices for managing Langflow using the Langflow API."><meta data-rh="true" property="og:description" content="This page provides examples and practices for managing Langflow using the Langflow API."><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://docs.langflow.org/api-reference-api-examples"><link data-rh="true" rel="alternate" href="https://docs.langflow.org/api-reference-api-examples" hreflang="en"><link data-rh="true" rel="alternate" href="https://docs.langflow.org/api-reference-api-examples" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://UZK6BDPCVY-dsn.algolia.net" crossorigin="anonymous"><link rel="preconnect" href="https://www.google-analytics.com">
|
||
<link rel="preconnect" href="https://www.googletagmanager.com">
|
||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SLQFLQ3KPT"></script>
|
||
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-SLQFLQ3KPT",{})</script>
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="search" type="application/opensearchdescription+xml" title="Langflow Documentation" href="/opensearch.xml">
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@550;600&display=swap">
|
||
<script>!function(){window.semaphore=window.semaphore||[],window.ketch=function(){window.semaphore.push(arguments)};var e=document.createElement("script");e.type="text/javascript",e.src="https://global.ketchcdn.com/web/v3/config/datastax/langflow_org_web/boot.js",e.defer=e.async=!0,document.getElementsByTagName("head")[0].appendChild(e)}()</script>
|
||
<script defer="true">!function(){const e=e=>{if(window.gtag&&e.purposes&&"analytics"in e.purposes&&"targeted_advertising"in e.purposes){const n=!0===e.purposes.analytics?"granted":"denied",t=!0===e.purposes.targeted_advertising?"granted":"denied",a={analytics_storage:n,ad_personalization:t,ad_storage:t,ad_user_data:t};window.gtag("consent","update",a)}};window.ketch&&window.ketch("on","consent",e)}()</script><link rel="stylesheet" href="/assets/css/styles.cf9a4109.css">
|
||
<script src="/assets/js/runtime~main.2fa8f7a3.js" defer="defer"></script>
|
||
<script src="/assets/js/main.f80dfbdf.js" defer="defer"></script>
|
||
</head>
|
||
<body class="navigation-with-keyboard">
|
||
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();null!==e?t(e):window.matchMedia("(prefers-color-scheme: dark)").matches?t("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,t("light"))}(),function(){try{const c=new URLSearchParams(window.location.search).entries();for(var[t,e]of c)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><div id="__docusaurus"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top navbarHideable_m1mJ"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/langflow-logo-black.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/langflow-logo-white.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--dark_xIcU"></div></a></div><div class="navbar__items navbar__items--right"><a href="https://github.com/langflow-ai/langflow" target="_blank" class="navbar__item navbar__link header-github-link"></a><a href="https://twitter.com/langflow_ai" target="_blank" class="navbar__item navbar__link header-twitter-link"></a><a href="https://discord.gg/EqksyE2EX9" target="_blank" class="navbar__item navbar__link header-discord-link"></a><div class="toggle_vylO colorModeToggle_DEke"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite" aria-pressed="false"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="navbarSearchContainer_Bca1"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search (Command+K)"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><div class="docsWrapper_hBAB"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docRoot_UBD9"><aside class="theme-doc-sidebar-container docSidebarContainer_YfHR"><div class="sidebarViewport_aRkj"><div class="sidebar_njMd sidebarWithHideableNavbar_wUlq"><a tabindex="-1" class="sidebarLogo_isFc" href="/"><img src="/img/langflow-logo-black.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/langflow-logo-white.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--dark_xIcU"></a><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Welcome to Langflow</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/get-started-installation">Get started</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/starter-projects-basic-prompting">Starter projects</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/blog-writer">Sample flows</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/concepts-overview">Concepts</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/components-agents">Components</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/agents-overview">Agents</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/configuration-api-keys">Configuration</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/develop-overview">Develop</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/deployment-overview">Deployment</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" role="button" aria-expanded="true" href="/api">API reference</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/api">API documentation</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/api-reference-api-examples">API examples</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/integrations-apify">Integrations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/contributing-community">Contributing</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a href="https://github.com/langflow-ai/langflow/releases/latest" target="_blank" rel="noopener noreferrer" class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false">Changelog</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/luna-for-langflow">Support</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 sidebar-ad">
|
||
<a href="https://astra.datastax.com/signup?type=langflow" target="_blank" class="menu__link">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cloud"><path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/></svg>
|
||
<div class="sidebar-ad-text-container">
|
||
<span class="sidebar-ad-text">Use Langflow in the cloud</span>
|
||
<span class="sidebar-ad-text sidebar-ad-text-gradient">Sign up for DataStax Langflow</span>
|
||
</div>
|
||
</a>
|
||
</li></ul></nav></div></div></aside><main class="docMainContainer_TBSr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">API reference</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">API examples</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>API examples</h1></header><style>[data-ch-theme="github-dark"] { --ch-t-colorScheme: dark;--ch-t-foreground: #c9d1d9;--ch-t-background: #0d1117;--ch-t-lighter-inlineBackground: #0d1117e6;--ch-t-editor-background: #0d1117;--ch-t-editor-foreground: #c9d1d9;--ch-t-editor-lineHighlightBackground: #6e76811a;--ch-t-editor-rangeHighlightBackground: #ffffff0b;--ch-t-editor-infoForeground: #3794FF;--ch-t-editor-selectionBackground: #264F78;--ch-t-focusBorder: #1f6feb;--ch-t-tab-activeBackground: #0d1117;--ch-t-tab-activeForeground: #c9d1d9;--ch-t-tab-inactiveBackground: #010409;--ch-t-tab-inactiveForeground: #8b949e;--ch-t-tab-border: #30363d;--ch-t-tab-activeBorder: #0d1117;--ch-t-editorGroup-border: #30363d;--ch-t-editorGroupHeader-tabsBackground: #010409;--ch-t-editorLineNumber-foreground: #6e7681;--ch-t-input-background: #0d1117;--ch-t-input-foreground: #c9d1d9;--ch-t-input-border: #30363d;--ch-t-icon-foreground: #8b949e;--ch-t-sideBar-background: #010409;--ch-t-sideBar-foreground: #c9d1d9;--ch-t-sideBar-border: #30363d;--ch-t-list-activeSelectionBackground: #6e768166;--ch-t-list-activeSelectionForeground: #c9d1d9;--ch-t-list-hoverBackground: #6e76811a;--ch-t-list-hoverForeground: #c9d1d9; }</style>
|
||
<!-- -->
|
||
<p>This page provides examples and practices for managing Langflow using the Langflow API.</p>
|
||
<p>The Langflow API's OpenAPI spec can be viewed and tested at your Langflow deployment's <code>docs</code> endpoint.
|
||
For example, <code>http://127.0.0.1:7860/docs</code>.</p>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="export-values">Export values<a href="#export-values" class="hash-link" aria-label="Direct link to Export values" title="Direct link to Export values"></a></h2>
|
||
<p>You might find it helpful to set the following environment variables in your terminal.</p>
|
||
<p>The examples in this guide use environment variables for these values.</p>
|
||
<ul>
|
||
<li>Export your Langflow URL in your terminal.
|
||
Langflow starts by default at <code>http://127.0.0.1:7860</code>.</li>
|
||
</ul>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>export LANGFLOW_URL="http://127.0.0.1:7860"</span></div></div><br></code></div></div>
|
||
<ul>
|
||
<li>Export the <code>flow-id</code> in your terminal.
|
||
The <code>flow-id</code> is found in the <a href="/concepts-publish">Publish pane</a> or in the flow's URL.</li>
|
||
</ul>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>export FLOW_ID="359cd752-07ea-46f2-9d3b-a4407ef618da"</span></div></div><br></code></div></div>
|
||
<ul>
|
||
<li>Export the <code>project-id</code> in your terminal.
|
||
To find your project ID, call the Langflow <a href="#read-projects">/api/v1/projects/</a> endpoint for a list of projects.</li>
|
||
</ul>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/projects/" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/projects/" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>[</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> {</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "name": "My Projects",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "description": "Manage your own projects. Download and upload projects.",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "id": "1415de42-8f01-4f36-bf34-539f23e47466",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "parent_id": null</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>]</span></div></div><br></code></div></div></div></div></div>
|
||
<p>Export the <code>project-id</code> as an environment variable.
|
||
Export the <code>project-id</code> as an environment variable.</p>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>export project_ID="1415de42-8f01-4f36-bf34-539f23e47466"</span></div></div><br></code></div></div>
|
||
<ul>
|
||
<li>Export the Langflow API key as an environment variable.
|
||
To create a Langflow API key, run the following command in the Langflow CLI.</li>
|
||
</ul>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>langflow api-key</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>API Key Created Successfully:</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>sk-...</span></div></div><br></code></div></div></div></div></div>
|
||
<p>Export the generated API key as an environment variable.</p>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>export LANGFLOW_API_KEY="sk-..."</span></div></div><br></code></div></div>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="base">Base<a href="#base" class="hash-link" aria-label="Direct link to Base" title="Direct link to Base"></a></h2>
|
||
<p>Use the base Langflow API to run your flow and retrieve configuration information.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="get-all-components">Get all components<a href="#get-all-components" class="hash-link" aria-label="Direct link to Get all components" title="Direct link to Get all components"></a></h3>
|
||
<p>This operation returns a dictionary of all Langflow components.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/all" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>A dictionary of all Langflow components.</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="run-flow">Run flow<a href="#run-flow" class="hash-link" aria-label="Direct link to Run flow" title="Direct link to Run flow"></a></h3>
|
||
<p>Execute a specified flow by ID or name.
|
||
The flow is executed as a batch, but LLM responses can be streamed.</p>
|
||
<p>This example runs a <a href="/starter-projects-basic-prompting">Basic Prompting</a> flow with a given <code>flow_id</code> and passes a JSON object as the input value.</p>
|
||
<p>The parameters are passed in the request body. In this example, the values are the default values.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/run/$FLOW_ID" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> -d '{</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> "input_value": "Tell me about something interesting!",</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> "session_id": "chat-123",</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> "input_type": "chat",</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> "output_type": "chat",</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> "output_component": "",</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> "tweaks": null</span></div></div><div><span class="ch-code-line-number">_<!-- -->11</span><div style="display:inline-block;margin-left:16px"><span> }'</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "session_id": "chat-123",</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "outputs": [{</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "inputs": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "input_value": "Tell me about something interesting!"</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> },</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "outputs": [{</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "results": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "message": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "text": "Sure! Have you ever heard of the phenomenon known as \"bioluminescence\"? It's a fascinating natural occurrence where living organisms produce and emit light. This ability is found in various species, including certain types of jellyfish, fireflies, and deep-sea creatures like anglerfish.\n\nBioluminescence occurs through a chemical reaction in which a light-emitting molecule called luciferin reacts with oxygen, catalyzed by an enzyme called luciferase. The result is a beautiful glow that can serve various purposes, such as attracting mates, deterring predators, or luring prey.\n\nOne of the most stunning displays of bioluminescence can be seen in the ocean, where certain plankton emit light when disturbed, creating a mesmerizing blue glow in the water. This phenomenon is often referred to as \"sea sparkle\" and can be seen in coastal areas around the world.\n\nBioluminescence not only captivates our imagination but also has practical applications in science and medicine, including the development of biosensors and imaging techniques. It's a remarkable example of nature's creativity and complexity!",</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "sender": "Machine",</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "sender_name": "AI",</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "session_id": "chat-123",</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "timestamp": "2025-03-03T17:17:37+00:00",</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "flow_id": "d2bbd92b-187e-4c84-b2d4-5df365704201",</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "properties": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "source": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "id": "OpenAIModel-d1wOZ",</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "display_name": "OpenAI",</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "source": "gpt-4o-mini"</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> },</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "icon": "OpenAI"</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> },</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> "component_id": "ChatOutput-ylMzN"</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> }]</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span> }]</span></div></div><div><span class="ch-code-line-number">_<!-- -->29</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<p>To stream LLM token responses, append the <code>?stream=true</code> query parameter to the request. LLM chat responses are streamed back as <code>token</code> events until the <code>end</code> event closes the connection.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/run/$FLOW_ID?stream=true" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -d '{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "message": "Tell me something interesting!",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "session_id": "chat-123"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> }'</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "add_message", "data": {"timestamp": "2025-03-03T17:20:18", "sender": "User", "sender_name": "User", "session_id": "chat-123", "text": "Tell me about something interesting!", "files": [], "error": false, "edit": false, "properties": {"text_color": "", "background_color": "", "edited": false, "source": {"id": null, "display_name": null, "source": null}, "icon": "", "allow_markdown": false, "positive_feedback": null, "state": "complete", "targets": []}, "category": "message", "content_blocks": [], "id": "0103a21b-ebf7-4c02-9d72-017fb297f812", "flow_id": "d2bbd92b-187e-4c84-b2d4-5df365704201"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "add_message", "data": {"timestamp": "2025-03-03T17:20:18", "sender": "Machine", "sender_name": "AI", "session_id": "chat-123", "text": "", "files": [], "error": false, "edit": false, "properties": {"text_color": "", "background_color": "", "edited": false, "source": {"id": "OpenAIModel-d1wOZ", "display_name": "OpenAI", "source": "gpt-4o-mini"}, "icon": "OpenAI", "allow_markdown": false, "positive_feedback": null, "state": "complete", "targets": []}, "category": "message", "content_blocks": [], "id": "27b66789-e673-4c65-9e81-021752925161", "flow_id": "d2bbd92b-187e-4c84-b2d4-5df365704201"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "token", "data": {"chunk": " Have", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "token", "data": {"chunk": " you", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "token", "data": {"chunk": " ever", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "token", "data": {"chunk": " heard", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "token", "data": {"chunk": " of", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "token", "data": {"chunk": " the", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "token", "data": {"chunk": " phenomenon", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>{"event": "end", "data": {"result": {"session_id": "chat-123", "message": "Sure! Have you ever heard of the phenomenon known as \"bioluminescence\"?..."}}}</span></div></div><br></code></div></div></div></div></div>
|
||
<p>This result is abbreviated, but illustrates where the <code>end</code> event completes the LLM's token streaming response.</p>
|
||
<h4 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="run-endpoint-headers-and-parameters">Run endpoint headers and parameters<a href="#run-endpoint-headers-and-parameters" class="hash-link" aria-label="Direct link to Run endpoint headers and parameters" title="Direct link to Run endpoint headers and parameters"></a></h4>
|
||
<p>Parameters can be passed to the <code>/run</code> endpoint in three ways:</p>
|
||
<ul>
|
||
<li>URL path: <code>flow_id</code> as part of the endpoint path</li>
|
||
<li>Query string: <code>stream</code> parameter in the URL</li>
|
||
<li>Request body: JSON object containing the remaining parameters</li>
|
||
</ul>
|
||
<p><strong>Headers</strong></p>
|
||
<table><thead><tr><th>Header</th><th>Info</th><th>Example</th></tr></thead><tbody><tr><td>Content-Type</td><td>Required. Specifies the JSON format.</td><td>"application/json"</td></tr><tr><td>accept</td><td>Required. Specifies the response format.</td><td>"application/json"</td></tr><tr><td>x-api-key</td><td>Optional. Required only if authentication is enabled.</td><td>"sk-..."</td></tr></tbody></table>
|
||
<p><strong>Parameters</strong></p>
|
||
<table><thead><tr><th>Parameter</th><th>Type</th><th>Info</th></tr></thead><tbody><tr><td>flow_id</td><td>UUID/string</td><td>Required. Part of URL: <code>/run/{flow_id}</code></td></tr><tr><td>stream</td><td>boolean</td><td>Optional. Query parameter: <code>/run/{flow_id}?stream=true</code></td></tr><tr><td>input_value</td><td>string</td><td>Optional. JSON body field. Main input text/prompt. Default: <code>null</code></td></tr><tr><td>input_type</td><td>string</td><td>Optional. JSON body field. Input type ("chat" or "text"). Default: <code>"chat"</code></td></tr><tr><td>output_type</td><td>string</td><td>Optional. JSON body field. Output type ("chat", "any", "debug"). Default: <code>"chat"</code></td></tr><tr><td>output_component</td><td>string</td><td>Optional. JSON body field. Target component for output. Default: <code>""</code></td></tr><tr><td>tweaks</td><td>object</td><td>Optional. JSON body field. Component adjustments. Default: <code>null</code></td></tr><tr><td>session_id</td><td>string</td><td>Optional. JSON body field. Conversation context ID. Default: <code>null</code></td></tr></tbody></table>
|
||
<p><strong>Example request</strong></p>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "http://$LANGFLOW_URL/api/v1/run/$FLOW_ID?stream=true" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> -H "x-api-key: sk-..." \</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> -d '{</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "input_value": "Tell me a story",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "input_type": "chat",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "output_type": "chat",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "output_component": "chat_output",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "session_id": "chat-123",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "tweaks": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "component_id": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "parameter_name": "value"</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> }'</span></div></div><br></code></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="webhook-run-flow">Webhook run flow<a href="#webhook-run-flow" class="hash-link" aria-label="Direct link to Webhook run flow" title="Direct link to Webhook run flow"></a></h3>
|
||
<p>The webhook endpoint triggers flow execution with an HTTP POST request.</p>
|
||
<p>When a <strong>Webhook</strong> component is added to the workspace, a new <strong>Webhook cURL</strong> tab becomes available in the <strong>API</strong> pane that contains an HTTP POST request for triggering the webhook component, similar to the call in this example.</p>
|
||
<p>To test the <strong>Webhook</strong> component in your flow, see the <a href="/components-data#webhook">Webhook component</a>.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/webhook/$FLOW_ID" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -d '{"data": "example-data"}'</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> {"message":"Task started in the background","status":"in progress"}</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="process">Process<a href="#process" class="hash-link" aria-label="Direct link to Process" title="Direct link to Process"></a></h3>
|
||
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>info</div><div class="admonitionContent_BuS1"><p>This endpoint is deprecated. Use the <code>/run</code> endpoint instead.</p></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="predict">Predict<a href="#predict" class="hash-link" aria-label="Direct link to Predict" title="Direct link to Predict"></a></h3>
|
||
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>info</div><div class="admonitionContent_BuS1"><p>This endpoint is deprecated. Use the <code>/run</code> endpoint instead.</p></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="get-task-status">Get task status<a href="#get-task-status" class="hash-link" aria-label="Direct link to Get task status" title="Direct link to Get task status"></a></h3>
|
||
<p>Get the status of a task.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/task/TASK_ID" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "status": "Task status",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "result": "Task result if completed"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="create-upload-file-deprecated">Create upload file (Deprecated)<a href="#create-upload-file-deprecated" class="hash-link" aria-label="Direct link to Create upload file (Deprecated)" title="Direct link to Create upload file (Deprecated)"></a></h3>
|
||
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>info</div><div class="admonitionContent_BuS1"><p>This endpoint is deprecated. Use the <code>/file</code> endpoint instead.</p></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="get-version">Get version<a href="#get-version" class="hash-link" aria-label="Direct link to Get version" title="Direct link to Get version"></a></h3>
|
||
<p>Get the version of the Langflow API.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/version" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "version": "1.1.1",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "main_version": "1.1.1",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "package": "Langflow"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="get-config">Get config<a href="#get-config" class="hash-link" aria-label="Direct link to Get config" title="Direct link to Get config"></a></h3>
|
||
<p>Retrieve the Langflow configuration information.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/config" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "feature_flags": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "mvp_components": false</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> },</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "frontend_timeout": 0,</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "auto_saving": true,</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "auto_saving_interval": 1000,</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "health_check_max_retries": 5,</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "max_file_size_upload": 100</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="build">Build<a href="#build" class="hash-link" aria-label="Direct link to Build" title="Direct link to Build"></a></h2>
|
||
<p>Use the <code>/build</code> endpoint to build vertices and flows, and execute those flows with streaming event responses.</p>
|
||
<p>The <code>/build</code> endpoint offers additional configuration for running flows.</p>
|
||
<p>For a simpler execution of your flows, use the <a href="/api-reference-api-examples#run-flow"><code>/run</code> endpoint</a> instead.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="build-flow">Build flow<a href="#build-flow" class="hash-link" aria-label="Direct link to Build flow" title="Direct link to Build flow"></a></h3>
|
||
<div class="theme-admonition theme-admonition-important admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>important</div><div class="admonitionContent_BuS1"><p>This endpoint is meant to be used by the frontend and is not optimized for external use.
|
||
To run your flow, use the <a href="/api-reference-api-examples#run-flow"><code>/run</code> endpoint</a> instead.</p></div></div>
|
||
<p>This endpoint builds and executes a flow, returning a job ID that can be used to stream execution events.</p>
|
||
<ol>
|
||
<li>Send a POST request to the <code>/build/{flow_id}/flow</code> endpoint.</li>
|
||
</ol>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -d '{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "inputs": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "input_value": "Tell me a story"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> }'</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "job_id": "123e4567-e89b-12d3-a456-426614174000"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<ol start="2">
|
||
<li>After receiving a job ID from the build endpoint, use the <code>/build/{job_id}/events</code> endpoint to stream the execution results:</li>
|
||
</ol>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{"event": "vertices_sorted", "data": {"ids": ["ChatInput-XtBLx"], "to_run": ["Prompt-x74Ze", "ChatOutput-ylMzN", "ChatInput-XtBLx", "OpenAIModel-d1wOZ"]}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{"event": "add_message", "data": {"timestamp": "2025-03-03T17:42:23", "sender": "User", "sender_name": "User", "session_id": "d2bbd92b-187e-4c84-b2d4-5df365704201", "text": "Tell me a story", "files": [], "error": false, "edit": false, "properties": {"text_color": "", "background_color": "", "edited": false, "source": {"id": null, "display_name": null, "source": null}, "icon": "", "allow_markdown": false, "positive_feedback": null, "state": "complete", "targets": []}, "category": "message", "content_blocks": [], "id": "28879bd8-6a68-4dd5-b658-74d643a4dd92", "flow_id": "d2bbd92b-187e-4c84-b2d4-5df365704201"}}</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>// ... Additional events as the flow executes ...</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span></span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{"event": "end", "data": {}}</span></div></div><br></code></div></div></div></div></div>
|
||
<p>The events endpoint accepts an optional <code>stream</code> query parameter which defaults to <code>true</code>.
|
||
To disable streaming and get all events at once, set <code>stream</code> to <code>false</code>.</p>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events?stream=false" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="build-endpoint-headers-and-parameters">Build endpoint headers and parameters<a href="#build-endpoint-headers-and-parameters" class="hash-link" aria-label="Direct link to Build endpoint headers and parameters" title="Direct link to Build endpoint headers and parameters"></a></h3>
|
||
<p><strong>Headers</strong></p>
|
||
<table><thead><tr><th>Header</th><th>Info</th><th>Example</th></tr></thead><tbody><tr><td>Content-Type</td><td>Required. Specifies the JSON format.</td><td>"application/json"</td></tr><tr><td>accept</td><td>Required. Specifies the response format.</td><td>"application/json"</td></tr><tr><td>x-api-key</td><td>Optional. Required only if authentication is enabled.</td><td>"sk-..."</td></tr></tbody></table>
|
||
<p>The <code>/build/{flow_id}/flow</code> endpoint accepts the following parameters in its request body:</p>
|
||
<p><strong>Parameters</strong></p>
|
||
<table><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>inputs</td><td>object</td><td>Optional. Input values for flow components.</td></tr><tr><td>data</td><td>object</td><td>Optional. Flow data to override stored configuration.</td></tr><tr><td>files</td><td>array[string]</td><td>Optional. List of file paths to use.</td></tr><tr><td>stop_component_id</td><td>string</td><td>Optional. ID of the component where the execution should stop.</td></tr><tr><td>start_component_id</td><td>string</td><td>Optional. ID of the component where the execution should start.</td></tr><tr><td>log_builds</td><td>boolean</td><td>Optional. Control build logging. Default: <code>true</code>.</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="configure-the-build-endpoint">Configure the build endpoint<a href="#configure-the-build-endpoint" class="hash-link" aria-label="Direct link to Configure the build endpoint" title="Direct link to Configure the build endpoint"></a></h3>
|
||
<p>The <code>/build</code> endpoint accepts optional values for <code>start_component_id</code> and <code>stop_component_id</code> to control where the flow run starts and stops.
|
||
Setting <code>stop_component_id</code> for a component triggers the same behavior as clicking the <strong>Play</strong> 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:</p>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "x-api-key: $LANGFLOW_API_KEY" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -d '{"stop_component_id": "OpenAIModel-Uksag"}'</span></div></div><br></code></div></div>
|
||
<p>The <code>/build</code> endpoint also accepts inputs for <code>data</code> directly, instead of using the values stored in the Langflow database.
|
||
This is useful for running flows without having to pass custom values through the UI.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> -d '{</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> "data": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> "nodes": [],</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> "edges": []</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> },</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> "inputs": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> "input_value": "Your custom input here",</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> "session": "session_id"</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->14</span><div style="display:inline-block;margin-left:16px"><span> }'</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{ "job_id": "0bcc7f23-40b4-4bfa-9b8a-a44181fd1175" }</span></div></div><br></code></div></div></div></div></div>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="files">Files<a href="#files" class="hash-link" aria-label="Direct link to Files" title="Direct link to Files"></a></h2>
|
||
<p>Use the <code>/files</code> endpoint to add or delete files between your local machine and Langflow.</p>
|
||
<p>There are <code>/v1</code> and <code>/v2</code> versions of the <code>/files</code> endpoints.
|
||
The <code>v2/files</code> version offers several improvements over <code>/v1</code>:</p>
|
||
<ul>
|
||
<li>In <code>v1</code>, files are organized by <code>flow_id</code>. In <code>v2</code>, files are organized by <code>user_id</code>.
|
||
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.</li>
|
||
<li>In <code>v2</code>, files are tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one.</li>
|
||
<li>Responses from the <code>/v2</code> endpoint contain more descriptive metadata.</li>
|
||
<li>The <code>v2</code> endpoints require authentication by an API key or JWT.</li>
|
||
</ul>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="filesv1-endpoints">Files/V1 endpoints<a href="#filesv1-endpoints" class="hash-link" aria-label="Direct link to Files/V1 endpoints" title="Direct link to Files/V1 endpoints"></a></h2>
|
||
<p>Use the <code>/files</code> endpoint to add or delete files between your local machine and Langflow.</p>
|
||
<ul>
|
||
<li>In <code>v1</code>, files are organized by <code>flow_id</code>.</li>
|
||
<li>In <code>v2</code>, files are organized by <code>user_id</code> and tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one.</li>
|
||
</ul>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="upload-file-v1">Upload file (v1)<a href="#upload-file-v1" class="hash-link" aria-label="Direct link to Upload file (v1)" title="Direct link to Upload file (v1)"></a></h3>
|
||
<p>Upload a file to the <code>v1/files/upload/<YOUR-FLOW-ID></code> endpoint of your flow.
|
||
Replace <strong>FILE_NAME</strong> with the uploaded file name.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/files/upload/$FLOW_ID" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: multipart/form-data" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -F "file=@FILE_NAME.txt"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "flowId": "92f9a4c5-cfc8-4656-ae63-1f0881163c28",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "file_path": "92f9a4c5-cfc8-4656-ae63-1f0881163c28/2024-12-30_15-19-43_your_file.txt"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="upload-image-files-v1">Upload image files (v1)<a href="#upload-image-files-v1" class="hash-link" aria-label="Direct link to Upload image files (v1)" title="Direct link to Upload image files (v1)"></a></h3>
|
||
<p>Send image files to the Langflow API for AI analysis.</p>
|
||
<p>The default file limit is 100 MB. To configure this value, change the <code>LANGFLOW_MAX_FILE_SIZE_UPLOAD</code> environment variable.
|
||
For more information, see <a href="/environment-variables#supported-variables">Supported environment variables</a>.</p>
|
||
<ol>
|
||
<li>To send an image to your flow with the API, POST the image file to the <code>v1/files/upload/<YOUR-FLOW-ID></code> endpoint of your flow.
|
||
Replace <strong>FILE_NAME</strong> with the uploaded file name.</li>
|
||
</ol>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST "$LANGFLOW_URL/api/v1/files/upload/a430cc57-06bb-4c11-be39-d3d4de68d2c4" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: multipart/form-data" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -F "file=@FILE_NAME.png"</span></div></div><br></code></div></div>
|
||
<p>The API returns the image file path in the format <code>"file_path":"<YOUR-FLOW-ID>/<TIMESTAMP>_<FILE-NAME>"}</code>.</p>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "flowId": "a430cc57-06bb-4c11-be39-d3d4de68d2c4",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "file_path": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div>
|
||
<ol start="2">
|
||
<li>Post the image file to the <strong>Chat Input</strong> component of a <strong>Basic prompting</strong> flow.
|
||
Pass the file path value as an input in the <strong>Tweaks</strong> section of the curl call to Langflow.
|
||
To find your Chat input component's ID, use the <a href="#"></a></li>
|
||
</ol>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> -H 'Content-Type: application/json'\</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> -d '{</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "output_type": "chat",</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "input_type": "chat",</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "tweaks": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "ChatInput-b67sL": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "files": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png",</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "input_value": "what do you see?"</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span>}}'</span></div></div><br></code></div></div>
|
||
<p>Your chatbot describes the image file you sent.</p>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>"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..."</span></div></div><br></code></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="list-files-v1">List files (v1)<a href="#list-files-v1" class="hash-link" aria-label="Direct link to List files (v1)" title="Direct link to List files (v1)"></a></h3>
|
||
<p>List all files associated with a specific flow.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "files": ["2024-12-30_15-19-43_your_file.txt"]</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="download-file-v1">Download file (v1)<a href="#download-file-v1" class="hash-link" aria-label="Direct link to Download file (v1)" title="Direct link to Download file (v1)"></a></h3>
|
||
<p>Download a specific file from a flow.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/files/download/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> --output downloaded_file.txt</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>File contents downloaded to downloaded_file.txt</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="delete-file-v1">Delete file (v1)<a href="#delete-file-v1" class="hash-link" aria-label="Direct link to Delete file (v1)" title="Direct link to Delete file (v1)"></a></h3>
|
||
<p>Delete a specific file from a flow.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X DELETE \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/files/delete/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "message": "File 2024-12-30_15-19-43_your_file.txt deleted successfully"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="filesv2-endpoints">Files/V2 endpoints<a href="#filesv2-endpoints" class="hash-link" aria-label="Direct link to Files/V2 endpoints" title="Direct link to Files/V2 endpoints"></a></h2>
|
||
<p>In <code>v2</code>, files are organized by <code>user_id</code> and tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one.
|
||
The <code>v2</code> endpoints require authentication by an API key or JWT.
|
||
To create a Langflow API key and export it as an environment variable, see <a href="#export-values">Export values</a>.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="upload-file-v2">Upload file (v2)<a href="#upload-file-v2" class="hash-link" aria-label="Direct link to Upload file (v2)" title="Direct link to Upload file (v2)"></a></h3>
|
||
<p>Upload a file to your user account. The file can be used across multiple flows.</p>
|
||
<p>The file is uploaded in the format <code>USER_ID/FILE_ID.FILE_EXTENSION</code>, such as <code>6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt</code>.
|
||
Replace <strong>FILE_NAME.EXTENSION</strong> with the uploaded file name and its extension.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v2/files" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: multipart/form-data" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "x-api-key: $LANGFLOW_API_KEY" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -F "file=@FILE_NAME.EXTENSION"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "id": "c7b22c4c-d5e0-4ec9-af97-5d85b7657a34",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "name": "FILE_NAME.EXTENSION",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "path": "6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "size": 1234,</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "provider": null</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="send-files-to-your-flows-v2">Send files to your flows (v2)<a href="#send-files-to-your-flows-v2" class="hash-link" aria-label="Direct link to Send files to your flows (v2)" title="Direct link to Send files to your flows (v2)"></a></h3>
|
||
<p>Send a file to your flow for analysis using the <a href="/components-data#file">File</a> component.</p>
|
||
<p>The default file limit is 100 MB. To configure this value, change the <code>LANGFLOW_MAX_FILE_SIZE_UPLOAD</code> environment variable.
|
||
For more information, see <a href="/environment-variables#supported-variables">Supported environment variables</a>.</p>
|
||
<ol>
|
||
<li>To send an image to your flow with the API, POST the image file to the <code>/api/v2/files</code> endpoint.
|
||
Replace <strong>FILE_NAME</strong> with the uploaded file name.</li>
|
||
</ol>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST "$LANGFLOW_URL/api/v2/files" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: multipart/form-data" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "x-api-key: $LANGFLOW_API_KEY" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -F "file=@FILE_NAME.png"</span></div></div><br></code></div></div>
|
||
<p>The file is uploaded in the format <code>USER_ID/FILE_ID.FILE_EXTENSION</code>, and the API returns metadata about the uploaded file:</p>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "id": "5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "name": "FILE_NAME",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "path": "232f54ba-dd54-4760-977e-ed637f83e785/5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e.png",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "size": 84408,</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "provider": null</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div>
|
||
<ol start="2">
|
||
<li>To use this file in your flow, add a <a href="/components-data#file">File</a> component to load a file into the flow.</li>
|
||
<li>To load the file into your flow, send it to the <strong>File</strong> component.</li>
|
||
</ol>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span>curl --request POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> --url '$LANGFLOW_URL/api/v1/run/$FLOW_ID' \</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> --header 'Content-Type: application/json' \</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> --header 'x-api-key: $LANGFLOW_API_KEY' \</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> --data '{</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> "input_value": "what do you see?",</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> "output_type": "chat",</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> "input_type": "text",</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> "tweaks": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> "File-t2Ngc": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> "path": [</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> "232f54ba-dd54-4760-977e-ed637f83e785/5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e.png"</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> ]</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->16</span><div style="display:inline-block;margin-left:16px"><span>}'</span></div></div><br></code></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="list-files-v2">List files (v2)<a href="#list-files-v2" class="hash-link" aria-label="Direct link to List files (v2)" title="Direct link to List files (v2)"></a></h3>
|
||
<p>List all files associated with your user account.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v2/files" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "x-api-key: $LANGFLOW_API_KEY"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>[</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> {</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "id": "c7b22c4c-d5e0-4ec9-af97-5d85b7657a34",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "name": "your_file",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "path": "6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "size": 1234,</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "provider": null</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>]</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="download-file-v2">Download file (v2)<a href="#download-file-v2" class="hash-link" aria-label="Direct link to Download file (v2)" title="Direct link to Download file (v2)"></a></h3>
|
||
<p>Download a specific file by its ID and file extension.</p>
|
||
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_BuS1"><p>You must specify the file type you expect in the <code>--output</code> value.</p></div></div>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v2/files/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "x-api-key: $LANGFLOW_API_KEY" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> --output downloaded_file.txt</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>File contents downloaded to downloaded_file.txt</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="edit-file-name-v2">Edit file name (v2)<a href="#edit-file-name-v2" class="hash-link" aria-label="Direct link to Edit file name (v2)" title="Direct link to Edit file name (v2)"></a></h3>
|
||
<p>Change a file name.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X PUT \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v2/files/$FILE_ID?name=new_file_name" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "x-api-key: $LANGFLOW_API_KEY"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "id": "76543e40-f388-4cb3-b0ee-a1e870aca3d3",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "name": "new_file_name",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "path": "6f17a73e-97d7-4519-a8d9-8e4c0be411bb/76543e40-f388-4cb3-b0ee-a1e870aca3d3.png",</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "size": 2728251,</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "provider": null</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="delete-file-v2">Delete file (v2)<a href="#delete-file-v2" class="hash-link" aria-label="Direct link to Delete file (v2)" title="Direct link to Delete file (v2)"></a></h3>
|
||
<p>Delete a specific file by its ID.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X DELETE \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v2/files/$FILE_ID" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "x-api-key: $LANGFLOW_API_KEY"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "message": "File deleted successfully"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="delete-all-files-v2">Delete all files (v2)<a href="#delete-all-files-v2" class="hash-link" aria-label="Direct link to Delete all files (v2)" title="Direct link to Delete all files (v2)"></a></h3>
|
||
<p>Delete all files associated with your user account.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X DELETE \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v2/files" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "x-api-key: $LANGFLOW_API_KEY"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "message": "All files deleted successfully"</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="flows">Flows<a href="#flows" class="hash-link" aria-label="Direct link to Flows" title="Direct link to Flows"></a></h2>
|
||
<p>Use the <code>/flows</code> endpoint to create, read, update, and delete flows.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="create-flow">Create flow<a href="#create-flow" class="hash-link" aria-label="Direct link to Create flow" title="Direct link to Create flow"></a></h3>
|
||
<p>Create a new flow.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>curl -X POST \</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/flows/" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> -d '{</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "name": "string2",</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "description": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "icon": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "icon_bg_color": "#FF0000",</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "gradient": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "data": {},</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "is_component": false,</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "updated_at": "2024-12-30T15:48:01.519Z",</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "webhook": false,</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "endpoint_name": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "tags": [</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> "string"</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span> ]</span></div></div><div><span class="ch-code-line-number">_<!-- -->19</span><div style="display:inline-block;margin-left:16px"><span>}'</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "name": "string2",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "description": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "icon": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "icon_bg_color": "#FF0000",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "gradient": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "data": {},</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "is_component": false,</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "updated_at": "2025-02-04T21:07:36+00:00",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "webhook": false,</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "endpoint_name": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "tags": ["string"],</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "locked": false,</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "id": "e8d81c37-714b-49ae-ba82-e61141f020ee",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "user_id": "f58396d4-a387-4bb8-b749-f40825c3d9f3",</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span> "project_id": "1415de42-8f01-4f36-bf34-539f23e47466"</span></div></div><div><span class="ch-code-line-number">_<!-- -->17</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="read-flows">Read flows<a href="#read-flows" class="hash-link" aria-label="Direct link to Read flows" title="Direct link to Read flows"></a></h3>
|
||
<p>Retrieve a list of flows with pagination support.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/flows/?remove_example_flows=false&components_only=false&get_all=true&header_flows=false&page=1&size=50" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>A JSON object containing a list of flows.</span></div></div><br></code></div></div></div></div></div>
|
||
<p>To retrieve only the flows from a specific project, pass <code>project_id</code> in the query string.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/flows/?remove_example_flows=true&components_only=false&get_all=false&project_id=$PROJECT_ID&header_flows=false&page=1&size=1" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>A JSON object containing a list of flows.</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="read-flow">Read flow<a href="#read-flow" class="hash-link" aria-label="Direct link to Read flow" title="Direct link to Read flow"></a></h3>
|
||
<p>Read a specific flow by its ID.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>curl -X GET \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json"</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "name": "Basic Prompting",</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "description": "Perform basic prompting with an OpenAI model.",</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "icon": "Braces",</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "icon_bg_color": null,</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "gradient": "2",</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "data": {</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> "nodes": [</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> ...</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> ]</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span> }</span></div></div><div><span class="ch-code-line-number">_<!-- -->12</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="update-flow">Update flow<a href="#update-flow" class="hash-link" aria-label="Direct link to Update flow" title="Direct link to Update flow"></a></h3>
|
||
<p>Update an existing flow by its ID.</p>
|
||
<p>This example changes the value for <code>endpoint_name</code> from a random UUID to <code>my_new_endpoint_name</code>.</p>
|
||
<div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">curl</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Result</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span>curl -X PATCH \</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> -H "accept: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> -H "Content-Type: application/json" \</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> -d '{</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> "name": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> "description": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> "data": {},</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> "endpoint_name": "my_new_endpoint_name",</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span> "locked": true</span></div></div><div><span class="ch-code-line-number">_<!-- -->13</span><div style="display:inline-block;margin-left:16px"><span>}'</span></div></div><br></code></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span>{</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "name": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "description": "string",</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "icon": "Braces",</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "icon_bg_color": null,</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "gradient": "2",</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "data": {},</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "is_component": false,</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "updated_at": "2024-12-30T18:30:22+00:00",</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "webhook": false,</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "endpoint_name": "my_new_endpoint_name",</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "tags": null,</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "locked": true,</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "user_id": "f58396d4-a387-4bb8-b749-f40825c3d9f3",</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span> "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"</span></div></div><div><span class="ch-code-line-number">_<!-- -->18</span><div style="display:inline-block;margin-left:16px"><span>}</span></div></div><br></code></div></div></div></div></div>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="delete-flow">Delete flow<a href="#delete-flow" class="hash-link" aria-label="Direct link to Delete flow" title="Direct link to Delete flow"> |