Skip to main content

Deploy a public Langflow server

By default, your Langflow server at http://localhost:7860 isn't exposed to the public internet. However, you can forward Langflow server traffic with a forwarding platform like ngrok or zrok to make your server public.

When your Langflow server is public, you can do things like deploy your Langflow MCP server externally, serve API requests, and share your playground externally.

Prerequisites

Expose your Langflow server with ngrok

  1. Start Langflow:


    _10
    uv run langflow run

  2. In another terminal window, use your ngrok authtoken to authenticate your local ngrok server:


    _10
    ngrok config add-authtoken NGROK_AUTHTOKEN

  3. Use ngrok to expose your Langflow server to the public internet:


    _10
    ngrok http http://localhost:7860

    This example assumes that you use the default Langflow listening address at http://localhost:7860. If you have a different listening address, you must modify this command accordingly.

    The ngrok session starts in your terminal and deploys an ephemeral domain with no authentication. To add authentication or deploy a static domain, see the ngrok documentation.

    The Forwarding line prints the forwarding address for your Langflow server:


    _10
    Forwarding https://94b1-76-64-171-14.ngrok-free.app -> http://localhost:7860

    The forwarding address acts as a reverse proxy for your Langflow server, and ngrok forwards your local traffic to this domain.

  4. To verify that your Langflow server is publicly available, navigate to the forwarding address URL, such as https://94b1-76-64-171-14.ngrok-free.app.

Use a public Langflow server

When your Langflow server is public, you can do things like deploy your Langflow MCP server externally, serve API requests, and share a Playground as a public website.

Deploy your MCP server externally

After you deploy a public Langflow server, you can also access your Langflow projects' MCP servers publicly.

To do this, use your server's forwarding address when you connect a client to a Langflow MCP server.

Serve API requests

To send requests to a public Langflow server's Langflow API endpoints, use the server's domain as the base URL for your API requests. For example:


_10
curl -X POST \
_10
"$PUBLIC_SERVER_DOMAIN/api/v1/webhook/$FLOW_ID" \
_10
-H "Content-Type: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
-d '{"data": "example-data"}'

tip

For flows created on public Langflow servers, the code snippets generated in the API access pane automatically use your public server's domain.

You also use your public domain when making Langflow API calls in scripts, including the code snippets that are automatically generated by Langflow. For example, the following code snippet calls an ngrok domain to trigger the specified flow (d764c4b8...):


_29
import requests
_29
_29
url = "https://3f7c-73-64-93-151.ngrok-free.app/api/v1/run/d764c4b8-5cec-4c0f-9de0-4b419b11901a" # The complete API endpoint URL for this flow
_29
_29
# Request payload configuration
_29
payload = {
_29
"output_type": "chat",
_29
"input_type": "chat",
_29
"input_value": "Hello"
_29
}
_29
_29
# Request headers
_29
headers = {
_29
"Content-Type": "application/json",
_29
"x-api-key: $LANGFLOW_API_KEY"
_29
}
_29
_29
try:
_29
# Send API request
_29
response = requests.request("POST", url, json=payload, headers=headers)
_29
response.raise_for_status() # Raise exception for bad status codes
_29
_29
# Print response
_29
print(response.text)
_29
_29
except requests.exceptions.RequestException as e:
_29
print(f"Error making API request: {e}")
_29
except ValueError as e:
_29
print(f"Error parsing response: {e}")

For a demo of the Langflow API in a script, see the Quickstart.

Share your playground externally

The Shareable playground option exposes the Playground for a single flow at the /public_flow/{flow-id} endpoint.

This allows you to share a public URL with another user that displays only the Playground chat window for the specified flow.

The user can interact with the flow's chat input and output and view the results without requiring a Langflow installation or API keys of their own.

important

The Sharable Playground is for testing purposes only.

The Playground isn't meant for embedding flows in applications. For information about running flows in applications or websites, see About developing and configuring Langflow applications and Publish flows.

To share a flow's Playground with another user, do the following:

  1. In Langflow, open the flow you want share.
  2. From the Workspace, click Share, and then enable Shareable Playground.
  3. Click Shareable Playground again to open the Playground window. This window's URL is the flow's Sharable Playground address, such as https://3f7c-73-64-93-151.ngrok-free.app/playground/d764c4b8-5cec-4c0f-9de0-4b419b11901a.
  4. Send the URL to another user to give them access to the flow's Playground.
Search