Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 44 additions & 56 deletions docs/docs/API-Reference/api-build.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,68 +22,60 @@ You might need to use or understand these endpoints when contributing to the Lan

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.

<Tabs>
<TabItem value="curl" label="curl" default>

```bash
curl -X POST \
"$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY" \
-d '{
"inputs": {
"input_value": "Tell me a story"
1. Send a POST request to the `/build/$FLOW_ID/flow` endpoint:

```shell
curl -X POST \
"$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY" \
-d '{
"inputs": {
"input_value": "Tell me a story"
}
}'
```
Comment on lines +27 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify shell syntax consistency across codebase.

The code blocks now use shell instead of bash as the language identifier. Ensure this change is consistent across all documentation files.


🏁 Script executed:

#!/bin/bash
# Description: Check for inconsistent shell language identifiers in documentation

# Find all shell code blocks and check for consistency
rg -n '```(bash|shell|sh)' docs/

Length of output: 11814


Ensure consistent shell code block identifiers across documentation
Several docs still use bash or sh code fences. Please replace all of them with shell to match the updated convention.

• Replace every instance of bash and sh in the docs/ folder with ```shell.
• Example diff:

- ```bash
+ ```shell

• You can bulk-apply this with:

rg -l '```bash|```sh' docs/ | xargs sed -i 's/^```\(bash\|sh\)/```shell/'
🤖 Prompt for AI Agents
In docs/docs/API-Reference/api-build.mdx around lines 27 to 38, the shell code
block uses ```bash or ```sh instead of the updated convention ```shell. To fix
this, replace all occurrences of ```bash and ```sh code fences in the docs/
folder with ```shell to ensure consistency. You can do this manually or
bulk-apply using the provided command to update all relevant code blocks.


<details>
<summary>Result</summary>

```json
{
"job_id": "123e4567-e89b-12d3-a456-426614174000"
}
}'
```
```

</TabItem>
<TabItem value="result" label="Result">

```json
{
"job_id": "123e4567-e89b-12d3-a456-426614174000"
}
```

</TabItem>
</Tabs>
</details>

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

<Tabs>
<TabItem value="curl" label="curl" default>
```shell
curl -X GET \
"$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events" \
-H "accept: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY"
```

```text
curl -X GET \
"$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events" \
-H "accept: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY"
```
<details>
<summary>Result</summary>

</TabItem>
<TabItem value="result" label="Result">
```json
{"event": "vertices_sorted", "data": {"ids": ["ChatInput-XtBLx"], "to_run": ["Prompt-x74Ze", "ChatOutput-ylMzN", "ChatInput-XtBLx", "OpenAIModel-d1wOZ"]}}

```json
{"event": "vertices_sorted", "data": {"ids": ["ChatInput-XtBLx"], "to_run": ["Prompt-x74Ze", "ChatOutput-ylMzN", "ChatInput-XtBLx", "OpenAIModel-d1wOZ"]}}
{"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"}}

{"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"}}
// ... Additional events as the flow executes ...

// ... Additional events as the flow executes ...
{"event": "end", "data": {}}
```

{"event": "end", "data": {}}
```

</TabItem>
</Tabs>
</details>

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

```text
```shell
curl -X GET \
"$LANGFLOW_URL/api/v1/build/123e4567-e89b-12d3-a456-426614174000/events?stream=false" \
-H "accept: application/json" \
Expand Down Expand Up @@ -115,7 +107,7 @@ The `/build` endpoint accepts optional values for `start_component_id` and `stop
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 OpenAI model component, run the following command:

```bash
```shell
curl -X POST \
"$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \
-H "accept: application/json" \
Expand All @@ -129,10 +121,7 @@ curl -X POST \
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.

<Tabs>
<TabItem value="curl" label="curl" default>

```bash
```shell
curl -X POST \
"$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \
-H "accept: application/json" \
Expand All @@ -150,15 +139,14 @@ curl -X POST \
}'
```

</TabItem>
<TabItem value="result" label="Result">
<details>
<summary>Result</summary>

```json
{ "job_id": "0bcc7f23-40b4-4bfa-9b8a-a44181fd1175" }
```

</TabItem>
</Tabs>
</details>

## See also

Expand Down
Loading