n8n integration

Put Guardian in front of the step that cannot be undone.

Guardian judges an action before it happens, and your workflow does the work. Guardian never sends, deletes or pays anything itself. It answers one of three ways, and keeps a record of every answer.

ALLOWED

The action may run. Connect this output to your action node.

NEEDS APPROVAL

A human decides first. The workflow waits.

DENIED

Nothing runs. The attempt is recorded.

Examples

Start from a working example

Robert Breen built a free, step-by-step lesson that adds Guardian approvals to an n8n workflow, using made-up example data.

Make your n8n AI agent ask before it emails a customer
A free lesson by Robert Breen on Ynteractive →

Or paste this example workflow into n8n. It drafts an email and asks Guardian before anything goes out. With the example policy below, an email to an internal address goes through on its own and an email to anyone else waits for a person. Nothing is sent by the example itself: the two send steps are placeholders you replace with your own email node.

  • The verified Guardian node in n8n, and a Guardian API credential with your own API key.
  • The example policy below in your Guardian organization, for action type email.send.
  • To paste: copy the workflow, open an empty workflow in n8n and press Ctrl+V (Cmd+V on a Mac). Pick your credential on the three Guardian nodes. Activate the workflow so the approval path receives approvals.
workflow.json
{
  "name": "Guardian approval gate (example)",
  "nodes": [
    {
      "parameters": {
        "content": "## Guardian approval gate (example)\nDrafts an email and asks Guardian before anything is sent. Nothing is sent by this example: the two send steps are placeholders. Replace them with your own email node.\n\nBefore you run it:\n1. Install the verified Guardian node (search the nodes panel for Guardian).\n2. Create a Guardian API credential with your own API key (Guardian dashboard, Settings, API Keys) and pick it on all three Guardian nodes.\n3. In Guardian, create a policy for action type email.send (the example policy is on guardian-safety-gate.com/n8n.html).\n4. Activate the workflow so the Approval Trigger registers. Keep only one active workflow per action type.",
        "height": 380,
        "width": 460
      },
      "id": "1fa052a4-ab04-485d-967c-d7c52729dc3e",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -560,
        -140
      ]
    },
    {
      "parameters": {},
      "id": "eea793fc-2f58-4d50-9dc9-10e53f79ab16",
      "name": "Start",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "54e2786c-162a-4525-99ad-839bd1553733",
              "name": "recipient",
              "value": "customer@example.com",
              "type": "string"
            },
            {
              "id": "30bee9bd-8d81-4cd9-b8b1-b65e01612931",
              "name": "subject",
              "value": "Invoice reminder",
              "type": "string"
            },
            {
              "id": "8b864949-4590-4733-b93b-3f373bffbcc2",
              "name": "body",
              "value": "Hi, a friendly reminder that your invoice is due on Friday.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "706787e8-e4d2-4a2b-a175-b8e773d62882",
      "name": "Draft email",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "resource": "check",
        "operation": "evaluateAndExecute",
        "actionType": "email.send",
        "payload": "={{ JSON.stringify({ recipient: $json.recipient, subject: $json.subject, body: $json.body }) }}",
        "requester": "example-workflow",
        "projectSlug": "",
        "idempotencyKey": "",
        "options": {}
      },
      "id": "1b26fd5e-ba9c-4d60-9f13-0467d52438a1",
      "name": "Guardian: check email.send",
      "type": "n8n-nodes-guardian.guardian",
      "typeVersion": 1,
      "position": [
        440,
        0
      ]
    },
    {
      "parameters": {},
      "id": "ac96bd07-1eae-445b-847e-a24b1c471357",
      "name": "Send email (replace me)",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        700,
        -160
      ]
    },
    {
      "parameters": {},
      "id": "d45843e5-7b0f-4efc-8f99-a421bff60c70",
      "name": "Denied: not sent",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        700,
        0
      ]
    },
    {
      "parameters": {},
      "id": "3ff811c2-e4ad-499f-b012-7e408705ba4f",
      "name": "Waiting for approval",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        700,
        160
      ]
    },
    {
      "parameters": {
        "content": "## Approval path\nRuns when someone approves in Guardian. Enforce checks the approval and claims it once. Your send node reads the approved email from {{ $json.payloadJson.recipient }}, {{ $json.payloadJson.subject }} and {{ $json.payloadJson.body }}, including edits the approver made.",
        "height": 200,
        "width": 460
      },
      "id": "7be53cc2-1537-4fb6-ba59-08ac33095502",
      "name": "Approval path note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -560,
        340
      ]
    },
    {
      "parameters": {
        "includeRejected": false,
        "actionTypeFilter": "email.send"
      },
      "id": "2e871854-3537-4545-8dec-980e38d6f018",
      "name": "Guardian Approval Trigger",
      "type": "n8n-nodes-guardian.guardianApprovalTrigger",
      "typeVersion": 1,
      "position": [
        0,
        420
      ],
      "webhookId": "19f83990-1ab5-4b9b-833c-9e4a4d8ed63e"
    },
    {
      "parameters": {
        "resource": "enforce",
        "enforceOperation": "claim",
        "enforceIntentRunId": "={{ $json.intentRunId }}",
        "expectedActionType": "email.send",
        "expectedProjectSlug": "",
        "expectedIdempotencyKey": "",
        "enforceTestMode": false
      },
      "id": "3d1ccc47-de04-4e14-82db-3d5f3977eac8",
      "name": "Guardian: enforce approval",
      "type": "n8n-nodes-guardian.guardian",
      "typeVersion": 1,
      "position": [
        240,
        420
      ]
    },
    {
      "parameters": {},
      "id": "2e212f82-6877-4a21-84d3-b09e5c43b870",
      "name": "Send approved email (replace me)",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        500,
        320
      ]
    },
    {
      "parameters": {},
      "id": "2a62561f-c1c8-42fb-aefd-600851080b3a",
      "name": "Not sent",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        500,
        500
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Draft email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Draft email": {
      "main": [
        [
          {
            "node": "Guardian: check email.send",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Guardian: check email.send": {
      "main": [
        [
          {
            "node": "Send email (replace me)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Denied: not sent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Waiting for approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Guardian Approval Trigger": {
      "main": [
        [
          {
            "node": "Guardian: enforce approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Guardian: enforce approval": {
      "main": [
        [
          {
            "node": "Send approved email (replace me)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not sent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}

The example policy. In the Guardian dashboard: Policies, Create, action type email.send, then paste it into the Advanced JSON tab under Rules. Replace the address with your own team address.

policy rules
[
  {
    "type": "allowlist",
    "fieldPath": "recipient",
    "allowedValues": [
      "team@yourcompany.example"
    ],
    "otherwiseDecision": "REQUIRE_APPROVAL",
    "reason": "Only internal addresses go out on their own; anything to a customer waits for a person",
    "matchMessage": "Internal address, sent without approval",
    "otherwiseMessage": "Goes to a customer, so a person approves it first"
  }
]
Setup

The integration, in four steps

  1. Place the Guardian node right before the action node (the send, the delete, the payment), after the step that produces the values.
  2. Fill two fields. Action Type is a name you choose, such as email.send. Payload is the JSON with the fields your policy will check, using the same field names as the policy. The credential needs an API key from the dashboard under Settings, plus the signing secret and base URL it asks for.
  3. Wire the three outputs. Connect Allowed to the action node. Leave Denied and Needs Approval pointing at a note or at nothing. Never connect all three to the action.
  4. If you use Needs Approval, add the approval path: Guardian Approval Trigger, then a Guardian node set to Enforce, then the action node. The action node reads the approved payload from the trigger's payloadJson, which holds the edited version when the approver changed it. The workflow must be active, and only one active workflow should listen for the same action type.
The Guardian API credential in n8n: API key, signing secret and base URL, with a successful connection test
The Guardian API credential in n8n, connection tested.

Example payload for an email, where a text value from an AI step is wrapped in JSON.stringify so line breaks cannot break the JSON:

payload
{
  "recipient": "customer@example.com",
  "subject": {{ JSON.stringify($json.output.subject) }},
  "body": {{ JSON.stringify($json.output.body) }}
}
The Guardian node with all three outputs connected: Allowed sends the email, Denied and Needs Approval each end in a visible response
All three outputs connected. Allowed sends the email. Denied and Needs Approval each end in a visible response.
Rules

Policies

An action type with no matching policy is denied by default, which is an org setting. Inside a policy every rule is evaluated and the strictest result wins. A threshold rule fires only when it matches, so the exact boundary value needs its own rule. A typo in a field name makes a rule silently dead, so run every policy through the Policy Tester with the real payload before you rely on it.

Before you go live

Test safely

Listen Mode records every request with its real payload and shows what your current policies would have decided, as "Would have: DENY (advisory)". It blocks nothing. You switch it on in the dashboard under the Organization tab, with a duration. The workflow continues through Allowed, and the action runs.

Listen Mode switch in the Organization tab
Listen Mode, in the Organization tab. Pick how long it stays on.
Audit Log rows recorded in Listen Mode, with the advisory Would have decision
Observed requests in the Audit Log. Nothing was enforced; each row shows what Guardian would have decided.

For a first run on a destructive step, disable the action node (select it and press D). A disabled node passes data through without acting. Then open the audit row of the observed run and use "Create policy from captured intent" to build the policy from the real payload.

Approvals list: requests waiting for a human
Requests waiting for a human in the Approvals list.
Edit Payload and Approve: original payload next to the approved payload
The approver can edit the payload before approving. The original stays next to it.
Troubleshooting

Common first-run surprises

What you seeWhy, and the fix
The first result is DENYNo policy matches the action type. Build one from the captured payload in Listen Mode.
A rule never firesThe rule's field name differs from the payload's, often a typo. Check it in the Policy Tester.
The action ran in Listen ModeListen Mode never blocks. Disable the action node while testing.
Subject or body is empty after GuardianThe Allowed output carries Guardian's data, not your earlier node's. Read the values from that node, for example $('Basic LLM Chain').first().json.output.body.
An amount rule sees 0In node versions before 1.0.9 the Amount field defaults to 0 and can overwrite the payload's amount. Update the node, or put {{ $json.amount }} in the Amount field.
An email goes out twice after an approvalTwo active workflows listen for the same action type. Keep one active.
Where we are

What Guardian does not do yet

  • The tamper-evident chain covers the submitted request and the decision. The approver, the approval time and status, and an edited payload are stored and fingerprinted, but not yet part of the chain.
  • The chain is verified inside Guardian. A customer-held anchor for independent verification does not exist yet.
  • Listen Mode results are advisory and not tamper-evident.
  • A per-action setting for what happens when Guardian is unreachable is planned, not built.
Support

Questions or stuck

Write to us. A person reads it.