API examples
This page provides examples and practices for managing Langflow using the Langflow API.
The Langflow API's OpenAPI spec can be viewed and tested at your Langflow deployment's docs
endpoint.
For example, http://127.0.0.1:7860/docs
.
Export values
You might find it helpful to set the following environment variables in your terminal.
The examples in this guide use environment variables for these values.
- Export your Langflow URL in your terminal.
Langflow starts by default at
http://127.0.0.1:7860
.
_10export LANGFLOW_URL="http://127.0.0.1:7860"
- Export the
flow-id
in your terminal. Theflow-id
is found in the Publish pane or in the flow's URL.
_10export FLOW_ID="359cd752-07ea-46f2-9d3b-a4407ef618da"
- Export the
project-id
in your terminal. To find your project ID, call the Langflow /api/v1/projects/ endpoint for a list of projects.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/projects/" \_10 "$LANGFLOW_URL/api/v1/projects/" \_10 -H "accept: application/json"
_10[_10 {_10 "name": "My Projects",_10 "description": "Manage your own projects. Download and upload projects.",_10 "id": "1415de42-8f01-4f36-bf34-539f23e47466",_10 "parent_id": null_10 }_10]
Export the project-id
as an environment variable.
Export the project-id
as an environment variable.
_10export project_ID="1415de42-8f01-4f36-bf34-539f23e47466"
- Export the Langflow API key as an environment variable. To create a Langflow API key, run the following command in the Langflow CLI.
- curl
- Result
_10langflow api-key
_10API Key Created Successfully:_10sk-...
Export the generated API key as an environment variable.
_10export LANGFLOW_API_KEY="sk-..."
Base
Use the base Langflow API to run your flow and retrieve configuration information.
Get all components
This operation returns a dictionary of all Langflow components.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/all" \_10 -H "accept: application/json"
_10A dictionary of all Langflow components.
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.
The parameters are passed in the request body. In this example, the values are the default values.
- curl
- Result
_11curl -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 }'
_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}
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.
- curl
- Result
_10curl -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 }'
_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\"?..."}}}
This result is abbreviated, but illustrates where the end
event completes the LLM's token streaming response.
Run endpoint headers and parameters
Parameters can be passed to the /run
endpoint in three ways:
- URL path:
flow_id
as part of the endpoint path - Query string:
stream
parameter in the URL - Request body: JSON object containing the remaining parameters
Headers
Header | Info | Example |
---|---|---|
Content-Type | Required. Specifies the JSON format. | "application/json" |
accept | Required. Specifies the response format. | "application/json" |
x-api-key | Optional. Required only if authentication is enabled. | "sk-..." |
Parameters
Parameter | Type | Info |
---|---|---|
flow_id | UUID/string | Required. Part of URL: /run/{flow_id} |
stream | boolean | Optional. Query parameter: /run/{flow_id}?stream=true |
input_value | string | Optional. JSON body field. Main input text/prompt. Default: null |
input_type | string | Optional. JSON body field. Input type ("chat" or "text"). Default: "chat" |
output_type | string | Optional. JSON body field. Output type ("chat", "any", "debug"). Default: "chat" |
output_component | string | Optional. JSON body field. Target component for output. Default: "" |
tweaks | object | Optional. JSON body field. Component adjustments. Default: null |
session_id | string | Optional. JSON body field. Conversation context ID. Default: null |
Example request
_17curl -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 }'
Webhook run flow
The webhook endpoint triggers flow execution with an HTTP POST request.
When a Webhook component is added to the workspace, a new Webhook cURL tab becomes available in the API pane that contains an HTTP POST request for triggering the webhook component, similar to the call in this example.
To test the Webhook component in your flow, see the Webhook component.
- curl
- Result
_10curl -X POST \_10 "$LANGFLOW_URL/api/v1/webhook/$FLOW_ID" \_10 -H "Content-Type: application/json" \_10 -d '{"data": "example-data"}'
_10{_10 {"message":"Task started in the background","status":"in progress"}_10}
Process
This endpoint is deprecated. Use the /run
endpoint instead.
Predict
This endpoint is deprecated. Use the /run
endpoint instead.
Get task status
Get the status of a task.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/task/TASK_ID" \_10 -H "accept: application/json"
_10{_10 "status": "Task status",_10 "result": "Task result if completed"_10}
Create upload file (Deprecated)
This endpoint is deprecated. Use the /file
endpoint instead.
Get version
Get the version of the Langflow API.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/version" \_10 -H "accept: application/json"
_10{_10 "version": "1.1.1",_10 "main_version": "1.1.1",_10 "package": "Langflow"_10}
Get config
Retrieve the Langflow configuration information.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/config" \_10 -H "accept: application/json"
_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}
Build
Use the /build
endpoint to build vertices and flows, and execute those flows with streaming event responses.
The /build
endpoint offers additional configuration for running flows.
For a simpler execution of your flows, use the /run
endpoint instead.
Build flow
This endpoint is meant to be used by the frontend and is not optimized for external use.
To run your flow, use the /run
endpoint instead.
This endpoint builds and executes a flow, returning a job ID that can be used to stream execution events.
- Send a POST request to the
/build/{flow_id}/flow
endpoint.
- curl
- Result
_10curl -X POST \_10 "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \_10 -H "accept: application/json" \_10 -H "Content-Type: application/json" \_10 -d '{_10 "inputs": {_10 "input_value": "Tell me a story"_10 }_10 }'
_10{_10 "job_id": "123e4567-e89b-12d3-a456-426614174000"_10}
- After receiving a job ID from the build endpoint, use the
/build/{job_id}/events
endpoint to stream the execution results:
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events" \_10 -H "accept: application/json"
_10{"event": "vertices_sorted", "data": {"ids": ["ChatInput-XtBLx"], "to_run": ["Prompt-x74Ze", "ChatOutput-ylMzN", "ChatInput-XtBLx", "OpenAIModel-d1wOZ"]}}_10_10{"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"}}_10_10// ... Additional events as the flow executes ..._10_10{"event": "end", "data": {}}
The events endpoint accepts an optional stream
query parameter which defaults to true
.
To disable streaming and get all events at once, set stream
to false
.
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events?stream=false" \_10 -H "accept: application/json"
Build endpoint headers and parameters
Headers
Header | Info | Example |
---|---|---|
Content-Type | Required. Specifies the JSON format. | "application/json" |
accept | Required. Specifies the response format. | "application/json" |
x-api-key | Optional. Required only if authentication is enabled. | "sk-..." |
The /build/{flow_id}/flow
endpoint accepts the following parameters in its request body:
Parameters
Parameter | Type | Description |
---|---|---|
inputs | object | Optional. Input values for flow components. |
data | object | Optional. Flow data to override stored configuration. |
files | array[string] | Optional. List of file paths to use. |
stop_component_id | string | Optional. ID of the component where the execution should stop. |
start_component_id | string | Optional. ID of the component where the execution should start. |
log_builds | boolean | Optional. Control build logging. Default: true . |
Configure the build endpoint
The /build
endpoint accepts optional values for start_component_id
and stop_component_id
to control where the flow run starts and stops.
Setting stop_component_id
for a component triggers the same behavior as clicking the Play 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:
_10curl -X POST \_10 "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \_10 -H "accept: application/json" \_10 -H "Content-Type: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 -d '{"stop_component_id": "OpenAIModel-Uksag"}'
The /build
endpoint also accepts inputs for data
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.
- curl
- Result
_14curl -X POST \_14 "$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \_14 -H "accept: application/json" \_14 -H "Content-Type: application/json" \_14 -d '{_14 "data": {_14 "nodes": [],_14 "edges": []_14 },_14 "inputs": {_14 "input_value": "Your custom input here",_14 "session": "session_id"_14 }_14 }'
_10{ "job_id": "0bcc7f23-40b4-4bfa-9b8a-a44181fd1175" }
Files
Use the /files
endpoint to add or delete files between your local machine and Langflow.
There are /v1
and /v2
versions of the /files
endpoints.
The v2/files
version offers several improvements over /v1
:
- In
v1
, files are organized byflow_id
. Inv2
, files are organized byuser_id
. 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. - In
v2
, files are tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one. - Responses from the
/v2
endpoint contain more descriptive metadata. - The
v2
endpoints require authentication by an API key or JWT.
Files/V1 endpoints
Use the /files
endpoint to add or delete files between your local machine and Langflow.
- In
v1
, files are organized byflow_id
. - In
v2
, files are organized byuser_id
and tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one.
Upload file (v1)
Upload a file to the v1/files/upload/<YOUR-FLOW-ID>
endpoint of your flow.
Replace FILE_NAME with the uploaded file name.
- curl
- Result
_10curl -X POST \_10 "$LANGFLOW_URL/api/v1/files/upload/$FLOW_ID" \_10 -H "accept: application/json" \_10 -H "Content-Type: multipart/form-data" \_10 -F "file=@FILE_NAME.txt"
_10{_10 "flowId": "92f9a4c5-cfc8-4656-ae63-1f0881163c28",_10 "file_path": "92f9a4c5-cfc8-4656-ae63-1f0881163c28/2024-12-30_15-19-43_your_file.txt"_10}
Upload image files (v1)
Send image files to the Langflow API for AI analysis.
The default file limit is 100 MB. To configure this value, change the LANGFLOW_MAX_FILE_SIZE_UPLOAD
environment variable.
For more information, see Supported environment variables.
- To send an image to your flow with the API, POST the image file to the
v1/files/upload/<YOUR-FLOW-ID>
endpoint of your flow. Replace FILE_NAME with the uploaded file name.
_10curl -X POST "$LANGFLOW_URL/api/v1/files/upload/a430cc57-06bb-4c11-be39-d3d4de68d2c4" \_10 -H "Content-Type: multipart/form-data" \_10 -F "file=@FILE_NAME.png"
The API returns the image file path in the format "file_path":"<YOUR-FLOW-ID>/<TIMESTAMP>_<FILE-NAME>"}
.
_10{_10 "flowId": "a430cc57-06bb-4c11-be39-d3d4de68d2c4",_10 "file_path": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png"_10}
- Post the image file to the Chat Input component of a Basic prompting flow. Pass the file path value as an input in the Tweaks section of the curl call to Langflow. To find your Chat input component's ID, use the
_12curl -X POST \_12 "$LANGFLOW_URL/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false" \_12 -H 'Content-Type: application/json'\_12 -d '{_12 "output_type": "chat",_12 "input_type": "chat",_12 "tweaks": {_12 "ChatInput-b67sL": {_12 "files": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png",_12 "input_value": "what do you see?"_12 }_12}}'
Your chatbot describes the image file you sent.
_10"text": "This flowchart appears to represent a complex system for processing financial inquiries using various AI agents and tools. Here's a breakdown of its components and how they might work together..."
List files (v1)
List all files associated with a specific flow.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \_10 -H "accept: application/json"
_10{_10 "files": ["2024-12-30_15-19-43_your_file.txt"]_10}
Download file (v1)
Download a specific file from a flow.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/files/download/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \_10 -H "accept: application/json" \_10 --output downloaded_file.txt
_10File contents downloaded to downloaded_file.txt
Delete file (v1)
Delete a specific file from a flow.
- curl
- Result
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v1/files/delete/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \_10 -H "accept: application/json"
_10{_10 "message": "File 2024-12-30_15-19-43_your_file.txt deleted successfully"_10}
Files/V2 endpoints
In v2
, files are organized by user_id
and tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one.
The v2
endpoints require authentication by an API key or JWT.
To create a Langflow API key and export it as an environment variable, see Export values.
Upload file (v2)
Upload a file to your user account. The file can be used across multiple flows.
The file is uploaded in the format USER_ID/FILE_ID.FILE_EXTENSION
, such as 6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt
.
Replace FILE_NAME.EXTENSION with the uploaded file name and its extension.
- curl
- Result
_10curl -X POST \_10 "$LANGFLOW_URL/api/v2/files" \_10 -H "accept: application/json" \_10 -H "Content-Type: multipart/form-data" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 -F "file=@FILE_NAME.EXTENSION"
_10{_10 "id": "c7b22c4c-d5e0-4ec9-af97-5d85b7657a34",_10 "name": "FILE_NAME.EXTENSION",_10 "path": "6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt",_10 "size": 1234,_10 "provider": null_10}
Send files to your flows (v2)
Send a file to your flow for analysis using the File component.
The default file limit is 100 MB. To configure this value, change the LANGFLOW_MAX_FILE_SIZE_UPLOAD
environment variable.
For more information, see Supported environment variables.
- To send an image to your flow with the API, POST the image file to the
/api/v2/files
endpoint. Replace FILE_NAME with the uploaded file name.
_10curl -X POST "$LANGFLOW_URL/api/v2/files" \_10 -H "Content-Type: multipart/form-data" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 -F "file=@FILE_NAME.png"
The file is uploaded in the format USER_ID/FILE_ID.FILE_EXTENSION
, and the API returns metadata about the uploaded file:
_10{_10 "id": "5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e",_10 "name": "FILE_NAME",_10 "path": "232f54ba-dd54-4760-977e-ed637f83e785/5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e.png",_10 "size": 84408,_10 "provider": null_10}
- To use this file in your flow, add a File component to load a file into the flow.
- To load the file into your flow, send it to the File component.
_16curl --request POST \_16 --url '$LANGFLOW_URL/api/v1/run/$FLOW_ID' \_16 --header 'Content-Type: application/json' \_16 --header 'x-api-key: $LANGFLOW_API_KEY' \_16 --data '{_16 "input_value": "what do you see?",_16 "output_type": "chat",_16 "input_type": "text",_16 "tweaks": {_16 "File-t2Ngc": {_16 "path": [_16 "232f54ba-dd54-4760-977e-ed637f83e785/5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e.png"_16 ]_16 }_16 }_16}'
List files (v2)
List all files associated with your user account.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v2/files" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10[_10 {_10 "id": "c7b22c4c-d5e0-4ec9-af97-5d85b7657a34",_10 "name": "your_file",_10 "path": "6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt",_10 "size": 1234,_10 "provider": null_10 }_10]
Download file (v2)
Download a specific file by its ID and file extension.
You must specify the file type you expect in the --output
value.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v2/files/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY" \_10 --output downloaded_file.txt
_10File contents downloaded to downloaded_file.txt
Edit file name (v2)
Change a file name.
- curl
- Result
_10curl -X PUT \_10 "$LANGFLOW_URL/api/v2/files/$FILE_ID?name=new_file_name" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10{_10 "id": "76543e40-f388-4cb3-b0ee-a1e870aca3d3",_10 "name": "new_file_name",_10 "path": "6f17a73e-97d7-4519-a8d9-8e4c0be411bb/76543e40-f388-4cb3-b0ee-a1e870aca3d3.png",_10 "size": 2728251,_10 "provider": null_10}
Delete file (v2)
Delete a specific file by its ID.
- curl
- Result
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v2/files/$FILE_ID" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10{_10 "message": "File deleted successfully"_10}
Delete all files (v2)
Delete all files associated with your user account.
- curl
- Result
_10curl -X DELETE \_10 "$LANGFLOW_URL/api/v2/files" \_10 -H "accept: application/json" \_10 -H "x-api-key: $LANGFLOW_API_KEY"
_10{_10 "message": "All files deleted successfully"_10}
Flows
Use the /flows
endpoint to create, read, update, and delete flows.
Create flow
Create a new flow.
- curl
- Result
_19curl -X POST \_19 "$LANGFLOW_URL/api/v1/flows/" \_19 -H "accept: application/json" \_19 -H "Content-Type: application/json" \_19 -d '{_19 "name": "string2",_19 "description": "string",_19 "icon": "string",_19 "icon_bg_color": "#FF0000",_19 "gradient": "string",_19 "data": {},_19 "is_component": false,_19 "updated_at": "2024-12-30T15:48:01.519Z",_19 "webhook": false,_19 "endpoint_name": "string",_19 "tags": [_19 "string"_19 ]_19}'
_17{_17 "name": "string2",_17 "description": "string",_17 "icon": "string",_17 "icon_bg_color": "#FF0000",_17 "gradient": "string",_17 "data": {},_17 "is_component": false,_17 "updated_at": "2025-02-04T21:07:36+00:00",_17 "webhook": false,_17 "endpoint_name": "string",_17 "tags": ["string"],_17 "locked": false,_17 "id": "e8d81c37-714b-49ae-ba82-e61141f020ee",_17 "user_id": "f58396d4-a387-4bb8-b749-f40825c3d9f3",_17 "project_id": "1415de42-8f01-4f36-bf34-539f23e47466"_17}
Read flows
Retrieve a list of flows with pagination support.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/flows/?remove_example_flows=false&components_only=false&get_all=true&header_flows=false&page=1&size=50" \_10 -H "accept: application/json"
_10A JSON object containing a list of flows.
To retrieve only the flows from a specific project, pass project_id
in the query string.
- curl
- Result
_10curl -X GET \_10 "$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" \_10 -H "accept: application/json"
_10A JSON object containing a list of flows.
Read flow
Read a specific flow by its ID.
- curl
- Result
_10curl -X GET \_10 "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \_10 -H "accept: application/json"
_12{_12 "name": "Basic Prompting",_12 "description": "Perform basic prompting with an OpenAI model.",_12 "icon": "Braces",_12 "icon_bg_color": null,_12 "gradient": "2",_12 "data": {_12 "nodes": [_12 ..._12 ]_12 }_12}
Update flow
Update an existing flow by its ID.
This example changes the value for endpoint_name
from a random UUID to my_new_endpoint_name
.
- curl
- Result
_13curl -X PATCH \_13 "$LANGFLOW_URL/api/v1/flows/$FLOW_ID" \_13 -H "accept: application/json" \_13 -H "Content-Type: application/json" \_13 -d '{_13 "name": "string",_13 "description": "string",_13 "data": {},_13 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",_13 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",_13 "endpoint_name": "my_new_endpoint_name",_13 "locked": true_13}'
_18{_18 "name": "string",_18 "description": "string",_18 "icon": "Braces",_18 "icon_bg_color": null,_18 "gradient": "2",_18 "data": {},_18 "is_component": false,_18 "updated_at": "2024-12-30T18:30:22+00:00",_18 "webhook": false,_18 "endpoint_name": "my_new_endpoint_name",_18 "tags": null,_18 "locked": true,_18 "id": "01ce083d-748b-4b8d-97b6-33adbb6a528a",_18 "user_id": "f58396d4-a387-4bb8-b749-f40825c3d9f3",_18 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"_18 "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"_18}