openapi: 3.1.0
info:
title: Langflow Base API
version: 1.9.0
tags:
- name: Base
paths:
/api/v1/all:
get:
description: Retrieve all component types with compression for better performance.
Returns a compressed response containing all available component types.
operationId: get_all_api_v1_all_get
responses:
'200':
content:
application/json:
schema: {}
description: Successful Response
security:
- OAuth2PasswordBearerCookie: []
- API key query: []
- API key header: []
summary: Get All
tags:
- Base
/api/v1/config:
get:
description: 'Retrieve application configuration settings.
Returns different configuration based on authentication status:
- Authenticated users: Full ConfigResponse with all settings
- Unauthenticated users: PublicConfigResponse with limited, safe-to-expose settings
Args:
user: The authenticated user, or None if unauthenticated.
Returns:
ConfigResponse | PublicConfigResponse: Configuration settings appropriate for the user''s auth status.
Raises:
HTTPException: If an error occurs while retrieving the configuration.'
operationId: get_config_api_v1_config_get
responses:
'200':
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ConfigResponse'
- $ref: '#/components/schemas/PublicConfigResponse'
title: Response Get Config Api V1 Config Get
description: Successful Response
security:
- OAuth2PasswordBearerCookie: []
- API key query: []
- API key header: []
summary: Get Config
tags:
- Base
/api/v1/run/advanced/{flow_id_or_name}:
post:
description: 'Executes a specified flow by ID with optional input values, output selection, tweaks, and streaming capability.
This endpoint supports running flows with caching to enhance performance and efficiency.
### Parameters:
- `flow` (Flow): The flow object to be executed, resolved via dependency injection.
- `inputs` (List[InputValueRequest], optional): A list of inputs specifying the input values and components
for the flow. Each input can target specific components and provide custom values.
- `outputs` (List[str], optional): A list of output names to retrieve from the executed flow.
If not provided, all outputs are returned.
- `tweaks` (Optional[Tweaks], optional): A dictionary of tweaks to customize the flow execution.
The tweaks can be used to modify the flow''s parameters and components.
Tweaks can be overridden by the input values.
- `stream` (bool, optional): Specifies whether the results should be streamed. Defaults to False.
- `session_id` (Union[None, str], optional): An optional session ID to utilize existing session data for the flow
execution.
- `api_key_user` (User): The user associated with the current API key. Automatically resolved from the API key.
### Returns:
A `RunResponse` object containing the selected outputs (or all if not specified) of the executed flow
and the session ID.
The structure of the response accommodates multiple inputs, providing a nested list of outputs for each input.
### Raises:
HTTPException: Indicates issues with finding the specified flow, invalid input formats, or internal errors during
flow execution.
### Example usage:
```json
POST /run/flow_id
x-api-key: YOUR_API_KEY
Payload:
{
"inputs": [
{"components": ["component1"], "input_value": "value1"},
{"components": ["component3"], "input_value": "value2"}
],
"outputs": ["Component Name", "component_id"],
"tweaks": {"parameter_name": "value", "Component Name": {"parameter_name": "value"}, "component_id": {"parameter_name": "value"}}
"stream": false
}
```
This endpoint facilitates complex flow executions with customized inputs, outputs, and configurations,
catering to diverse application requirements.'
operationId: experimental_run_flow_api_v1_run_advanced__flow_id_or_name__post
parameters:
- in: path
name: flow_id_or_name
required: true
schema:
title: Flow Id Or Name
type: string
- in: query
name: user_id
required: false
schema:
anyOf:
- type: string
- format: uuid
type: string
- type: 'null'
title: User Id
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Body_experimental_run_flow_api_v1_run_advanced__flow_id_or_name__post'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/RunResponse'
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
security:
- API key query: []
- API key header: []
summary: Experimental Run Flow
tags:
- Base
/api/v1/run/{flow_id_or_name}:
post:
description: 'Executes a specified flow by ID with support for streaming and telemetry (API key auth).
This endpoint executes a flow identified by ID or name, with options for streaming the response
and tracking execution metrics. It handles both streaming and non-streaming execution modes.
This endpoint uses API key authentication (Bearer token).
Args:
background_tasks (BackgroundTasks): FastAPI background task manager
flow (FlowRead | None): The flow to execute, loaded via dependency
input_request (SimplifiedAPIRequest | None): Input parameters for the flow
stream (bool): Whether to stream the response
api_key_user (UserRead): Authenticated user from API key
context (dict | None): Optional context to pass to the flow
http_request (Request): The incoming HTTP request for extracting global variables
Returns:
Union[StreamingResponse, RunResponse]: Either a streaming response for real-time results
or a RunResponse with the complete execution results
Raises:
HTTPException: For flow not found (404) or invalid input (400)
APIException: For internal execution errors (500)
Notes:
- Supports both streaming and non-streaming execution modes
- Tracks execution time and success/failure via telemetry
- Handles graceful client disconnection in streaming mode
- Provides detailed error handling with appropriate HTTP status codes
- Extracts global variables from HTTP headers with prefix X-LANGFLOW-GLOBAL-VAR-*
- Merges extracted variables with the context parameter as "request_variables"
- In streaming mode, uses EventManager to handle events:
- "add_message": New messages during execution
- "token": Individual tokens during streaming
- "end": Final execution result
- Authentication: Requires API key (Bearer token)'
operationId: simplified_run_flow_api_v1_run__flow_id_or_name__post
parameters:
- in: path
name: flow_id_or_name
required: true
schema:
title: Flow Id Or Name
type: string
- in: query
name: stream
required: false
schema:
default: false
title: Stream
type: boolean
- in: query
name: user_id
required: false
schema:
anyOf:
- type: string
- format: uuid
type: string
- type: 'null'
title: User Id
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Body_simplified_run_flow_api_v1_run__flow_id_or_name__post'
responses:
'200':
content:
application/json:
schema: {}
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
security:
- API key query: []
- API key header: []
summary: Simplified Run Flow
tags:
- Base
/api/v1/version:
get:
operationId: get_version_api_v1_version_get
responses:
'200':
content:
application/json:
schema: {}
description: Successful Response
summary: Get Version
tags:
- Base
/api/v1/webhook/{flow_id_or_name}:
post:
description: 'Run a flow using a webhook request.
Args:
flow_id_or_name: The flow ID or endpoint name (used by dependency).
flow: The flow to be executed.
request: The incoming HTTP request.
Returns:
A dictionary containing the status of the task.
Raises:
HTTPException: If the flow is not found or if there is an error processing the request.'
operationId: webhook_run_flow_api_v1_webhook__flow_id_or_name__post
parameters:
- in: path
name: flow_id_or_name
required: true
schema:
title: Flow Id Or Name
type: string
- in: query
name: user_id
required: false
schema:
anyOf:
- type: string
- format: uuid
type: string
- type: 'null'
title: User Id
responses:
'202':
content:
application/json:
schema:
additionalProperties: true
title: Response Webhook Run Flow Api V1 Webhook Flow Id Or Name Post
type: object
description: Successful Response
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
description: Validation Error
summary: Webhook Run Flow
tags:
- Base
components:
schemas:
RunOutputs:
properties:
inputs:
additionalProperties: true
title: Inputs
type: object
outputs:
items:
anyOf:
- $ref: '#/components/schemas/ResultData'
- type: 'null'
title: Outputs
type: array
title: RunOutputs
type: object
RunResponse:
description: Run response schema.
properties:
outputs:
anyOf:
- items:
$ref: '#/components/schemas/RunOutputs'
type: array
- type: 'null'
default: []
title: Outputs
session_id:
anyOf:
- type: string
- type: 'null'
title: Session Id
title: RunResponse
type: object
Usage:
description: Token usage information from LLM responses.
properties:
input_tokens:
anyOf:
- type: integer
- type: 'null'
title: Input Tokens
output_tokens:
anyOf:
- type: integer
- type: 'null'
title: Output Tokens
total_tokens:
anyOf:
- type: integer
- type: 'null'
title: Total Tokens
title: Usage
type: object
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
title: Detail
type: array
title: HTTPValidationError
type: object
PublicConfigResponse:
description: 'Configuration response for public/unauthenticated endpoints like the public playground.
Contains only the configuration values needed for public features, without sensitive data.
The ''type'' field is a discriminator to distinguish from full ConfigResponse.'
properties:
allow_custom_components:
title: Allow Custom Components
type: boolean
event_delivery:
enum:
- polling
- streaming
- direct
title: Event Delivery
type: string
feature_flags:
$ref: '#/components/schemas/FeatureFlags'
frontend_timeout:
title: Frontend Timeout
type: integer
max_file_size_upload:
title: Max File Size Upload
type: integer
mcp_base_url:
title: Mcp Base Url
type: string
type:
const: public
default: public
title: Type
type: string
voice_mode_available:
title: Voice Mode Available
type: boolean
required:
- feature_flags
- max_file_size_upload
- event_delivery
- voice_mode_available
- frontend_timeout
- mcp_base_url
- allow_custom_components
title: PublicConfigResponse
type: object
FeatureFlags:
additionalProperties: false
properties:
mvp_components:
default: false
title: Mvp Components
type: boolean
wxo_deployments:
default: false
title: Wxo Deployments
type: boolean
title: FeatureFlags
type: object
ChatOutputResponse:
description: Chat output response schema.
properties:
component_id:
anyOf:
- type: string
- type: 'null'
title: Component Id
files:
default: []
items:
$ref: '#/components/schemas/lfx__utils__schemas__File'
title: Files
type: array
message:
anyOf:
- type: string
- items:
anyOf:
- type: string
- additionalProperties: true
type: object
type: array
title: Message
sender:
anyOf:
- type: string
- type: 'null'
default: Machine
title: Sender
sender_name:
anyOf:
- type: string
- type: 'null'
default: AI
title: Sender Name
session_id:
anyOf:
- type: string
- type: 'null'
title: Session Id
stream_url:
anyOf:
- type: string
- type: 'null'
title: Stream Url
type:
title: Type
type: string
required:
- message
- type
title: ChatOutputResponse
type: object
Tweaks:
additionalProperties:
anyOf:
- type: string
- additionalProperties: true
type: object
description: A dictionary of tweaks to adjust the flow's execution. Allows customizing flow behavior dynamically. All tweaks are overridden by the input values.
examples:
- Component Name:
parameter_name: value
component_id:
parameter_name: value
parameter_name: value
title: Tweaks
type: object
ConfigResponse:
description: 'Full configuration response for authenticated users.
The ''type'' field is a discriminator to distinguish from PublicConfigResponse.'
properties:
allow_custom_components:
title: Allow Custom Components
type: boolean
auto_saving:
title: Auto Saving
type: boolean
auto_saving_interval:
title: Auto Saving Interval
type: integer
default_folder_name:
title: Default Folder Name
type: string
event_delivery:
enum:
- polling
- streaming
- direct
title: Event Delivery
type: string
feature_flags:
$ref: '#/components/schemas/FeatureFlags'
frontend_timeout:
title: Frontend Timeout
type: integer
health_check_max_retries:
title: Health Check Max Retries
type: integer
hide_getting_started_progress:
title: Hide Getting Started Progress
type: boolean
max_file_size_upload:
title: Max File Size Upload
type: integer
mcp_base_url:
title: Mcp Base Url
type: string
public_flow_cleanup_interval:
title: Public Flow Cleanup Interval
type: integer
public_flow_expiration:
title: Public Flow Expiration
type: integer
serialization_max_items_length:
title: Serialization Max Items Length
type: integer
serialization_max_text_length:
title: Serialization Max Text Length
type: integer
type:
const: full
default: full
title: Type
type: string
voice_mode_available:
title: Voice Mode Available
type: boolean
webhook_auth_enable:
title: Webhook Auth Enable
type: boolean
webhook_polling_interval:
title: Webhook Polling Interval
type: integer
required:
- feature_flags
- max_file_size_upload
- event_delivery
- voice_mode_available
- frontend_timeout
- mcp_base_url
- serialization_max_items_length
- serialization_max_text_length
- auto_saving
- auto_saving_interval
- health_check_max_retries
- webhook_polling_interval
- public_flow_cleanup_interval
- public_flow_expiration
- webhook_auth_enable
- default_folder_name
- hide_getting_started_progress
- allow_custom_components
title: ConfigResponse
type: object
ValidationError:
properties:
ctx:
title: Context
type: object
input:
title: Input
loc:
items:
anyOf:
- type: string
- type: integer
title: Location
type: array
msg:
title: Message
type: string
type:
title: Error Type
type: string
required:
- loc
- msg
- type
title: ValidationError
type: object
SimplifiedAPIRequest:
properties:
input_type:
anyOf:
- enum:
- chat
- text
- any
type: string
- type: 'null'
default: chat
description: The input type
title: Input Type
input_value:
anyOf:
- type: string
- type: 'null'
description: The input value
title: Input Value
output_component:
anyOf:
- type: string
- type: 'null'
default: ''
description: If there are multiple output components, you can specify the component to get the output from.
title: Output Component
output_type:
anyOf:
- enum:
- chat
- text
- any
- debug
type: string
- type: 'null'
default: chat
description: The output type
title: Output Type
session_id:
anyOf:
- type: string
- type: 'null'
description: The session id
title: Session Id
tweaks:
anyOf:
- $ref: '#/components/schemas/Tweaks'
- type: 'null'
description: The tweaks
title: SimplifiedAPIRequest
type: object
lfx__utils__schemas__File:
description: File schema.
properties:
name:
title: Name
type: string
path:
title: Path
type: string
type:
title: Type
type: string
required:
- path
- name
- type
title: File
type: object
InputValueRequest:
additionalProperties: false
examples:
- components:
- components_id
- Component Name
input_value: input_value
session: session_id
- components:
- Component Name
input_value: input_value
- input_value: input_value
- components:
- Component Name
input_value: input_value
session: session_id
- input_value: input_value
session: session_id
- input_value: input_value
type: chat
- input_value: '{"key": "value"}'
type: json
properties:
client_request_time:
anyOf:
- type: integer
- type: 'null'
description: Client-side timestamp in milliseconds when the request was initiated. Used to calculate accurate end-to-end duration.
title: Client Request Time
components:
anyOf:
- items:
type: string
type: array
- type: 'null'
default: []
title: Components
input_value:
anyOf:
- type: string
- type: 'null'
title: Input Value
session:
anyOf:
- type: string
- type: 'null'
title: Session
type:
anyOf:
- enum:
- chat
- text
- any
type: string
- type: 'null'
default: any
description: Defines on which components the input value should be applied. 'any' applies to all input components.
title: Type
title: InputValueRequest
type: object
Body_simplified_run_flow_api_v1_run__flow_id_or_name__post:
properties:
context:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Context
input_request:
anyOf:
- $ref: '#/components/schemas/SimplifiedAPIRequest'
- type: 'null'
title: Body_simplified_run_flow_api_v1_run__flow_id_or_name__post
type: object
Body_experimental_run_flow_api_v1_run_advanced__flow_id_or_name__post:
properties:
inputs:
anyOf:
- items:
$ref: '#/components/schemas/InputValueRequest'
type: array
- type: 'null'
title: Inputs
outputs:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Outputs
session_id:
anyOf:
- type: string
- type: 'null'
title: Session Id
stream:
default: false
title: Stream
type: boolean
tweaks:
anyOf:
- $ref: '#/components/schemas/Tweaks'
- type: 'null'
title: Body_experimental_run_flow_api_v1_run_advanced__flow_id_or_name__post
type: object
ResultData:
properties:
artifacts:
anyOf:
- {}
- type: 'null'
title: Artifacts
component_display_name:
anyOf:
- type: string
- type: 'null'
title: Component Display Name
component_id:
anyOf:
- type: string
- type: 'null'
title: Component Id
duration:
anyOf:
- type: string
- type: 'null'
title: Duration
logs:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Logs
messages:
anyOf:
- items:
$ref: '#/components/schemas/ChatOutputResponse'
type: array
- type: 'null'
title: Messages
outputs:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Outputs
results:
anyOf:
- {}
- type: 'null'
title: Results
timedelta:
anyOf:
- type: number
- type: 'null'
title: Timedelta
token_usage:
anyOf:
- $ref: '#/components/schemas/Usage'
- type: 'null'
used_frozen_result:
anyOf:
- type: boolean
- type: 'null'
default: false
title: Used Frozen Result
title: ResultData
type: object
securitySchemes:
API key header:
in: header
name: x-api-key
type: apiKey
API key query:
in: query
name: x-api-key
type: apiKey
OAuth2PasswordBearerCookie:
flows:
password:
scopes: {}
tokenUrl: api/v1/login
type: oauth2