docs/versioned_docs/version-1.9.0/_partial-api-setup.mdx
Before using the API, you need:
Install and start Langflow with the developer API enabled
The Workflows API endpoints require the developer_api_enabled setting to be enabled. If this setting is disabled, these endpoints will return a 404 Not Found error.
To enable the developer API endpoint, do the following:
.env file, set the environment variable to true:
LANGFLOW_DEVELOPER_API_ENABLED=true
.env file enabled:
uv run langflow run --env-file .env
For more information about configuring environment variables, see Environment variables.
Create a flow that you want to execute
Get the flow ID or endpoint name of the flow you want to execute
All code examples in this documentation assume you have set the following environment variables:
Python:
import os
LANGFLOW_SERVER_URL = os.getenv("LANGFLOW_SERVER_URL")
LANGFLOW_API_KEY = os.getenv("LANGFLOW_API_KEY")
TypeScript/JavaScript:
const LANGFLOW_SERVER_URL = process.env.LANGFLOW_SERVER_URL;
const LANGFLOW_API_KEY = process.env.LANGFLOW_API_KEY;
Set these environment variables before running the examples, or replace the variable references in the code examples with your actual Langflow server URL and API key.
The default LANGFLOW_SERVER_URL for a local Langflow deployment is http://localhost:7860.
For remote deployments, the domain is set by your hosting service, such as https://UUID.ngrok.app.
All Workflows API requests require authentication using a Langflow API key. The API key is passed in the x-api-key header.
For more information, see Create a Langflow API key.
| Header | Description | Example |
|---|---|---|
Content-Type | Specifies the JSON format. | application/json |
x-api-key | Your Langflow API key. | sk-... |
accept | Optional. Specifies the response format. | application/json |