* langflow-webhook-auth-enable
* add-not-contains-filter-operator
* does-not-contains-operator
* less-redundant-explanation
* docs: add jq and path selection to data operations (#10083)
add-jq-and-path-to-data-operations
* smart transform historical names
* change back to smart transform
* jq expression capitalization/package name
* small edit for clarity of not contains operator
* read/write file component name changes
* docs: add smart router component (#10097)
* init
* add-to-release-notes
* remove-dynamic-output-as-parameter
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: screenshot audit (#10166)
* remove-unused
* agent-examples
* main-ui-screenshots
* components-screenshots
* combine-web-search-components
* simple-agent-flow-in-playground
* round-screenshots
* my-projects
* combine-data-components
* docs: component paths updates for lfx (#10130)
* contributing-bundles-path
* api-monitor-example
* concepts-components-page
* contribute-components-path
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: auto-add projects as MCP servers (#10096)
* add-mcp-auto-auth-as-default-behavior
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
* docs: amazon bedrock converse (#10289)
* use-bedrock-converse
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Update docs/docs/Components/bundles-amazon.mdx
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs 1.7 release: add mock data component (#10288)
* add-component-and-release-note
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: update custom component docs (#10323)
* add-partial
* update-lfx-component-paths
* move-partial
* completed-quickstart
* clean up intro
* try-docker-with-custom-mount
* up-to-typed-annotations
* typed-annotations
* dynamic-fields
* end-of-file
* bundles-naming
* chore: update component index
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* docs: add cometapi back for 1.7 release (#10445)
* add-comet-bundle-back-for-1.7
* add-comet-to-release-notes
* docs: add back docling remote vlm for release 1.7 (#10489)
* add-back-docling-vlm-content
* add-release-note
* docs: ALTK component (#10511)
* broken-anchor
* sidebar-and-page
* add-release-note
* add-context-on-output
* docs: SSRF warning (#10573)
* add-ssrf-protection-env-var
* api-request-component
* Update docs/docs/Components/components-data.mdx
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* move-note-to-table
* release-note
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: dynamic create data component (#10517)
* add-dynamic-create-data-component-and-release-note
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* clarify-message-types
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: cuga component bundle (#10589)
* initlal-content
* cuga-specific-component-connections
* cleanup
* use-the-same-name
* add-lite-mode-remove-api-flag-and-mode
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* public-or-private-internet
* agent-doesnt-check-urls
* peer-review
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: remove docling vlm component from 1.7 release branch (#10630)
remove-vlm-component
* docs: rename component categories and make all components single pages (#10648)
* docs: OpenAPI spec version upgraded from 1.6.5 to 1.6.8 (#10627)
Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
* up to models and agents
* sidebars
* fix-broken-links
* chore: Fix indentation on bundles-docling.mdx (#10640)
* sidebars
* redo-intros
* link-to-models
* data-components
* files-components-no-kb
* io-components
* helper-utility-components
* llm-ops-components
* logic-components
* processing-pages
* sidebars
* combine-legacy-components-into-one-page
* update-links
* remove-overview-pages-and-redirect
* make-mcp-tools-page
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* no-cap
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com>
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: combined web search component (#10664)
* combine-pages
* remove-rss-and-news-search-and-update-links
* remove-vlm-link
* leave-old-release-note-but-remove-link
* docs: add altk reflection component (#10660)
* add-new-component
* differentiate-components
* docs: mcp streamable http client (#10621)
* release note
* mcp-client-changes
* update-astra-example
* icons-and-copy
* order-of-names
* docs: add cuga decomposition strategy as advanced parameter (#10672)
* update-component-link
* init
* add-decomp-as-advanced-param
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* [autofix.ci] apply automated fixes (attempt 3/3)
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* update-component-index
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* [autofix.ci] apply automated fixes (attempt 3/3)
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: datastax bundles page (#10686)
* init
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: llm router changed to llm selector (#10663)
* update-component-name
* previous-name-and-release-note
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* [autofix.ci] apply automated fixes (attempt 3/3)
* docs: log alembic to stdout (#10711)
* docs-alembic-log-env-var
* cleanup
* remove-legacy-component-link
* docs: configure s3 for file storage backend (#10678)
* configure-file-storage-s3
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* clarify-s3-credentials
* add-storage-tags-and-cleanup-creds-seciton
* role-link-name
* fix-parse-error
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: allow rest tweaks to mcp tools component (#10833)
* typo
* tweak-mcp-tools-component
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* add-release-note
* docs: use mustache templates in prompts (#11262)
* mustache-templating
* syntax
* release-note
* peer-review
* docs: smart transform supports Message type (#11306)
* component-supports-message-type
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* peer-review
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: modular dependency imports for langflow-base (#11250)
* modular-base-dependencies
* syntax-and-clarification
* release-note
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* [autofix.ci] apply automated fixes
* clarify-base-and-langflow
* component-index
* delete-component-index
* [autofix.ci] apply automated fixes
* set-agentic-experience
* potential-breaking-changes
* not-audio-package
* cleanup-and-syntax
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* docs: symmetric and asymmetric JWT (#11159)
* initial-content
* cleanup
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* [autofix.ci] apply automated fixes
* docs-peer-review
* [autofix.ci] apply automated fixes
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* docs: add markdown output to url component (#11336)
* add-markdown-output-format
* raw-content
* Apply suggestions from code review
* docs: Add global variable support for MCP server headers (#11397)
* add-global-var-in-mcp-headers
* revert-curl-syntax-change
* remove-duplicate-tab
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* remove-code-block
* add-release-note
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Update docs/docs/Develop/install-custom-dependencies.mdx
* Update docs/docs/Develop/jwt-authentication.mdx
* docs: global model provider feature (#11231)
* initial-changes-to-model-providers
* add-icon-for-model-partial
* syntax
* adding-custom-language-model
* release-note
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* peer-review
* use-anthropic-model-with-agent
* [autofix.ci] apply automated fixes
* design-changes
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* mustache-limitations
* release-note-for-jwt
* docs: playground refactor and screenshots (#11639)
* screenshots
* new-playground-and-icon
* release-note
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: component inspection panel (#11675)
* docs-component-inspection-panel
* cleanup
* docs: add tool shortlisting and remove web_apps from CUGA component (#11669)
docs-add-shortlist-tools-and-remove-webapps-parameters
* fix-details-tab-error
* docs: workflow API draft build (#11323)
* delete-unused-yaml-file
* initial-content
* add-python-and-ts-to-example-requests
* separate-pages
* test-spec-presentation
* hide-async-and-make-workflows-plural
* fix-broken-link
* add-changes-to-async
* use-workflow-spec-from-sdk-build
* make-setup-partial
* add-fetch-script-for-openapi-spec
* update-workflows-spec
* remove-stream-for-now
* remove-reconnect-to-stream
* consolidate-pages
* remove-force-boolean
* [autofix.ci] apply automated fixes
* docs: add guardrails component (#11674)
* docs-add-guardrails-component
* cleanup
* example-and-heuristic-check
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* [autofix.ci] apply automated fixes
* add-note-about-llm
* add-release-note
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* docs: pass env var to run command and endpoint as header (#11447)
* pass-env-var-to-lfx
* add-env-var-passing-to-run-endpoint
* add-python-and-js-commands
* docs: responses api token usage tracking (#11564)
* initlal-content
* add-release-note
* changes-for-accessing-advanced-parameters
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* small-playground-changes
* [autofix.ci] apply automated fixes
* Revert "docs: OpenAPI spec content updated without version change (#11787)"
This reverts commit a0d5618ac9.
* [autofix.ci] apply automated fixes
* docs: add LiteLLM proxy bundle (#11867)
* docs-add-litellm-proxy-component
* Update docs/docs/Components/bundles-lite-llm.mdx
* docs: 1.8 changes from QA (#11998)
* remove-rightside-playground
* tutorials
* image-size-update
* component-release-notes
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: pass API keys to args and not env (#11997)
* remove-rightside-playground
* tutorials
* image-size-update
* docs-troubleshoot-mcp-proxy-header-keys
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: knowledge bases (#11924)
* docs-add-back-kb-content
* update-with-release-candidate-branch
* fix-linking-error
* remove-advanced-flag
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* add-release-note
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: traces v0 (#12014)
* env-var-release-note-and-sidebars
* traces-and-database
* traces-ui-and-api-retrieval
* cleanup
* space
* move-section
* move-what-traces-capture-section
* docs: remove kb ingestion and rename kb retrieval (#12065)
remove-knowledge-ingestion-and-rename-knowledge-retrieval
* docs: add link to secret key rotation script (#12072)
* add-link-to-secret-key-rotation
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: openlayer follow-on (#12073)
* add-openlayer-to-sidebars-and-release-notes
* Update docs/docs/Support/release-notes.mdx
---------
Co-authored-by: April M <36110273+aimurphy@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
529 lines
13 KiB
Plaintext
529 lines
13 KiB
Plaintext
---
|
|
title: Workflow API (Beta)
|
|
slug: /workflow-api
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
import PartialAPISetup from '@site/docs/_partial-api-setup.mdx';
|
|
|
|
:::warning Beta Feature
|
|
The Workflow API is currently in **Beta**.
|
|
The API endpoints and response formats may change in future releases.
|
|
:::
|
|
|
|
The Workflow API provides programmatic access to execute Langflow workflows synchronously or asynchronously.
|
|
Synchronous requests receive complete results immediately upon completion.
|
|
Asynchronous requests are queued in the background and will run until complete, or a request is issued to the [Stop Workflow endpoint](#stop-workflow-endpoint).
|
|
|
|
The Workflow API is part of the Langflow Developer v2 API and offers enhanced workflow execution capabilities compared to the v1 `/run` endpoint.
|
|
|
|
<PartialAPISetup />
|
|
|
|
## Execute workflows endpoint (synchronous or asynchronous)
|
|
|
|
**Endpoint:**
|
|
|
|
```
|
|
POST /api/v2/workflows
|
|
```
|
|
|
|
**Description:** Execute a workflow synchronously and receive complete results immediately upon completion.
|
|
Set `background=false` to make the request synchronous.
|
|
|
|
### Example synchronous request
|
|
|
|
Execute a workflow synchronously and receive complete results immediately:
|
|
|
|
<Tabs>
|
|
<TabItem value="Python" label="Python" default>
|
|
|
|
```python
|
|
import requests
|
|
|
|
url = f"{LANGFLOW_SERVER_URL}/api/v2/workflows"
|
|
headers = {
|
|
"Content-Type": "application/json",
|
|
"x-api-key": LANGFLOW_API_KEY
|
|
}
|
|
|
|
payload = {
|
|
"flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
|
|
"background": False,
|
|
"inputs": {
|
|
"ChatInput-abc.input_type": "chat",
|
|
"ChatInput-abc.input_value": "what is 2+2",
|
|
"ChatInput-abc.session_id": "session-123"
|
|
}
|
|
}
|
|
|
|
response = requests.post(url, json=payload, headers=headers)
|
|
print(response.json())
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="TypeScript" label="TypeScript">
|
|
|
|
```typescript
|
|
import axios from 'axios';
|
|
|
|
const url = `${LANGFLOW_SERVER_URL}/api/v2/workflows`;
|
|
|
|
const payload = {
|
|
flow_id: "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
|
|
background: false,
|
|
inputs: {
|
|
"ChatInput-abc.input_type": "chat",
|
|
"ChatInput-abc.input_value": "what is 2+2",
|
|
"ChatInput-abc.session_id": "session-123"
|
|
}
|
|
};
|
|
|
|
const runWorkflow = async () => {
|
|
try {
|
|
const response = await axios.post(url, payload, {
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'x-api-key': LANGFLOW_API_KEY
|
|
}
|
|
});
|
|
console.log(response.data);
|
|
} catch (error) {
|
|
console.error('Error triggering workflow:', error);
|
|
}
|
|
};
|
|
|
|
runWorkflow();
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="curl" label="curl">
|
|
|
|
```bash
|
|
curl -X POST \
|
|
"$LANGFLOW_SERVER_URL/api/v2/workflows" \
|
|
-H "Content-Type: application/json" \
|
|
-H "x-api-key: $LANGFLOW_API_KEY" \
|
|
-d '{
|
|
"flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
|
|
"background": false,
|
|
"inputs": {
|
|
"ChatInput-abc.input_type": "chat",
|
|
"ChatInput-abc.input_value": "what is 2+2",
|
|
"ChatInput-abc.session_id": "session-123"
|
|
}
|
|
}'
|
|
```
|
|
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
### Example asynchronous request
|
|
|
|
For long-running workflows, set `background=true` to get a `job_id` immediately, and then poll the status [using the GET endpoint](#get-workflow-status-endpoint) until the job is complete.
|
|
|
|
To stop a job, send a POST request to the [Stop workflow endpoint](#stop-workflow-endpoint).
|
|
|
|
:::tip
|
|
The asynchronous request contains `stream` parameter, but streaming is not yet supported. The parameter is included for future compatibility.
|
|
:::
|
|
|
|
**Example request:**
|
|
|
|
<Tabs>
|
|
<TabItem value="Python" label="Python" default>
|
|
|
|
```python
|
|
import requests
|
|
|
|
url = f"{LANGFLOW_SERVER_URL}/api/v2/workflows"
|
|
headers = {
|
|
"Content-Type": "application/json",
|
|
"x-api-key": LANGFLOW_API_KEY
|
|
}
|
|
|
|
payload = {
|
|
"flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
|
|
"background": True,
|
|
"stream": False,
|
|
"inputs": {
|
|
"ChatInput-abc.input_type": "chat",
|
|
"ChatInput-abc.input_value": "Process this in the background",
|
|
"ChatInput-abc.session_id": "session-456"
|
|
}
|
|
}
|
|
|
|
response = requests.post(url, json=payload, headers=headers)
|
|
print(response.json()) # Returns job_id immediately
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="TypeScript" label="TypeScript">
|
|
|
|
```typescript
|
|
import axios from 'axios';
|
|
|
|
const url = `${LANGFLOW_SERVER_URL}/api/v2/workflows`;
|
|
|
|
const payload = {
|
|
flow_id: "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
|
|
background: true,
|
|
stream: false,
|
|
inputs: {
|
|
"ChatInput-abc.input_type": "chat",
|
|
"ChatInput-abc.input_value": "Process this in the background",
|
|
"ChatInput-abc.session_id": "session-456"
|
|
}
|
|
};
|
|
|
|
const runWorkflow = async () => {
|
|
try {
|
|
const response = await axios.post(url, payload, {
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'x-api-key': LANGFLOW_API_KEY
|
|
}
|
|
});
|
|
console.log(response.data); // Returns job_id immediately
|
|
} catch (error) {
|
|
console.error('Error triggering workflow:', error);
|
|
}
|
|
};
|
|
|
|
runWorkflow();
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="curl" label="curl">
|
|
|
|
```bash
|
|
curl -X POST \
|
|
"$LANGFLOW_SERVER_URL/api/v2/workflows" \
|
|
-H "Content-Type: application/json" \
|
|
-H "x-api-key: $LANGFLOW_API_KEY" \
|
|
-d '{
|
|
"flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
|
|
"background": true,
|
|
"stream": false,
|
|
"inputs": {
|
|
"ChatInput-abc.input_type": "chat",
|
|
"ChatInput-abc.input_value": "Process this in the background",
|
|
"ChatInput-abc.session_id": "session-456"
|
|
}
|
|
}'
|
|
```
|
|
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
**Response:**
|
|
|
|
```json
|
|
{
|
|
"job_id": "job_id_1234567890",
|
|
"created_timestamp": "2025-01-15T10:30:00Z",
|
|
"status": "queued",
|
|
"errors": []
|
|
}
|
|
```
|
|
|
|
### Request body
|
|
|
|
| Field | Type | Required | Default | Description |
|
|
|-------|------|----------|---------|-------------|
|
|
| `flow_id` | `string` | Yes | - | The ID or endpoint name of the flow to execute. |
|
|
| `flow_version` | `string` | No | - | Optional version hash to pin to a specific flow version. |
|
|
| `background` | `boolean` | No | `false` | Must be `false` for synchronous execution. |
|
|
| `inputs` | `object` | No | `{}` | Inputs for the workflow execution. Uses component identifiers with dot notation (e.g., `ChatInput-abc.input_value`). See [Component identifiers and input structure](#component-identifiers-and-input-structure) for detailed information. |
|
|
|
|
### Example response
|
|
|
|
```json
|
|
{
|
|
"flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
|
|
"job_id": "job_id_1234567890",
|
|
"object": "response",
|
|
"created_at": 1741476542,
|
|
"status": "completed",
|
|
"errors": [],
|
|
"inputs": {
|
|
"ChatInput-abc.input_type": "chat",
|
|
"ChatInput-abc.input_value": "what is 2+2",
|
|
"ChatInput-abc.session_id": "session-123"
|
|
},
|
|
"outputs": {
|
|
"ChatOutput-xyz": {
|
|
"type": "message",
|
|
"component_id": "ChatOutput-xyz",
|
|
"status": "completed",
|
|
"content": "2 + 2 equals 4."
|
|
}
|
|
},
|
|
"metadata": {}
|
|
}
|
|
```
|
|
|
|
### Response body
|
|
|
|
The response includes an `outputs` field containing component-level results. Each output has a `type` field indicating the type of content:
|
|
|
|
| Type | Description | Example |
|
|
|------|-------------|---------|
|
|
| `message` | Text message content. | Chat responses, summaries |
|
|
| `image` | Image URL or data. | Generated images, processed images |
|
|
| `sql` | SQL query results. | Database query outputs |
|
|
| `data` | Structured data. | JSON objects, arrays |
|
|
| `file` | File reference. | Generated documents, reports |
|
|
|
|
## Get workflow status endpoint
|
|
|
|
**Endpoint:** `GET /api/v2/workflows`
|
|
|
|
**Description:** Retrieve the status and results of a workflow execution by job ID.
|
|
|
|
### Example request
|
|
|
|
<Tabs>
|
|
<TabItem value="Python" label="Python" default>
|
|
|
|
```python
|
|
import requests
|
|
|
|
url = f"{LANGFLOW_SERVER_URL}/api/v2/workflows"
|
|
params = {
|
|
"job_id": "job_id_1234567890"
|
|
}
|
|
headers = {
|
|
"accept": "application/json",
|
|
"x-api-key": LANGFLOW_API_KEY
|
|
}
|
|
|
|
response = requests.get(url, params=params, headers=headers)
|
|
print(response.json())
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="TypeScript" label="TypeScript">
|
|
|
|
```typescript
|
|
import axios from 'axios';
|
|
|
|
const jobId = 'job_id_1234567890';
|
|
const url = `${LANGFLOW_SERVER_URL}/api/v2/workflows`;
|
|
|
|
const getWorkflowStatus = async () => {
|
|
try {
|
|
const response = await axios.get(url, {
|
|
params: {
|
|
job_id: jobId
|
|
},
|
|
headers: {
|
|
'accept': 'application/json',
|
|
'x-api-key': LANGFLOW_API_KEY
|
|
}
|
|
});
|
|
console.log(response.data);
|
|
} catch (error) {
|
|
console.error('Error getting workflow status:', error);
|
|
}
|
|
};
|
|
|
|
getWorkflowStatus();
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="curl" label="curl">
|
|
|
|
```bash
|
|
curl -X GET \
|
|
"$LANGFLOW_SERVER_URL/api/v2/workflows?job_id=job_id_1234567890" \
|
|
-H "accept: application/json" \
|
|
-H "x-api-key: $LANGFLOW_API_KEY"
|
|
```
|
|
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
### Query parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
|-----------|------|----------|-------------|
|
|
| `job_id` | `string` | Yes | The job ID returned from a workflow execution. |
|
|
| `stream` | `boolean` | No | If `true`, returns server-sent events stream. Default: `false`. |
|
|
| `sequence_id` | `integer` | No | Optional sequence ID to resume streaming from a specific point. |
|
|
|
|
### Example response
|
|
|
|
```json
|
|
{
|
|
"flow_id": "flow_67ccd2be17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
|
|
"job_id": "job_id_1234567890",
|
|
"object": "response",
|
|
"created_at": 1741476542,
|
|
"status": "completed",
|
|
"errors": [],
|
|
"outputs": {
|
|
"ChatOutput-xyz": {
|
|
"type": "message",
|
|
"component_id": "ChatOutput-xyz",
|
|
"status": "completed",
|
|
"content": "Processing complete..."
|
|
}
|
|
},
|
|
"input": [
|
|
{
|
|
"type": "text",
|
|
"data": "Input text prompt for the workflow execution",
|
|
"role": "User"
|
|
}
|
|
],
|
|
"metadata": {}
|
|
}
|
|
```
|
|
|
|
### Response body
|
|
|
|
The response includes a `status` field that indicates the current state of the workflow execution:
|
|
|
|
| Status | Description |
|
|
|--------|-------------|
|
|
| `queued` | Job is queued and waiting to start. |
|
|
| `in_progress` | Job is currently executing. |
|
|
| `completed` | Job completed successfully. |
|
|
| `failed` | Job failed during execution. |
|
|
| `error` | Job encountered an error. |
|
|
|
|
## Stop workflow endpoint
|
|
|
|
**Endpoint:** `POST /api/v2/workflows/stop`
|
|
|
|
**Description:** Stop a running workflow execution by job ID.
|
|
|
|
### Example request
|
|
|
|
<Tabs>
|
|
<TabItem value="Python" label="Python" default>
|
|
|
|
```python
|
|
import requests
|
|
|
|
url = f"{LANGFLOW_SERVER_URL}/api/v2/workflows/stop"
|
|
headers = {
|
|
"Content-Type": "application/json",
|
|
"x-api-key": LANGFLOW_API_KEY
|
|
}
|
|
payload = {
|
|
"job_id": "job_id_1234567890"
|
|
}
|
|
|
|
response = requests.post(url, json=payload, headers=headers)
|
|
print(response.json())
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="TypeScript" label="TypeScript">
|
|
|
|
```typescript
|
|
import axios from 'axios';
|
|
|
|
const url = `${LANGFLOW_SERVER_URL}/api/v2/workflows/stop`;
|
|
|
|
const payload = {
|
|
job_id: "job_id_1234567890"
|
|
};
|
|
|
|
const stopWorkflow = async () => {
|
|
try {
|
|
const response = await axios.post(url, payload, {
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'x-api-key': LANGFLOW_API_KEY
|
|
}
|
|
});
|
|
console.log(response.data);
|
|
} catch (error) {
|
|
console.error('Error stopping workflow:', error);
|
|
}
|
|
};
|
|
|
|
stopWorkflow();
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="curl" label="curl">
|
|
|
|
```bash
|
|
curl -X POST \
|
|
"$LANGFLOW_SERVER_URL/api/v2/workflows/stop" \
|
|
-H "Content-Type: application/json" \
|
|
-H "x-api-key: $LANGFLOW_API_KEY" \
|
|
-d '{
|
|
"job_id": "job_id_1234567890"
|
|
}'
|
|
```
|
|
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
### Request body
|
|
|
|
| Field | Type | Required | Default | Description |
|
|
|-------|------|----------|---------|-------------|
|
|
| `job_id` | `string` | Yes | - | The job ID of the workflow to stop. |
|
|
|
|
### Example response
|
|
|
|
```json
|
|
{
|
|
"job_id": "job_id_1234567890",
|
|
"message": "Job job_id_1234567890 cancelled successfully."
|
|
}
|
|
```
|
|
|
|
## Component identifiers and input structure
|
|
|
|
The Workflows API uses component identifiers with dot notation to specify inputs for individual components in your workflow. This allows you to pass values to specific components and override component parameters.
|
|
|
|
Component identifiers use the format `{component_id}.{parameter_name}`.
|
|
When making requests to the Workflows API, include component identifiers in the `inputs` object.
|
|
For example, this demonstrates targeting multiple components and their parameters in a single request.
|
|
|
|
```json
|
|
{
|
|
"flow_id": "your-flow-id",
|
|
"inputs": {
|
|
"ChatInput-abc.input_type": "chat",
|
|
"ChatInput-abc.input_value": "what is 2+2",
|
|
"ChatInput-abc.session_id": "session-123",
|
|
"OpenSearchComponent-xyz.opensearch_url": "https://opensearch:9200",
|
|
"LLMComponent-123.temperature": 0.7,
|
|
"LLMComponent-123.max_tokens": 100
|
|
}
|
|
}
|
|
```
|
|
|
|
To find the component ID in the Langflow UI, open your flow in Langflow, click the component, and then click **Controls**. The component ID is at the top of the **Controls** pane.
|
|
|
|
You can override any component's parameters.
|
|
|
|
## Error handling
|
|
|
|
The API uses standard HTTP status codes to indicate success or failure:
|
|
|
|
| Status Code | Description |
|
|
|-------------|-------------|
|
|
| `200 OK` | Request successful. |
|
|
| `400 Bad Request` | Invalid request parameters. |
|
|
| `401 Unauthorized` | Invalid or missing API key. |
|
|
| `404 Not Found` | Flow not found or developer API disabled. |
|
|
| `500 Internal Server Error` | Server error during execution. |
|
|
| `501 Not Implemented` | Endpoint not yet implemented. |
|
|
|
|
### Error response format
|
|
|
|
```json
|
|
{
|
|
"detail": "Error message describing what went wrong"
|
|
}
|
|
```
|