{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/palisade-email/json-schema/palisade-email-header-analysis-result-schema.json",
  "title": "HeaderAnalysisResult",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/palisade-email-openapi.yml#/components/schemas/HeaderAnalysisResult",
  "type": "object",
  "properties": {
    "summary": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string"
        },
        "returnPath": {
          "type": "string"
        },
        "subject": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "messageId": {
          "type": "string"
        },
        "spf": {
          "type": "string",
          "description": "pass, fail, softfail, neutral, none, temperror, permerror or unknown."
        },
        "dkim": {
          "type": "string",
          "description": "pass, fail, softfail, neutral, none, temperror, permerror or unknown."
        },
        "dmarc": {
          "type": "string",
          "description": "pass, fail, softfail, neutral, none, temperror, permerror or unknown."
        },
        "spfAlignment": {
          "type": "string",
          "description": "Whether the SPF domain aligns with the From domain, strictly or relaxed."
        },
        "dkimAlignment": {
          "type": "string"
        },
        "overallVerdict": {
          "type": "string"
        }
      },
      "required": [
        "from",
        "returnPath",
        "subject",
        "date",
        "messageId",
        "spf",
        "dkim",
        "dmarc",
        "spfAlignment",
        "dkimAlignment",
        "overallVerdict"
      ]
    },
    "authenticationResults": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "authServId": {
            "type": "string"
          },
          "spf": {
            "type": "string",
            "description": "pass, fail, softfail, neutral, none, temperror, permerror or unknown."
          },
          "spfReason": {
            "type": "string"
          },
          "spfFrom": {
            "type": "string"
          },
          "dkim": {
            "type": "string",
            "description": "pass, fail, softfail, neutral, none, temperror, permerror or unknown."
          },
          "dkimReason": {
            "type": "string"
          },
          "dkimDomain": {
            "type": "string"
          },
          "dmarc": {
            "type": "string",
            "description": "pass, fail, softfail, neutral, none, temperror, permerror or unknown."
          },
          "dmarcReason": {
            "type": "string"
          },
          "compAuth": {
            "type": "string",
            "description": "Microsoft's composite authentication verdict, when present."
          },
          "raw": {
            "type": "string"
          }
        },
        "required": [
          "authServId",
          "spf",
          "spfReason",
          "spfFrom",
          "dkim",
          "dkimReason",
          "dkimDomain",
          "dmarc",
          "dmarcReason",
          "compAuth",
          "raw"
        ]
      }
    },
    "dkimSignatures": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string"
          },
          "algorithm": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "selector": {
            "type": "string"
          },
          "headerFields": {
            "type": "string"
          },
          "bodyHash": {
            "type": "string"
          },
          "raw": {
            "type": "string"
          }
        },
        "required": [
          "version",
          "algorithm",
          "domain",
          "selector",
          "headerFields",
          "bodyHash",
          "raw"
        ]
      }
    },
    "arcChain": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "instance": {
            "type": "number"
          },
          "arcAuthenticationResults": {
            "type": "string"
          },
          "arcSeal": {
            "type": "string"
          },
          "arcMessageSignature": {
            "type": "string"
          },
          "cv": {
            "type": "string"
          }
        },
        "required": [
          "instance",
          "arcAuthenticationResults",
          "arcSeal",
          "arcMessageSignature",
          "cv"
        ]
      }
    },
    "receivedHops": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "index": {
            "type": "number"
          },
          "from": {
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "protocol": {
            "type": "string"
          },
          "timestamp": {
            "type": "string"
          },
          "delayMs": {
            "type": [
              "number",
              "null"
            ],
            "description": "Milliseconds spent at this hop, or null when it cannot be derived."
          },
          "ip": {
            "type": "string"
          },
          "raw": {
            "type": "string"
          }
        },
        "required": [
          "index",
          "from",
          "by",
          "protocol",
          "timestamp",
          "delayMs",
          "ip",
          "raw"
        ]
      }
    },
    "dnsValidation": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "fromDomain": {
          "type": "string"
        },
        "spfRecord": {
          "type": [
            "string",
            "null"
          ]
        },
        "dmarcRecord": {
          "type": [
            "string",
            "null"
          ]
        },
        "dmarcPolicy": {
          "type": [
            "string",
            "null"
          ]
        },
        "dkimSelectors": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "selector": {
                "type": "string"
              },
              "domain": {
                "type": "string"
              },
              "publicKeyFound": {
                "type": "boolean"
              }
            },
            "required": [
              "selector",
              "domain",
              "publicKeyFound"
            ]
          }
        }
      },
      "required": [
        "fromDomain",
        "spfRecord",
        "dmarcRecord",
        "dmarcPolicy",
        "dkimSelectors"
      ],
      "description": "Live DNS read for the From domain. Null when `include_dns_validation` was false."
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rawHeaderCount": {
      "type": "number"
    }
  },
  "required": [
    "summary",
    "authenticationResults",
    "dkimSignatures",
    "arcChain",
    "receivedHops",
    "dnsValidation",
    "warnings",
    "rawHeaderCount"
  ]
}