{
  "name": "Prior Authorization with Verifiable Decision Receipts",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "prior-auth",
        "options": {},
        "responseMode": "responseNode"
      },
      "id": "dd9b2e2a-f46b-424c-8fd5-1cc8925dd527",
      "name": "Prior Authorization",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "GPT-4O"
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are a healthcare prior-authorization AI. Return JSON: {\"decision\":\"APPROVE|DENY|PEND\",\"reason\":\"...\",\"policy\":\"...\"}."
            },
            {
              "content": "=Return JSON only.\n\nInput:\n{{ JSON.stringify($json.body) }}"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "id": "af8989ba-e58a-4f83-970d-b8b69c124533",
      "name": "AI Decision",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 2.1,
      "position": [
        220,
        300
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "generateReceipt",
        "agentName": "PriorAuthAgent",
        "workflowName": "={{ $workflow.name }}",
        "action": "={{ 'AI decision: ' + ($json.message.content.decision || $json.message.content.recommendation || 'completed') }}",
        "decision": "={{ JSON.stringify($json.message.content) }}",
        "additionalFields": {
          "modelProvider": "openai",
          "modelUsed": "gpt-4o",
          "decisionType": "prior_authorization",
          "riskLevel": "critical",
          "humanReview": true,
          "policies": "cms-guidelines, hipaa",
          "permissions": "authorization.decide",
          "tags": "healthcare, payer, regulated"
        }
      },
      "id": "df692911-725d-4aab-bfc7-966f8ba326a6",
      "name": "Signatrust: Receipt",
      "type": "n8n-nodes-signatrust.signatrust",
      "typeVersion": 1,
      "position": [
        440,
        300
      ],
      "credentials": {
        "signatrustApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { status:\"OK\", receipt_id:$json.id, decision:$('AI Decision').item.json.message.content } }}",
        "options": {}
      },
      "id": "738bdb3f-713f-4aa6-85a6-5ab98e1c4f4a",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        660,
        300
      ]
    },
    {
      "parameters": {
        "content": "## Prior Authorization with Verifiable Decision Receipts\n**Why Signatrust?** Every AI decision here becomes a tamper-evident, Ed25519-signed receipt \u2014 verifiable for audits and disputes.",
        "height": 170,
        "width": 420,
        "color": 5
      },
      "id": "b8c97183-9067-40c3-ac4d-3a474057ae17",
      "name": "Sticky Note 1e8149",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        40
      ]
    }
  ],
  "connections": {
    "Prior Authorization": {
      "main": [
        [
          {
            "node": "AI Decision",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Decision": {
      "main": [
        [
          {
            "node": "Signatrust: Receipt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Signatrust: Receipt": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [
    {
      "name": "Prior Authorization \u2014 healthcare"
    },
    {
      "name": "Prior Authorization \u2014 payer"
    },
    {
      "name": "Prior Authorization \u2014 regulated"
    },
    {
      "name": "Signatrust (17)"
    }
  ],
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "versionId": "84366356-4f2a-4913-ac30-25cac5639567"
}