Build flows via API
You can create a complete flow (nodes and connections) through the REST API or MCP. The result is the same as in the visual editor: the flow shows up in Pulbot and can be opened and edited.
When to use it
When you want to generate flows from your system, for example one per customer, or let an AI agent build them for you.
Steps
- 1Find the tools you'll use: GET /api/v1/tools/?search=Gmail&category=all. Use category=all to include Pulbot's own tools.
- 2Create the flow: POST /api/v1/flows/ with {"name": "My flow"}. Keep data.id.
- 3Add the nodes: PATCH /api/v1/flows/{id}/ with states. Each node has a temporary id (tmp-…), action_tool (the tool id), content and style.position. If the node uses a resource, add resource_connector.
- 4Read the real node ids with GET /api/v1/flows/{id}/ (data.states[].id).
- 5Connect the nodes: PATCH /api/v1/flows/{id}/ with only transitions, each with before_state and next_state.
Reference
- Via MCP
- create_flow, add_node, connect_nodes, configure_node and validate_flow. configure_node maps each node's inputs the same way the editor does.
- Position
- Always send style.position. Without it, nodes pile up in the editor.
- Connections
- When connecting, don't send states in the same PATCH: nodes would be recreated with new ids.
- Activation
- The flow starts inactive. Turn it on from the editor when it's ready.
Common errors
- 422
- A field is missing or the body has the wrong shape. Details come in data.
- Node without a tool
- action_tool must be an id listed by GET /api/v1/tools/?category=all.
Next step
Import the Postman collection: it includes these steps with tests, plus the same steps over MCP.