{
  "schemaVersion": "flowdrome.workflow.v1",
  "id": "",
  "name": "API guard — rate limit per tenant",
  "version": "0",
  "status": "draft",
  "nodes": [
    {
      "id": "seed",
      "type": "input.inject",
      "label": "API call",
      "category": "trigger",
      "config": {
        "contentType": "application/json",
        "payload": {
          "tenant": "acme-tenant",
          "call": "GET /v1/reports"
        }
      },
      "position": {
        "x": 0,
        "y": 46
      }
    },
    {
      "id": "first",
      "type": "logic.rate-limit",
      "label": "Rate limit (call 1)",
      "category": "flow",
      "config": {
        "tenantHeader": "x-tenant-id",
        "tenantPath": "tenant",
        "missingTenant": "anonymous",
        "tenants": "",
        "unknownTenant": "deny",
        "perSecond": 0,
        "perMinute": 0,
        "perHour": 1,
        "perDay": 0,
        "allowCount": 0,
        "allowEverySeconds": 0,
        "scope": "nd-guard-mrsqq3mu",
        "queueName": "",
        "queueBroker": "",
        "queueToken": "",
        "maxWaitMs": 60000,
        "storageBackend": "",
        "storageHost": "",
        "storagePort": 6379,
        "storagePassword": "",
        "storageDb": 0,
        "storageTls": false,
        "credentialId": "",
        "timeoutMs": 90000
      },
      "position": {
        "x": 530,
        "y": 46
      }
    },
    {
      "id": "second",
      "type": "logic.rate-limit",
      "label": "Rate limit (call 2)",
      "category": "flow",
      "config": {
        "tenantHeader": "x-tenant-id",
        "tenantPath": "request.tenant",
        "missingTenant": "anonymous",
        "tenants": "",
        "unknownTenant": "deny",
        "perSecond": 0,
        "perMinute": 0,
        "perHour": 1,
        "perDay": 0,
        "allowCount": 0,
        "allowEverySeconds": 0,
        "scope": "nd-guard-mrsqq3mu",
        "queueName": "",
        "queueBroker": "",
        "queueToken": "",
        "maxWaitMs": 60000,
        "storageBackend": "",
        "storageHost": "",
        "storagePort": 6379,
        "storagePassword": "",
        "storageDb": 0,
        "storageTls": false,
        "credentialId": "",
        "timeoutMs": 90000
      },
      "position": {
        "x": 2120,
        "y": 23
      }
    },
    {
      "id": "keep",
      "type": "processing.set",
      "label": "Forward call 2",
      "category": "processing",
      "config": {
        "mode": "manual",
        "assignments": [
          {
            "name": "request.tenant",
            "type": "string",
            "value": "{{ $json.tenant }}"
          }
        ],
        "include": "all",
        "dotNotation": true,
        "ignoreConversionErrors": false
      },
      "position": {
        "x": 1590,
        "y": 23
      }
    },
    {
      "id": "pass1",
      "type": "utility.console",
      "label": "Serve call 1",
      "category": "utility",
      "config": {
        "message": "call 1 → 200 OK"
      },
      "position": {
        "x": 1060,
        "y": 23
      }
    },
    {
      "id": "limited",
      "type": "utility.console",
      "label": "429 lane",
      "category": "utility",
      "config": {
        "message": "call 2 → 429 rate_limited: {{ $json.message }}"
      },
      "position": {
        "x": 2650,
        "y": 178
      }
    },
    {
      "id": "pass2",
      "type": "utility.console",
      "label": "Serve call 2",
      "category": "utility",
      "config": {
        "message": "call 2 → 200 OK (unexpected)"
      },
      "position": {
        "x": 2650,
        "y": 0
      }
    }
  ],
  "edges": [
    {
      "id": "e0",
      "sourceNodeId": "seed",
      "sourcePort": "output",
      "targetNodeId": "first",
      "targetPort": "input"
    },
    {
      "id": "e1",
      "sourceNodeId": "first",
      "sourcePort": "output",
      "targetNodeId": "pass1",
      "targetPort": "input"
    },
    {
      "id": "e2",
      "sourceNodeId": "pass1",
      "sourcePort": "output",
      "targetNodeId": "keep",
      "targetPort": "input"
    },
    {
      "id": "e3",
      "sourceNodeId": "keep",
      "sourcePort": "output",
      "targetNodeId": "second",
      "targetPort": "input"
    },
    {
      "id": "e4",
      "sourceNodeId": "second",
      "sourcePort": "output",
      "targetNodeId": "pass2",
      "targetPort": "input"
    },
    {
      "id": "e5",
      "sourceNodeId": "second",
      "sourcePort": "limited",
      "targetNodeId": "limited",
      "targetPort": "input"
    },
    {
      "id": "e6",
      "sourceNodeId": "first",
      "sourcePort": "limited",
      "targetNodeId": "limited",
      "targetPort": "input"
    }
  ],
  "triggers": [
    {
      "id": "t0",
      "nodeId": "seed"
    }
  ],
  "meta": {
    "snippets": [],
    "source": "template-gallery",
    "description": "Two calls from the same tenant hit back-to-back rate limiters sharing one counter scope: the first passes, the second trips the limit and exits via the 429 lane — the multi-tenant guard pattern (see Admin → Tenants for per-tenant overrides)."
  }
}