Skip to main content

Build endpoints

important

The /build endpoints are used by Langflow's frontend Workspace and Playground code. These endpoints are part of the internal Langflow codebase.

Don't use these endpoints to run flows in applications that use your Langflow flows. To run flows in your apps, see Flow trigger endpoints.

The /build endpoints support Langflow's frontend code for building flows in the Langflow Workspace. You can use these endpoints to build vertices and flows, as well as execute flows with streaming event responses. You might need to use or understand these endpoints when contributing to the Langflow project's core codebase.

Build flow and stream events

This endpoint builds and executes a flow, returning a job ID that can be used to stream execution events.

  1. Send a POST request to the /build/$FLOW_ID/flow endpoint.

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

  1. After receiving a job ID from the build endpoint, use the /build/$JOB_ID/events endpoint to stream the execution results:

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

The /build/$FLOW_ID/events endpoint accepts an optional stream query parameter that defaults to true. 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:

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

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:


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

Override flow parameters

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.


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

See also

Search