Import and export flows
You can export flows to transfer them between Langflow instances, share them with others, or create backups.
Export a flow
There are three ways to export a flow:
- From the Projects page, find the flow you want to export, click More, and then select Export.
- When editing a flow, click Share, and then click Export.
- Use the Langflow API
/flows/download
endpoint.
An exported flow is downloaded to your local machine as a JSON file named FLOW_NAME.json
.
For more information, see Langflow JSON file contents.
Save with my API keys
When exporting from the Langflow UI, you can select Save with my API keys to export the flow and any defined API key variables. Non-API key variables are included in the export regardless of the Save with my API keys setting.
If you directly entered the key value into a component's API key field, then Save with my API keys exports the literal key value.
If your key is stored in a Langflow global variable, Save with my API keys exports only the variable name.
When you or another user import the flow to another Langflow instance, that instance must have Langflow global variables with the same names and valid values in order to run the flow successfully. If any variables are missing or invalid, those variables must be created or edited after importing the flow.
Export all flows
If you want to export all flows within a project, do either of the following:
- Go to the Projects page, find the project you want to export, click Options, and then select Download.
- Use the Langflow API
/projects/download
endpoint.
The project's flows are downloaded as JSON files in a zip archive.
Import a flow
You can import Langflow JSON files from your local machine in the following ways:
- From the Projects page, click Upload a flow.
- Drag and drop Langflow JSON files from your file explorer into your Langflow window to import a flow from any Langflow page.
- Use the Langflow API
/flows/upload/
endpoint to upload one JSON file. - Use the Langflow API
/projects/upload
endpoint to upload a Langflow project zip file.
Run an imported flow
Once imported, your flow is ready to use. If the flow contains any global variables, make sure your Langflow instance has global variables with the same names and valid values. For more information, see Save with my API keys.
Langflow JSON file contents
An exported flow is downloaded to your local machine as a JSON file named FLOW_NAME.json
.
Langflow JSON files contain nodes and edges that describe components and connections, and additional metadata that describe the flow.
For an example Langflow JSON file, examine the Basic Prompting.json file in the Langflow repository.
Nodes
Nodes represent the components that make up the flow. For example, this object represents a Chat Input component:
_35{_35 "data": {_35 "description": "Get chat inputs from the Playground.",_35 "display_name": "Chat Input",_35 "id": "ChatInput-jFwUm",_35 "node": {_35 "base_classes": ["Message"],_35 "description": "Get chat inputs from the Playground.",_35 "display_name": "Chat Input",_35 "icon": "MessagesSquare",_35 "template": {_35 "input_value": {_35 "display_name": "Text",_35 "info": "Message to be passed as input.",_35 "value": "Hello"_35 },_35 "sender": {_35 "value": "User",_35 "options": ["Machine", "User"]_35 },_35 "sender_name": {_35 "value": "User"_35 },_35 "should_store_message": {_35 "value": true_35 }_35 }_35 },_35 "type": "ChatInput"_35 },_35 "position": {_35 "x": 689.5720422421635,_35 "y": 765.155834131403_35 }_35}
Each node has a unique identifier in the format of NODE_NAME-UUID
, such as ChatInput-jFwUm
.
Entrypoint nodes, such as the ChatInput
node, are the first node executed when running a flow.
Edges
Edges represent the connections between nodes.
The connection between the ChatInput
node and the OpenAIModel
node is represented as an edge:
_22{_22 "className": "",_22 "data": {_22 "sourceHandle": {_22 "dataType": "ChatInput",_22 "id": "ChatInput-jFwUm",_22 "name": "message",_22 "output_types": ["Message"]_22 },_22 "targetHandle": {_22 "fieldName": "input_value",_22 "id": "OpenAIModel-OcXkl",_22 "inputTypes": ["Message"],_22 "type": "str"_22 }_22 },_22 "id": "reactflow__edge-ChatInput-jFwUm{œdataTypeœ:œChatInputœ,œidœ:œChatInput-jFwUmœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-OpenAIModel-OcXkl{œfieldNameœ:œinput_valueœ,œidœ:œOpenAIModel-OcXklœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",_22 "source": "ChatInput-jFwUm",_22 "sourceHandle": "{œdataTypeœ: œChatInputœ, œidœ: œChatInput-jFwUmœ, œnameœ: œmessageœ, œoutput_typesœ: [œMessageœ]}",_22 "target": "OpenAIModel-OcXkl",_22 "targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œOpenAIModel-OcXklœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"_22}
This edge shows that the ChatInput
component outputs a Message
type to the target
node, which is the OpenAIModel
node.
The OpenAIModel
component accepts the Message
type at the input_value
field.
Additional metadata and project information
Additional information about the flow is stored in the root data
object.
- Metadata and project information including the name, description, and
last_tested_version
of the flow.
_10{_10 "name": "Basic Prompting",_10 "description": "Perform basic prompting with an OpenAI model.",_10 "tags": ["chatbots"],_10 "id": "1511c230-d446-43a7-bfc3-539e69ce05b8",_10 "last_tested_version": "1.0.19.post2",_10 "gradient": "2",_10 "icon": "Braces"_10}
- Visual information about the flow defining the initial position of the flow in the workspace.
_10"viewport": {_10 "x": -37.61270157375441,_10 "y": -155.91266341888854,_10 "zoom": 0.7575251406952855_10}
- Notes are comments that help you understand the flow within the workspace.
They may contain links, code snippets, and other information.
Notes are written in Markdown and stored as
node
objects.
_10{_10 "id": "undefined-kVLkG",_10 "node": {_10 "description": "## 📖 README\nPerform basic prompting with an OpenAI model.\n\n#### Quick Start\n- Add your **OpenAI API key** to the **OpenAI Model**\n- Open the **Playground** to chat with your bot.\n..."_10 }_10}