Skip to main content

Flow trigger endpoints

Use the /run amd /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
}'

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.

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

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

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"}'

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

The following endpoints are deprecated and replaced by the /run endpoint:

  • /process
  • /predict
Search