Back to Langflow

Partial Api Setup

docs/versioned_docs/version-1.9.0/_partial-api-setup.mdx

1.10.0.dev202.2 KB
Original Source

Prerequisites

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:

    1. In the Langflow .env file, set the environment variable to true:
      LANGFLOW_DEVELOPER_API_ENABLED=true
      
    2. Start your Langflow server with the .env file enabled:
      uv run langflow run --env-file .env
      

    For more information about configuring environment variables, see Environment variables.

  • Create a Langflow API key

  • Create a flow that you want to execute

  • Get the flow ID or endpoint name of the flow you want to execute

Set environment variables

All code examples in this documentation assume you have set the following environment variables:

Python:

python
import os

LANGFLOW_SERVER_URL = os.getenv("LANGFLOW_SERVER_URL")
LANGFLOW_API_KEY = os.getenv("LANGFLOW_API_KEY")

TypeScript/JavaScript:

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

Authentication and headers

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.

HeaderDescriptionExample
Content-TypeSpecifies the JSON format.application/json
x-api-keyYour Langflow API key.sk-...
acceptOptional. Specifies the response format.application/json