{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/inboxguard-io/json-schema/inboxguard-io-analyze-headers-result-schema.json",
  "title": "AnalyzeHeadersResult",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/inboxguard-io-openapi.json#/components/schemas/AnalyzeHeadersResult",
  "type": "object",
  "properties": {
    "ours": {
      "type": "object",
      "description": "InboxGuard's independent verdict, re-verified from the raw bytes.",
      "properties": {
        "spf": {
          "$ref": "#/$defs/AuthVerdict"
        },
        "dkim": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AuthVerdict"
          },
          "description": "One entry per DKIM signature."
        },
        "dmarc": {
          "allOf": [
            {
              "$ref": "#/$defs/AuthVerdict"
            },
            {
              "type": "object",
              "properties": {
                "alignment": {
                  "type": "object",
                  "properties": {
                    "spf": {
                      "type": "boolean"
                    },
                    "dkim": {
                      "type": "boolean"
                    }
                  }
                },
                "policy": {
                  "type": "string"
                }
              }
            }
          ]
        },
        "arc": {
          "allOf": [
            {
              "$ref": "#/$defs/AuthVerdict"
            },
            {
              "type": "object",
              "properties": {
                "chainLength": {
                  "type": "integer"
                }
              }
            }
          ]
        }
      },
      "required": [
        "spf",
        "dkim",
        "dmarc",
        "arc"
      ]
    },
    "theirs": {
      "type": "object",
      "description": "What the receivers' own Authentication-Results headers claimed (NOT trusted).",
      "properties": {
        "rawHeaders": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "parsed": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/AuthVerdict"
          },
          "description": "Keyed by method (spf, dkim, dmarc, arc, bimi)."
        }
      }
    },
    "agreement": {
      "type": "boolean",
      "description": "True when our verdict matches the receivers'. False = something fishy (possibly forged Authentication-Results)."
    },
    "headers": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string"
        },
        "returnPath": {
          "type": "string"
        },
        "subject": {
          "type": "string"
        },
        "messageId": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "receivedFromIp": {
          "type": "string"
        }
      }
    },
    "durationMs": {
      "type": "integer"
    }
  },
  "required": [
    "ours",
    "theirs",
    "agreement",
    "headers",
    "durationMs"
  ],
  "$defs": {
    "AuthVerdict": {
      "type": "object",
      "description": "One re-verified authentication result.",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "neutral",
            "softfail",
            "temperror",
            "permerror",
            "none",
            "policy"
          ]
        },
        "domain": {
          "type": "string"
        },
        "selector": {
          "type": "string"
        },
        "comment": {
          "type": "string"
        },
        "info": {
          "type": "string"
        }
      },
      "required": [
        "status"
      ]
    }
  }
}