{
  "schema_version": "agentpmt.docs.v1",
  "generated_at": "2026-07-27T02:57:12.204Z",
  "release_id": "9bd28307d3dc8ff05bcac2f755a96681a9e650091caba4ab5ecbd5a1d6d62acc",
  "id": "69e02943ad2e1817f7ace836",
  "page_url": "https://www.agentpmt.com/docs/agent-connections/connect-agent-to-n8n",
  "markdown_url": "https://www.agentpmt.com/docs/agent-connections/connect-agent-to-n8n?format=agent-md",
  "json_url": "https://www.agentpmt.com/docs/agent-connections/connect-agent-to-n8n?format=agent-json",
  "source_path": "content/docs/connect-agent-to-n8n.mdoc",
  "updated_at": "2026-05-19T23:08:57.000Z",
  "headings": [
    {
      "depth": 2,
      "id": "what-you-will-need",
      "title": "What You Will Need"
    },
    {
      "depth": 2,
      "id": "step-1-getting-your-n8n-api-key",
      "title": "Step 1 — Getting Your n8n API Key"
    },
    {
      "depth": 2,
      "id": "step-2-finding-your-n8n-instance-url",
      "title": "Step 2 — Finding Your n8n Instance URL"
    },
    {
      "depth": 2,
      "id": "step-3-connecting-n8n-in-agentpmt",
      "title": "Step 3 — Connecting n8n in AgentPMT"
    },
    {
      "depth": 2,
      "id": "step-4-making-your-workflow-triggerable",
      "title": "Step 4 — Making Your Workflow Triggerable"
    },
    {
      "depth": 2,
      "id": "step-5-triggering-your-workflow",
      "title": "Step 5 — Triggering Your Workflow"
    },
    {
      "depth": 2,
      "id": "step-6-attaching-files-from-the-file-manager",
      "title": "Step 6 — Attaching Files From the File Manager"
    },
    {
      "depth": 2,
      "id": "step-7-ingesting-output-files-into-the-file-manager",
      "title": "Step 7 — Ingesting Output Files Into the File Manager"
    },
    {
      "depth": 2,
      "id": "what-is-the-difference-between-sync-and-async-n8n-workflows",
      "title": "What is the difference between sync and async n8n workflows?"
    },
    {
      "depth": 2,
      "id": "troubleshooting",
      "title": "Troubleshooting"
    },
    {
      "depth": 2,
      "id": "frequently-asked-questions",
      "title": "Frequently Asked Questions"
    },
    {
      "depth": 3,
      "id": "does-this-work-with-self-hosted-n8n-community-edition",
      "title": "Does this work with self-hosted n8n Community Edition?"
    },
    {
      "depth": 3,
      "id": "do-i-need-a-paid-n8n-cloud-plan-to-use-this-connector",
      "title": "Do I need a paid n8n Cloud plan to use this connector?"
    },
    {
      "depth": 3,
      "id": "can-i-trigger-workflows-that-do-not-have-a-webhook-node",
      "title": "Can I trigger workflows that do not have a Webhook node?"
    },
    {
      "depth": 3,
      "id": "what-happens-if-my-workflow-takes-longer-than-60-seconds",
      "title": "What happens if my workflow takes longer than 60 seconds?"
    },
    {
      "depth": 3,
      "id": "are-my-n8n-credentials-stored-securely",
      "title": "Are my n8n credentials stored securely?"
    },
    {
      "depth": 3,
      "id": "can-i-connect-more-than-one-n8n-instance",
      "title": "Can I connect more than one n8n instance?"
    },
    {
      "depth": 2,
      "id": "related-docs",
      "title": "Related Docs"
    }
  ],
  "related_products": [],
  "related_workflows": [],
  "doc": {
    "title": "Connect Your Agent to n8n Workflows",
    "description": "Connect your AI agent to n8n to trigger automation workflows, pass structured data and files, and ingest results — step by step in under 15 minutes.",
    "category": "Agent Connections",
    "image": null,
    "full_path": "agent-connections/connect-agent-to-n8n",
    "body_markdown": "# Connect Your Agent to n8n Workflows\n\nn8n is a visual workflow automation platform used for multi-step automations across APIs, databases, and internal tools. The **n8n Workflow Connector** lets your AgentPMT agent list your n8n workflows, trigger them with structured data and file attachments, and ingest their output — all from a conversation.\n\nBy the end of this tutorial, you will have an active n8n workflow that your AgentPMT agent triggers with structured data, attaches files to, and reads results back from. You will also know how to monitor execution status and ingest any files the workflow produces.\n\n**Tested**\n\nTested with n8n 1.x on n8n Cloud and self-hosted Docker; AgentPMT — April 2026.\n\n---\n\n## What You Will Need\n\n- An **AgentPMT account with a connected agent** — follow [60 Second Quick Start](https://www.agentpmt.com/docs/getting-started/quick-start) if you have not yet\n- An **n8n account** — either a paid [n8n Cloud](https://n8n.io/cloud/) plan or a self-hosted instance with a public URL\n- About **15 minutes**\n\n---\n\n## Step 1 — Getting Your n8n API Key\n\nAn n8n API key lets your AgentPMT agent authenticate REST API calls to your instance — listing workflows, reading execution history, and fetching workflow details. n8n issues API keys from its built-in settings UI with configurable expiration. Webhook triggering uses a separate URL with its own optional auth, so the API key alone is sufficient for most setups.\n\n### Open n8n Settings\n\nLog in to your n8n instance and click the **gear icon** or navigate to **Settings** in the sidebar.\n\n### Go to n8n API\n\nIn the settings menu, click **n8n API**.\n\n### Create an API Key\n\nClick **Create an API key**. Give it a descriptive label like `AgentPMT Connector` and set an expiration date.\n\n### Copy the key\n\nCopy the API key immediately — **it will not be shown again**. Store it somewhere safe until you complete Step 3.\n\n**n8n API access**\n\nn8n Cloud API access varies by account. If you do not see **n8n API** in Settings, use an n8n account with API-key access or connect a self-hosted instance.\n\n---\n\n## Step 2 — Finding Your n8n Instance URL\n\nYour instance URL is the base address of your n8n dashboard — the root of every API call and webhook URL your agent will make. n8n Cloud assigns one automatically when you sign up. Self-hosted instances need a publicly reachable domain configured via the `WEBHOOK_URL` environment variable so that outbound webhook URLs resolve correctly from the public internet.\n\n| Deployment | Instance URL example |\n| --- | --- |\n| **n8n Cloud** | `https://yourname.app.n8n.cloud` |\n| **Self-hosted** | `https://n8n.yourdomain.com` (whatever you configured) |\n**Self-hosted reachability**\n\nYour n8n instance must be publicly reachable over the internet. Localhost-only or firewall-gated instances cannot be contacted from AgentPMT.\n\n---\n\n## Step 3 — Connecting n8n in AgentPMT\n\nAgentPMT injects your n8n credentials automatically at runtime so you never paste the API key into a chat. The platform encrypts both the API key and instance URL at rest and binds them to your Agent Group and product. When your agent calls any connector action, AgentPMT pulls the credentials securely and signs the request — no further user action needed.\n\n### Open the n8n Workflow Connector\n\nGo to the [n8n Workflow Connector](https://www.agentpmt.com/marketplace) in the AgentPMT marketplace and click **Enable**.\n\n### Set up the connection\n\nWhen prompted, enter your two credentials:\n\n- **API Key** — the key you created in Step 1\n- **Instance URL** — your n8n base URL from Step 2\n\n### Save the connection\n\nClick **Save**. AgentPMT encrypts the credentials and binds them to your Agent Group. They are injected automatically whenever your agent uses the tool.\n\n---\n\n## Step 4 — Making Your Workflow Triggerable\n\nn8n workflows can only be triggered externally through **Webhook nodes** — the public n8n REST API has no `execute workflow by ID` endpoint. Adding a Webhook node as the first trigger gives the workflow a URL your agent can call. The node configuration controls the HTTP method, the path slug, and whether the HTTP response waits for the workflow to finish or returns immediately.\n\n### Open your workflow in n8n\n\nOpen the workflow you want your agent to trigger, or create a new one named `process-order` to follow along.\n\n### Add a Webhook trigger\n\nClick the **+** button and search for **Webhook**. Add it as the first node in your workflow.\n\n### Configure the Webhook\n\nIn the Webhook node settings:\n\n- **HTTP Method** — set to **POST** so your agent can send JSON data\n- **Path** — enter a readable slug like `process-order`, or leave the default UUID\n- **Response Mode** — set to **When Last Node Finishes** so your agent gets the workflow output back\n\n### Add your workflow logic\n\nConnect whatever nodes you need after the Webhook — data transformation, API calls, database writes, notifications. The data your agent sends arrives in the Webhook node's output.\n\n### Activate the workflow\n\nToggle the workflow to **Active** in the top-right corner. Only active workflows respond to production webhook calls.\n\n**Accessing data inside n8n**\n\nData your agent sends arrives as the Webhook node output. Access it in downstream nodes with expressions like `$json.body.order_id` or `$json.body.customer_email`.\n\n---\n\n## Step 5 — Triggering Your Workflow\n\nWith a triggerable workflow active and credentials connected, your agent can list your workflows, discover webhook paths, and fire off a trigger call with structured data. The three-call flow — `list_workflows`, `get_workflow`, `trigger_workflow` — is the standard interaction pattern, and the connector auto-discovers webhook paths from the workflow definition so you never need to hand-copy URLs.\n\n### Ask your agent to list workflows\n\n```text\nShow me my n8n workflows\n```\n\nThe agent calls `list_workflows` and returns a list with IDs, names, active status, and tags:\n\n```json\n{\n  \"action\": \"list_workflows\",\n  \"workflows\": [\n    {\n      \"id\": \"h7SSBY2GM4fo9mqG\",\n      \"name\": \"process-order\",\n      \"active\": true,\n      \"tags\": []\n    }\n  ],\n  \"count\": 1,\n  \"next_cursor\": null\n}\n```\n\n### Discover the webhook path\n\n```text\nGet the details for workflow h7SSBY2GM4fo9mqG\n```\n\nThe agent calls `get_workflow`, parses the workflow JSON, and auto-extracts the Webhook node's path:\n\n```json\n{\n  \"action\": \"get_workflow\",\n  \"id\": \"h7SSBY2GM4fo9mqG\",\n  \"name\": \"process-order\",\n  \"active\": true,\n  \"webhook_triggers\": [\n    {\n      \"node_name\": \"Webhook\",\n      \"path\": \"process-order\",\n      \"method\": \"POST\",\n      \"response_mode\": \"lastNode\"\n    }\n  ],\n  \"webhook_urls\": [\n    \"https://yourname.app.n8n.cloud/webhook/process-order\"\n  ]\n}\n```\n\n### Trigger the workflow\n\n```text\nTrigger my process-order workflow with order_id \"12345\" and customer_email \"user@example.com\"\n```\n\nThe agent calls `trigger_workflow`, POSTs the JSON data to the webhook, and returns what your workflow produced:\n\n```json\n{\n  \"action\": \"trigger_workflow\",\n  \"webhook_url\": \"https://yourname.app.n8n.cloud/webhook/process-order\",\n  \"status_code\": 200,\n  \"response\": {\n    \"status\": \"processed\",\n    \"order_id\": \"12345\",\n    \"confirmation_sent\": true\n  }\n}\n```\n\n**Checking execution history**\n\nYour agent can check execution status at any time by asking \"show me the last 10 executions for workflow h7SSBY2GM4fo9mqG\" or \"show me all failed n8n executions\". These call `list_executions` with optional status filters.\n\n---\n\n## Step 6 — Attaching Files From the File Manager\n\nYour AgentPMT File Manager stores documents, images, and datasets your agent has generated or received. When triggering an n8n workflow, the connector can attach any File Manager file as a signed download URL embedded in the webhook payload under `_agentpmt_files`. The n8n workflow fetches the content via an HTTP Request node — keeping large files out of the webhook body itself.\n\n### Ask your agent to trigger with an attachment\n\n```text\nTrigger my process-order workflow with order_id \"12345\" and attach file f7d2f9d5-2d45-4d41-9d84-0dd5f6de1234\n```\n\nThe agent resolves the File Manager file to a signed URL and includes it in the payload:\n\n```json\n{\n  \"order_id\": \"12345\",\n  \"_agentpmt_files\": [\n    {\n      \"file_id\": \"f7d2f9d5-2d45-4d41-9d84-0dd5f6de1234\",\n      \"filename\": \"customer-order.pdf\",\n      \"content_type\": \"application/pdf\",\n      \"size_bytes\": 48291,\n      \"download_url\": \"https://storage.googleapis.com/...\",\n      \"expires_in_minutes\": 60\n    }\n  ]\n}\n```\n\n### Download the file in n8n\n\nIn your n8n workflow, add an **HTTP Request** node after the Webhook node. Set the URL to the expression `{{ $json.body._agentpmt_files[0].download_url }}` and the response format to **File**. The downloaded content is now available as binary data for downstream nodes (Google Drive upload, OCR, email attachment, etc.).\n\n---\n\n## Step 7 — Ingesting Output Files Into the File Manager\n\nWhen an n8n workflow produces file URLs in its output — generated reports, exported datasets, rendered images — your agent can automatically ingest them into the AgentPMT File Manager. The connector scans the execution output for downloadable URLs, pulls the content, and uploads it with a new `file_id` your agent can reference in follow-up tool calls.\n\n### Ask your agent to get an execution with ingestion\n\n```text\nGet execution 456 and save any output files to my File Manager\n```\n\nThe agent calls `get_execution` with `ingest_output_urls: true`. Any file URLs it finds in the workflow output are downloaded and added to your File Manager:\n\n```json\n{\n  \"action\": \"get_execution\",\n  \"id\": \"456\",\n  \"status\": \"success\",\n  \"output\": [\n    {\n      \"report_url\": \"https://example.com/reports/q1-2026.pdf\"\n    }\n  ],\n  \"ingested_files\": [\n    {\n      \"source_url\": \"https://example.com/reports/q1-2026.pdf\",\n      \"file_id\": \"b94c8f2a-17de-4fa8-b3b8-2c9e0f1a5b42\",\n      \"filename\": \"q1-2026.pdf\",\n      \"size_bytes\": 204819,\n      \"signed_url\": \"https://storage.googleapis.com/...\"\n    }\n  ]\n}\n```\n\n### Use the new file_id\n\nYour agent now has a File Manager `file_id` it can pass to any other AgentPMT tool — send it via email, attach it to a Telegram message, store it in a database, or feed it back into another n8n workflow.\n\n---\n\n## What is the difference between sync and async n8n workflows?\n\nThe difference is whether your agent waits for the n8n workflow to finish before continuing. Sync mode — Webhook response mode **When Last Node Finishes** — keeps the HTTP connection open and returns the workflow output directly, best for workflows under 60 seconds. Async mode — response mode **Immediately** — returns a 200 acknowledgment instantly while the workflow runs in the background; your agent polls `list_executions` or `get_execution` to retrieve results when the workflow finishes.\n\n### Sync (Wait for Result)\n\nResponse mode: 'When Last Node Finishes'. Your agent waits and gets the workflow output. Best for fast workflows under 60 seconds.\n\n### Async (Fire and Forget)\n\nResponse mode: 'Immediately'. Your agent gets an instant 200 and polls results via get_execution. Best for long-running workflows.\n\n**Timeout**\n\nThe default webhook timeout is 60 seconds. For longer workflows, increase `webhook_timeout` up to 300 seconds in the trigger request, or switch to async mode.\n\n---\n\n## Troubleshooting\n\n### 'n8n API key is invalid or expired'\n\nYour API key may have expired or been revoked. Create a new one at **Settings > n8n API** and update the connection in AgentPMT.\n\n### 'Failed to connect to n8n instance'\n\nThe instance URL is unreachable. Verify it is correct and publicly accessible. For self-hosted, confirm `WEBHOOK_URL` is set in your n8n environment and that inbound HTTPS traffic is allowed.\n\n### 'This webhook is not registered for POST requests'\n\nThe Webhook node HTTP method is set to GET (or another method), but the agent sent POST. Open the Webhook node in n8n and change the method to POST, or explicitly set `webhook_method: \"GET\"` in the trigger call.\n\n### Webhook returns 404\n\nThe workflow is not active. Toggle the workflow to **Active** in the top-right corner. Test webhook URLs (`/webhook-test/...`) only work while the editor is open — production needs an active workflow.\n\n### 'Webhook request timed out'\n\nThe workflow ran longer than 60 seconds. Increase `webhook_timeout` up to 300 seconds in the trigger call, switch to async mode by setting `wait_for_result: false`, or optimize the workflow.\n\n### Workflow triggers but returns empty result\n\nThe Webhook node response mode is set to **Immediately** — n8n returns a generic 200 acknowledgment instead of the workflow output. Change the response mode to **When Last Node Finishes** or add a **Respond to Webhook** node to control what gets returned.\n\n---\n\n## Frequently Asked Questions\n\n### Does this work with self-hosted n8n Community Edition?\n\nYes. The n8n public REST API and webhook system are available on all editions, including the free self-hosted Community Edition. The only requirement is that your instance is publicly reachable from the internet. Localhost-only installations or instances behind a firewall without inbound rules cannot be contacted from AgentPMT.\n\n### Do I need a paid n8n Cloud plan to use this connector?\n\nYes, for n8n Cloud users when API-key access is not available on the account. If you do not see **n8n API** in Settings, use an n8n account with API-key access or connect a self-hosted instance.\n\n### Can I trigger workflows that do not have a Webhook node?\n\nNo. n8n's public REST API has no endpoint to execute an arbitrary workflow by ID — Webhook nodes are the only supported external trigger. Any workflow you want your agent to trigger must have a Webhook as its first node. Existing cron-triggered or event-triggered workflows can be duplicated with a Webhook trigger added if needed.\n\n### What happens if my workflow takes longer than 60 seconds?\n\nIncrease `webhook_timeout` in the trigger call up to 300 seconds, or switch the Webhook node's response mode to **Immediately** for async mode. In async mode, your agent gets an instant 200 and then polls `get_execution` or `list_executions` to retrieve results when the workflow finishes.\n\n### Are my n8n credentials stored securely?\n\nYes. AgentPMT encrypts both your API key and instance URL at rest and injects them at runtime, scoped to your Agent Group and product. Your agent never sees the raw credentials in a chat. See [How Credentials Work](https://www.agentpmt.com/docs/core-concepts/how-credentials-work) for the full security model.\n\n### Can I connect more than one n8n instance?\n\nEach n8n Workflow Connector instance binds one API key and one instance URL. To use multiple n8n instances — for example, staging and production — add the connector as separate tool connections, each with its own credentials.\n\n---\n\n## Related Docs\n\n### [n8n Workflow Connector](https://www.agentpmt.com/marketplace)\n\nMarketplace page for the n8n product with full action reference\n\n### [Using Workflows and Tools](https://www.agentpmt.com/docs/getting-started/using-workflows-and-tools)\n\nEvery way to invoke a specific workflow or tool\n\n### [What is a Tool / Connection](https://www.agentpmt.com/docs/core-concepts/what-is-a-tool)\n\nConceptual overview of tools and connections on AgentPMT\n\n### [How Credentials Work](https://www.agentpmt.com/docs/core-concepts/how-credentials-work)\n\nUnderstand how AgentPMT securely manages your API keys and OAuth tokens\n"
  }
}
