251
All tools
n8nn

by n8n

Create a workflow

Creates an n8n workflow from its nodes and connections and returns the new workflow with its ID.

Updated Sep 27, 2026

create-workflow.md

Create a workflow

Creates an n8n workflow from its nodes and connections and returns the new workflow with its ID.

Note: Over MCP, write it with the n8n Workflow SDK and check it with validate_workflow first. The new workflow runs in production only once it is published (publish_workflow on the MCP server).

Set up

Use the first option your agent supports.

MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

{ "mcpServers": { "n8n": { "url": "https://{n8n_host}/mcp-server/http" } } }

Call the MCP tool create_workflow_from_code.

Server URL: https://{n8n_host}/mcp-server/http

Note: {n8n_host} is your instance's domain, such as acme.app.n8n.cloud. An owner or admin turns on Settings > Instance-level MCP first.

CLI (official)

Install the command, then confirm it runs.

npm install -g @n8n/cli
n8n-cli --version

Run n8n-cli workflow create.

Set $N8N_API_KEY in your environment first.

API (official)

Note: {n8n_host} is your instance's domain, such as acme.app.n8n.cloud. The API is not available during the free trial.

Before anything else, confirm access with the cheapest read-only call, like a list or a search. Never send or change anything to test access.

Rules

  • Ask the user before anything that sends messages, costs money, or changes data, and say how many records it touches. One approval covers a batch the user has seen.
  • Never print API keys.

Ways in

RouteSourceCallRequiredDocs
MCPOfficial · remotecreate_workflow_from_codeOAuthDocs
CLIOfficialn8n-cli workflow createAPI key in $N8N_API_KEYDocs
APIOfficialPOST /workflowsAPI key in $N8N_API_KEYDocs

Workflows using Create a workflow

No workflows yet
No published workflow uses Create a workflow yet.