From 1a6b437eb186ad8ff9e5e14dbac609fc0a41f661 Mon Sep 17 00:00:00 2001 From: "github-merge-queue[bot]" Date: Mon, 7 Jul 2025 16:46:49 +0000 Subject: [PATCH] deploy: 343bdd0632b6c0ad20f4cb721b3faf59b3a83d74 --- 404.html | 2 +- agents-tools.html | 2 +- agents.html | 2 +- api-build.html | 5 +- api-files.html | 2 +- api-flows-run.html | 33 +++++---- api-flows.html | 2 +- api-logs.html | 2 +- api-monitor.html | 2 +- api-projects.html | 2 +- api-reference-api-examples.html | 37 +++++----- api-users.html | 2 +- api.html | 2 +- api/add-user.html | 2 +- api/auto-login.html | 2 +- api/build-flow.html | 2 +- api/build-public-tmp.html | 2 +- api/build-vertex-stream.html | 2 +- api/build-vertex.html | 2 +- api/cancel-build.html | 2 +- api/check-if-store-has-api-key.html | 2 +- api/check-if-store-is-enabled.html | 2 +- api/create-api-key-route.html | 2 +- api/create-flow.html | 2 +- api/create-flows.html | 2 +- api/create-folder-redirect.html | 2 +- api/create-project.html | 2 +- api/create-upload-file.html | 2 +- api/create-variable.html | 2 +- api/custom-component-update.html | 2 +- api/custom-component.html | 2 +- api/delete-all-files-1.html | 2 +- api/delete-all-files.html | 2 +- api/delete-api-key-route.html | 2 +- api/delete-file-1.html | 2 +- api/delete-file.html | 2 +- api/delete-files-batch.html | 2 +- api/delete-flow.html | 2 +- api/delete-folder-redirect.html | 2 +- api/delete-messages-session.html | 2 +- api/delete-messages.html | 2 +- api/delete-multiple-flows.html | 2 +- api/delete-project.html | 2 +- api/delete-user.html | 2 +- api/delete-variable.html | 2 +- api/delete-vertex-builds.html | 2 +- api/download-component.html | 2 +- api/download-file-1.html | 2 +- api/download-file-2.html | 2 +- api/download-file-redirect.html | 2 +- api/download-file.html | 2 +- api/download-files-batch.html | 2 +- api/download-image.html | 2 +- api/download-multiple-file.html | 2 +- api/download-profile-picture.html | 2 +- api/edit-file-name.html | 2 +- api/experimental-run-flow.html | 2 +- api/get-all.html | 2 +- api/get-api-keys-route.html | 2 +- api/get-build-events.html | 2 +- api/get-components.html | 2 +- api/get-config.html | 2 +- api/get-elevenlabs-voice-ids.html | 2 +- api/get-list-of-components-liked-by-user.html | 2 +- api/get-messages.html | 2 +- api/get-starter-projects.html | 2 +- api/get-tags.html | 2 +- api/get-task-status.html | 2 +- api/get-transactions.html | 2 +- api/get-version.html | 2 +- api/get-vertex-builds.html | 2 +- api/handle-messages-1.html | 2 +- api/handle-messages.html | 2 +- api/handle-project-messages-with-slash.html | 2 +- api/handle-project-messages.html | 2 +- api/handle-project-sse.html | 2 +- api/handle-sse-1.html | 2 +- api/handle-sse.html | 2 +- api/health-check.html | 2 +- api/health.html | 2 +- api/like-component.html | 2 +- api/list-files-1.html | 2 +- api/list-files-2.html | 2 +- api/list-files.html | 2 +- api/list-profile-pictures.html | 2 +- api/list-project-tools.html | 2 +- api/login-to-get-access-token.html | 2 +- api/logout.html | 2 +- api/logs.html | 2 +- api/patch-user.html | 2 +- api/post-validate-code.html | 2 +- api/post-validate-prompt.html | 2 +- api/process-1.html | 2 +- api/process.html | 2 +- api/read-all-users.html | 2 +- api/read-basic-examples.html | 2 +- api/read-current-user.html | 2 +- api/read-flow.html | 2 +- api/read-flows.html | 2 +- api/read-folder-redirect.html | 2 +- api/read-folders-redirect.html | 2 +- api/read-project.html | 2 +- api/read-projects.html | 2 +- api/read-public-flow.html | 2 +- api/read-variables.html | 2 +- api/refresh-token.html | 2 +- api/reset-password.html | 2 +- api/retrieve-vertices-order.html | 2 +- api/save-store-api-key.html | 2 +- api/share-component.html | 2 +- api/simplified-run-flow.html | 2 +- api/stream-logs.html | 2 +- api/update-flow.html | 2 +- api/update-folder-redirect.html | 2 +- api/update-message.html | 2 +- api/update-project-mcp-settings.html | 2 +- api/update-project.html | 2 +- api/update-session-id.html | 2 +- api/update-shared-component.html | 2 +- api/update-variable.html | 2 +- api/upload-file-1.html | 2 +- api/upload-file-2.html | 2 +- api/upload-file-redirect.html | 2 +- api/upload-file.html | 2 +- api/upload-user-file-1.html | 2 +- api/upload-user-file.html | 2 +- api/webhook-run-flow.html | 2 +- assets/js/14f42f9e.12cf78d0.js | 1 + assets/js/14f42f9e.ede97042.js | 1 - ...d74f7.2539c78b.js => 22dd74f7.d9fd45af.js} | 2 +- ...0d4f5.968c76b5.js => 2ab0d4f5.a984994c.js} | 2 +- ...4662c.667a8388.js => 64f4662c.3f050f51.js} | 2 +- assets/js/8311683c.015842e5.js | 1 - assets/js/8311683c.e1ad7d02.js | 1 + assets/js/89e8c924.3c6a5388.js | 1 + assets/js/89e8c924.8bf21f39.js | 1 - ...6a4d2.175599d6.js => e6c6a4d2.38c2d744.js} | 2 +- ...fa9a8.774f69c8.js => fdefa9a8.e64b5cd2.js} | 2 +- ...n.abf88a8d.js => runtime~main.320a3b33.js} | 2 +- basic-prompting.html | 2 +- blog-writer.html | 2 +- components-agents.html | 2 +- components-bundle-components.html | 2 +- components-custom-components.html | 2 +- components-data.html | 48 +++++++++---- components-embedding-models.html | 2 +- components-helpers.html | 2 +- components-io.html | 2 +- components-logic.html | 2 +- components-memories.html | 2 +- components-models.html | 2 +- components-processing.html | 2 +- components-prompts.html | 2 +- components-tools.html | 2 +- components-vector-stores.html | 2 +- concepts-components.html | 2 +- concepts-file-management.html | 2 +- concepts-flows.html | 2 +- concepts-objects.html | 2 +- concepts-overview.html | 2 +- concepts-playground.html | 2 +- concepts-publish.html | 2 +- concepts-voice-mode.html | 2 +- configuration-api-keys.html | 2 +- configuration-authentication.html | 2 +- configuration-cli.html | 2 +- configuration-custom-database.html | 2 +- configuration-global-variables.html | 2 +- contributing-bundles.html | 2 +- contributing-community.html | 2 +- contributing-component-tests.html | 2 +- contributing-components.html | 2 +- contributing-github-issues.html | 2 +- contributing-how-to-contribute.html | 2 +- contributing-telemetry.html | 2 +- contributing-templates.html | 2 +- deployment-caddyfile.html | 2 +- deployment-docker.html | 2 +- deployment-gcp.html | 2 +- deployment-hugging-face-spaces.html | 2 +- deployment-kubernetes-dev.html | 2 +- deployment-kubernetes-prod.html | 2 +- deployment-overview.html | 2 +- deployment-prod-best-practices.html | 2 +- deployment-public-server.html | 2 +- deployment-railway.html | 2 +- deployment-render.html | 2 +- develop-application.html | 2 +- develop-overview.html | 2 +- document-qa.html | 2 +- embedded-chat-widget.html | 2 +- environment-variables.html | 2 +- financial-report-parser.html | 2 +- get-started-installation.html | 2 +- get-started-quickstart.html | 2 +- index.html | 2 +- install-custom-dependencies.html | 2 +- integrations-apify.html | 2 +- integrations-arize.html | 2 +- integrations-assemblyai.html | 2 +- integrations-cleanlab.html | 2 +- integrations-composio.html | 2 +- integrations-google-big-query.html | 2 +- integrations-langfuse.html | 2 +- integrations-langsmith.html | 2 +- integrations-langwatch.html | 2 +- integrations-nvidia-g-assist.html | 2 +- integrations-nvidia-ingest-wsl2.html | 2 +- integrations-nvidia-ingest.html | 2 +- integrations-opik.html | 2 +- ...setup-google-cloud-vertex-ai-langflow.html | 2 +- integrations-setup-google-oauth-langflow.html | 2 +- .../notion/notion-agent-conversational.html | 2 +- .../notion/notion-agent-meeting-notes.html | 2 +- integrations/notion/setup.html | 2 +- logging.html | 2 +- luna-for-langflow.html | 2 +- mcp-client.html | 2 +- mcp-component-astra.html | 2 +- mcp-server.html | 2 +- memory-chatbot.html | 2 +- memory.html | 2 +- search.html | 2 +- sequential-agent.html | 2 +- session-id.html | 2 +- simple-agent.html | 2 +- sitemap.xml | 2 +- travel-planning-agent.html | 2 +- troubleshoot.html | 2 +- typescript-client.html | 2 +- vector-store-rag.html | 2 +- webhook.html | 69 ++++++++++++------- 232 files changed, 341 insertions(+), 299 deletions(-) create mode 100644 assets/js/14f42f9e.12cf78d0.js delete mode 100644 assets/js/14f42f9e.ede97042.js rename assets/js/{22dd74f7.2539c78b.js => 22dd74f7.d9fd45af.js} (77%) rename assets/js/{2ab0d4f5.968c76b5.js => 2ab0d4f5.a984994c.js} (50%) rename assets/js/{64f4662c.667a8388.js => 64f4662c.3f050f51.js} (51%) delete mode 100644 assets/js/8311683c.015842e5.js create mode 100644 assets/js/8311683c.e1ad7d02.js create mode 100644 assets/js/89e8c924.3c6a5388.js delete mode 100644 assets/js/89e8c924.8bf21f39.js rename assets/js/{e6c6a4d2.175599d6.js => e6c6a4d2.38c2d744.js} (55%) rename assets/js/{fdefa9a8.774f69c8.js => fdefa9a8.e64b5cd2.js} (69%) rename assets/js/{runtime~main.abf88a8d.js => runtime~main.320a3b33.js} (96%) diff --git a/404.html b/404.html index fcc9a0fc39..449604699e 100644 --- a/404.html +++ b/404.html @@ -21,7 +21,7 @@ - + diff --git a/agents-tools.html b/agents-tools.html index 61ead6f0f3..71a19adcac 100644 --- a/agents-tools.html +++ b/agents-tools.html @@ -21,7 +21,7 @@ - + diff --git a/agents.html b/agents.html index ff38a59597..06c8b3e9d3 100644 --- a/agents.html +++ b/agents.html @@ -21,7 +21,7 @@ - + diff --git a/api-build.html b/api-build.html index 91a1779980..13b381f0fc 100644 --- a/api-build.html +++ b/api-build.html @@ -21,7 +21,7 @@ - + @@ -58,8 +58,7 @@ You might need to use or understand these endpoints when contributing to the Lan To disable streaming and get all events at once, set stream to false.


_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events?stream=false" \
_10
-H "accept: application/json"

Build headers

-
HeaderInfoExample
Content-TypeRequired. Specifies the JSON format."application/json"
acceptRequired. Specifies the response format."application/json"
x-api-keyOptional. Required only if authentication is enabled."sk-..."
-

The /build/$FLOW_ID/flow endpoint accepts the following parameters in its request body:

+
HeaderInfoExample
Content-TypeRequired. Specifies the JSON format."application/json"
acceptOptional. Specifies the response format."application/json"
x-api-keyOptional. Required only if authentication is enabled."sk-..."

Build parameters

ParameterTypeDescription
inputsobjectOptional. Input values for flow components.
dataobjectOptional. Flow data to override stored configuration.
filesarray[string]Optional. List of file paths to use.
start_component_idstringOptional. ID of the component where the execution should start. Component id values can be found in Langflow JSON files
stop_component_idstringOptional. ID of the component where the execution should stop. Component id values can be found in Langflow JSON files.
log_buildsbooleanOptional. Control build logging. Default: true.

Set start and stop points

diff --git a/api-files.html b/api-files.html index f78ca82286..6897ee4c55 100644 --- a/api-files.html +++ b/api-files.html @@ -21,7 +21,7 @@ - + diff --git a/api-flows-run.html b/api-flows-run.html index eb6eb41a85..93af1d7ecd 100644 --- a/api-flows-run.html +++ b/api-flows-run.html @@ -3,7 +3,7 @@ -Flow trigger endpoints | Langflow Documentation +Flow trigger endpoints | Langflow Documentation @@ -21,7 +21,7 @@ - + @@ -38,29 +38,34 @@

Flow trigger endpoints

-

Use the /run amd /webhook endpoints to run flows.

+

Use the /run and /webhook endpoints to run flows.

To create, read, update, and delete flows, see Flow management endpoints.

Run flow

Execute a specified flow by ID or name. -The flow is executed as a batch, but LLM responses can be streamed.

-

This example runs a Basic Prompting flow with a given flow ID and passes a JSON object as the input value. -Flow IDs can be found on the Publish pane or in a flow's URL.

-

The parameters are passed in the request body. In this example, the values are the default values.

-

_11
curl -X POST \
_11
"$LANGFLOW_URL/api/v1/run/$FLOW_ID" \
_11
-H "Content-Type: application/json" \
_11
-d '{
_11
"input_value": "Tell me about something interesting!",
_11
"session_id": "chat-123",
_11
"input_type": "chat",
_11
"output_type": "chat",
_11
"output_component": "",
_11
"tweaks": null
_11
}'

+Flow IDs can be found on the code snippets on the API access pane or in a flow's URL.

+

The following example runs a Basic Prompting flow with flow parameters passed in the request body. +This flow requires a chat input string (input_value), and uses default values for all other parameters.

+

_11
curl -X POST \
_11
"$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID" \
_11
-H "Content-Type: application/json" \
_11
-d '{
_11
"input_value": "Tell me about something interesting!",
_11
"session_id": "chat-123",
_11
"input_type": "chat",
_11
"output_type": "chat",
_11
"output_component": "",
_11
"tweaks": null
_11
}'

+

The response from /v1/run/$FLOW_ID includes metadata, inputs, and outputs for the run.

+
Result

The following example illustrates a response from a Basic Prompting flow:


_29
{
_29
"session_id": "chat-123",
_29
"outputs": [{
_29
"inputs": {
_29
"input_value": "Tell me about something interesting!"
_29
},
_29
"outputs": [{
_29
"results": {
_29
"message": {
_29
"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!",
_29
"sender": "Machine",
_29
"sender_name": "AI",
_29
"session_id": "chat-123",
_29
"timestamp": "2025-03-03T17:17:37+00:00",
_29
"flow_id": "d2bbd92b-187e-4c84-b2d4-5df365704201",
_29
"properties": {
_29
"source": {
_29
"id": "OpenAIModel-d1wOZ",
_29
"display_name": "OpenAI",
_29
"source": "gpt-4o-mini"
_29
},
_29
"icon": "OpenAI"
_29
},
_29
"component_id": "ChatOutput-ylMzN"
_29
}
_29
}
_29
}]
_29
}]
_29
}

+

If you are parsing the response in an application, you most likely need to extract the relevant content from the response, rather than pass the entire response back to the user. +For an example of a script that extracts data from a Langflow API response, see the Quickstart.

Stream LLM token responses

-

To stream LLM token responses, append the ?stream=true query parameter to the request. LLM chat responses are streamed back as token events until the end event closes the connection.

-

_10
curl -X POST \
_10
"$LANGFLOW_URL/api/v1/run/$FLOW_ID?stream=true" \
_10
-H "accept: application/json" \
_10
-H "Content-Type: application/json" \
_10
-d '{
_10
"message": "Tell me something interesting!",
_10
"session_id": "chat-123"
_10
}'

-

This result is abbreviated, but illustrates where the end event completes the LLM's token streaming response.

+

With /v1/run/$FLOW_ID, the flow is executed as a batch with optional LLM token response streaming.

+

To stream LLM token responses, append the ?stream=true query parameter to the request:

+

_10
curl -X POST \
_10
"$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \
_10
-H "accept: application/json" \
_10
-H "Content-Type: application/json" \
_10
-d '{
_10
"message": "Tell me something interesting!",
_10
"session_id": "chat-123"
_10
}'

+

LLM chat responses are streamed back as token events, culminating in a final end event that closes the connection.

+
Result

The following example is truncated to illustrate a series of token events as well as the final end event that closes the LLM's token streaming response:


_19
{"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"}}
_19
_19
{"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"}}
_19
_19
{"event": "token", "data": {"chunk": " Have", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19
_19
{"event": "token", "data": {"chunk": " you", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19
_19
{"event": "token", "data": {"chunk": " ever", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19
_19
{"event": "token", "data": {"chunk": " heard", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19
_19
{"event": "token", "data": {"chunk": " of", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19
_19
{"event": "token", "data": {"chunk": " the", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19
_19
{"event": "token", "data": {"chunk": " phenomenon", "id": "27b66789-e673-4c65-9e81-021752925161", "timestamp": "2025-03-03 17:20:18 UTC"}}
_19
_19
{"event": "end", "data": {"result": {"session_id": "chat-123", "message": "Sure! Have you ever heard of the phenomenon known as \"bioluminescence\"?..."}}}

Run endpoint headers

-
HeaderInfoExample
Content-TypeRequired. Specifies the JSON format."application/json"
acceptRequired. Specifies the response format."application/json"
x-api-keyOptional. Required only if authentication is enabled."sk-..."
+
HeaderInfoExample
Content-TypeRequired. Specifies the JSON format."application/json"
acceptOptional. Specifies the response format."application/json"
x-api-keyOptional. Required only if authentication is enabled."sk-..."

Run endpoint parameters

ParameterTypeInfo
flow_idUUID/stringRequired. Part of URL: /run/$FLOW_ID
streambooleanOptional. Query parameter: /run/$FLOW_ID?stream=true
input_valuestringOptional. JSON body field. Main input text/prompt. Default: null
input_typestringOptional. JSON body field. Input type ("chat" or "text"). Default: "chat"
output_typestringOptional. JSON body field. Output type ("chat", "any", "debug"). Default: "chat"
output_componentstringOptional. JSON body field. Target component for output. Default: ""
tweaksobjectOptional. JSON body field. Component adjustments. Default: null
session_idstringOptional. JSON body field. Conversation context ID. See Session ID. Default: null

Request example with all headers and parameters

-

_17
curl -X POST \
_17
"http://$LANGFLOW_URL/api/v1/run/$FLOW_ID?stream=true" \
_17
-H "Content-Type: application/json" \
_17
-H "accept: application/json" \
_17
-H "x-api-key: sk-..." \
_17
-d '{
_17
"input_value": "Tell me a story",
_17
"input_type": "chat",
_17
"output_type": "chat",
_17
"output_component": "chat_output",
_17
"session_id": "chat-123",
_17
"tweaks": {
_17
"component_id": {
_17
"parameter_name": "value"
_17
}
_17
}
_17
}'

+

_17
curl -X POST \
_17
"$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=true" \
_17
-H "Content-Type: application/json" \
_17
-H "accept: application/json" \
_17
-H "x-api-key: sk-..." \
_17
-d '{
_17
"input_value": "Tell me a story",
_17
"input_type": "chat",
_17
"output_type": "chat",
_17
"output_component": "chat_output",
_17
"session_id": "chat-123",
_17
"tweaks": {
_17
"component_id": {
_17
"parameter_name": "value"
_17
}
_17
}
_17
}'

Webhook run flow

Use the /webhook endpoint to start a flow by sending an HTTP POST request.

tip

After you add a Webhook component to a flow, open the API access pane, and then click the Webhook cURL tab to get an automatically generated POST /webhook request for your flow.

-

_10
curl -X POST \
_10
"$LANGFLOW_URL/api/v1/webhook/$FLOW_ID" \
_10
-H "Content-Type: application/json" \
_10
-d '{"data": "example-data"}'

+

_10
curl -X POST \
_10
"$LANGFLOW_SERVER_URL/api/v1/webhook/$FLOW_ID" \
_10
-H "Content-Type: application/json" \
_10
-d '{"data": "example-data"}'

Result

_10
{
_10
"message": "Task started in the background",
_10
"status": "in progress"
_10
}

For more information, see Webhook component and Trigger flows with webhooks.

Deprecated flow trigger endpoints

diff --git a/api-flows.html b/api-flows.html index d77bfd13ea..027d8444b1 100644 --- a/api-flows.html +++ b/api-flows.html @@ -21,7 +21,7 @@ - + diff --git a/api-logs.html b/api-logs.html index 4fe6e6f2db..ab0116188c 100644 --- a/api-logs.html +++ b/api-logs.html @@ -21,7 +21,7 @@ - + diff --git a/api-monitor.html b/api-monitor.html index aebb59af4f..a4fd2a5500 100644 --- a/api-monitor.html +++ b/api-monitor.html @@ -21,7 +21,7 @@ - + diff --git a/api-projects.html b/api-projects.html index c2322b21e8..32743c32a9 100644 --- a/api-projects.html +++ b/api-projects.html @@ -21,7 +21,7 @@ - + diff --git a/api-reference-api-examples.html b/api-reference-api-examples.html index 80865cb94b..171da2e60e 100644 --- a/api-reference-api-examples.html +++ b/api-reference-api-examples.html @@ -21,7 +21,7 @@ - + @@ -47,9 +47,11 @@
  • Contribute to the overall Langflow project.
  • To view and test all available endpoints, you can access the Langflow API's OpenAPI specification at your Langflow deployment's /docs endpoint, such as http://localhost:7860/docs.

    -
    tip

    For an example of the Langflow API in a script, see the Langflow quickstart.

    The quickstart demonstrates how to get automatically generated code snippets for your flows, use a script to run a flow, and extract data from the Langfow API response.

    +
    Try it

    For an example of the Langflow API in a script, see the Langflow quickstart.

    The quickstart demonstrates how to get automatically generated code snippets for your flows, use a script to run a flow, and extract data from the Langfow API response.

    Form Langflow API requests

    -

    While individual parameters vary by endpoint, all Langflow API requests share some commonalities.

    +

    While individual options vary by endpoint, all Langflow API requests share some commonalities, like a URL, method, parameters, and authentication.

    +

    As an example of a Langflow API request, the following curl command calls the /v1/run endpoint, and it passes a runtime override (tweaks) to the flow's Chat Output component:

    +

    _14
    curl --request POST \
    _14
    --url "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID?stream=false" \
    _14
    --header "Content-Type: application/json" \
    _14
    --header "x-api-key: $LANGFLOW_API_KEY" \
    _14
    --data '{
    _14
    "input_value": "hello world!",
    _14
    "output_type": "chat",
    _14
    "input_type": "chat",
    _14
    "tweaks": {
    _14
    "ChatOutput-6zcZt": {
    _14
    "should_store_message": true
    _14
    }
    _14
    }
    _14
    }'

    Base URL

    Local deployments serve the Langflow API at http://localhost:LANGFLOW_PORT/api. The default port is 7868 or 7860:

    @@ -71,47 +73,46 @@ For example:

    If explicit authentication is required, you must provide a valid Langflow API key in either an x-api-key header or query parameter. For more information, see API keys.

    Because authentication isn't always required, Langflow API examples in the Langflow documentation often omit authentication.

    +

    As with any API, follow industry best practices for storing and referencing sensitive credentials. +For example, you can set environment variables for your API keys, and then reference those environment variables in your API requests.

    Methods, paths, and parameters

    -

    Langflow API requests use a variety of methods, paths, path parameters, query parameters, and body parameters. +

    Langflow API requests use various methods, paths, path parameters, query parameters, and body parameters. The specific requirements and options depend on the endpoint that you want to call.

    For example, to create a flow, you pass a JSON-formatted flow definition to POST /v1/flows. Then, to run your flow, you call POST /v1/run/$FLOW_ID with optional run parameters in the request body.

    -

    Versions

    +

    API versions

    The Langflow API serves /v1 and /v2 endpoints.

    Some endpoints only exist under a single version and some exist under both the /v1 and /v2 versions.

    If a request fails or has an unexpected result, make sure your endpoint path has the correct version.

    Set environment variables

    -

    As a best practice with any API, store commonly used values in environment variables to facilitate reuse, simplify token rotation, and securely reference sensitive values. -You can use any method you prefer to set environment variables, such as export, .env, zshrc, or .curlrc. -Additionally, be sure to follow industry best practices when storing credentials and other sensitive values.

    -

    You might find it helpful to set environment variables for values like your Langflow server URL, Langflow API keys, flow IDs, and project IDs. +

    You can store commonly used values in environment variables to facilitate reuse, simplify token rotation, and securely reference sensitive values.

    +

    You can use any method you prefer to set environment variables, such as export, .env, zshrc, or .curlrc. +Then, reference those environment variables in your API requests. For example:

    -

    _10
    export LANGFLOW_URL="http://localhost:7860"
    _10
    export FLOW_ID="359cd752-07ea-46f2-9d3b-a4407ef618da"
    _10
    export PROJECT_ID="1415de42-8f01-4f36-bf34-539f23e47466"
    _10
    export API_KEY="sk-..."

    -
    tip
      -
    • You can find flow IDs on the Publish pane, in a flow's URL, and with GET /flows.
    • -
    • You can retrieve project IDs with GET /projects(/api-projects#read-projects).
    • -
    +

    _20
    # Set environment variables
    _20
    export LANGFLOW_API_KEY="sk..."
    _20
    export LANGFLOW_SERVER_URL="https://localhost:7860"
    _20
    export FLOW_ID="359cd752-07ea-46f2-9d3b-a4407ef618da"
    _20
    _20
    # Use environment variables in API requests
    _20
    curl --request POST \
    _20
    --url "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID$?stream=false" \
    _20
    --header "Content-Type: application/json" \
    _20
    --header "x-api-key: $LANGFLOW_API_KEY" \
    _20
    --data '{
    _20
    "input_value": "hello world!",
    _20
    "output_type": "chat",
    _20
    "input_type": "chat",
    _20
    "tweaks": {
    _20
    "ChatOutput-6zcZt": {
    _20
    "should_store_message": true
    _20
    }
    _20
    }
    _20
    }'

    +

    Commonly used values in Langflow API requests include your Langflow server URL, Langflow API keys, flow IDs, and project IDs.

    +

    You can retrieve flow IDs from the API access pane, in a flow's URL, and with GET /flows.

    Try some Langflow API requests

    Once you have your Langflow server URL, try calling these endpoints that return Langflow metadata.

    If authentication is required, include an x-api-key header or query parameter with a valid Langflow API key, such as -H 'x-api-key: $API_KEY'.

    Get version

    Returns the current Langflow API version:

    -

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

    +

    _10
    curl -X GET \
    _10
    "$LANGFLOW_SERVER_URL/api/v1/version" \
    _10
    -H "accept: application/json"

    Result

    _10
    {
    _10
    "version": "1.1.1",
    _10
    "main_version": "1.1.1",
    _10
    "package": "Langflow"
    _10
    }

    Get configuration

    Returns configuration details for your Langflow deployment:

    -

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

    +

    _10
    curl -X GET \
    _10
    "$LANGFLOW_SERVER_URL/api/v1/config" \
    _10
    -H "accept: application/json"

    Result

    _10
    {
    _10
    "feature_flags": {
    _10
    "mvp_components": false
    _10
    },
    _10
    "frontend_timeout": 0,
    _10
    "auto_saving": true,
    _10
    "auto_saving_interval": 1000,
    _10
    "health_check_max_retries": 5,
    _10
    "max_file_size_upload": 100
    _10
    }

    Get all components

    Returns a dictionary of all Langflow components:

    -

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

    +

    _10
    curl -X GET \
    _10
    "$LANGFLOW_SERVER_URL/api/v1/all" \
    _10
    -H "accept: application/json"

    Next steps