{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/whoisgeni-us/json-schema/whoisgeni-us-api-response-history-response-schema.json",
  "title": "ApiResponse[HistoryResponse]",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/whoisgeni-us-domains-api-openapi.yml#/components/schemas/ApiResponse_HistoryResponse_",
  "properties": {
    "data": {
      "anyOf": [
        {
          "$ref": "#/$defs/HistoryResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "anyOf": [
        {
          "$ref": "#/$defs/ErrorDetail"
        },
        {
          "type": "null"
        }
      ]
    },
    "meta": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Meta"
    }
  },
  "type": "object",
  "$defs": {
    "ErrorDetail": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code"
        },
        "message": {
          "type": "string",
          "title": "Message"
        },
        "details": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Details"
        }
      },
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "title": "ErrorDetail",
      "description": "Structured error information for API error responses.\n\nAttributes:\n    code: Machine-readable error code (e.g. \"JOB_NOT_FOUND\").\n    message: Human-readable error description.\n    details: Optional additional context for debugging."
    },
    "FieldChange": {
      "properties": {
        "from": {
          "type": "string",
          "title": "From"
        },
        "to": {
          "type": "string",
          "title": "To"
        }
      },
      "type": "object",
      "required": [
        "from",
        "to"
      ],
      "title": "FieldChange",
      "description": "A single field that changed between consecutive runs.\n\nAttributes:\n    from_value: Previous value (serialized as \"from\").\n    to_value: Current value (serialized as \"to\")."
    },
    "HistoryEntry": {
      "properties": {
        "analysis_run_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Analysis Run Id"
        },
        "completed_at": {
          "type": "string",
          "title": "Completed At"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "entity": {
          "type": "string",
          "title": "Entity"
        },
        "entity_type": {
          "type": "string",
          "title": "Entity Type"
        },
        "confidence": {
          "type": "number",
          "title": "Confidence"
        },
        "registrar": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Registrar"
        },
        "nameservers": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Nameservers"
        },
        "verdict": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Verdict"
        },
        "verdict_operator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Verdict Operator"
        },
        "diff": {
          "anyOf": [
            {
              "$ref": "#/$defs/RunDiff"
            },
            {
              "type": "null"
            }
          ]
        },
        "source": {
          "type": "string",
          "title": "Source",
          "default": "local"
        }
      },
      "type": "object",
      "required": [
        "completed_at",
        "status",
        "entity",
        "entity_type",
        "confidence"
      ],
      "title": "HistoryEntry",
      "description": "A single analysis run in the domain's history timeline.\n\nAttributes:\n    analysis_run_id: UUID of the analysis run, or None for external entries.\n    completed_at: ISO 8601 timestamp when the run completed.\n    status: Run status (completed, partial, or historical).\n    entity: Top attributed entity display name.\n    entity_type: Entity classification (organization, person, unknown).\n    confidence: Top entity confidence score (0.0 to 1.0).\n    registrar: Domain registrar from WHOIS data.\n    nameservers: Sorted list of nameservers.\n    verdict: Attribution verdict tier for this run, or None for runs\n        persisted before verdicts existed and external entries.\n    verdict_operator: Operator named by the verdict, when present.\n    diff: Changes from the previous run, or None for the first run.\n    source: Source of this entry: \"local\" (WhoisGenius analysis) or\n        \"external\" (upstream WHOIS History provider)."
    },
    "HistoryResponse": {
      "properties": {
        "domain": {
          "type": "string",
          "title": "Domain"
        },
        "total_runs": {
          "type": "integer",
          "title": "Total Runs"
        },
        "entries": {
          "items": {
            "$ref": "#/$defs/HistoryEntry"
          },
          "type": "array",
          "title": "Entries"
        },
        "next_cursor": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Next Cursor"
        },
        "has_more": {
          "type": "boolean",
          "title": "Has More",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "domain",
        "total_runs",
        "entries"
      ],
      "title": "HistoryResponse",
      "description": "Paginated history of analysis runs for a domain.\n\nAttributes:\n    domain: The domain name queried.\n    total_runs: Total number of completed/partial runs for this domain.\n    entries: List of history entries (newest first).\n    next_cursor: Cursor for the next page (completed_at ISO timestamp).\n    has_more: Whether more entries exist beyond this page."
    },
    "NameserverDiff": {
      "properties": {
        "added": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Added"
        },
        "removed": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Removed"
        }
      },
      "type": "object",
      "title": "NameserverDiff",
      "description": "Nameserver additions and removals between consecutive runs.\n\nAttributes:\n    added: Nameservers present in current but not previous run.\n    removed: Nameservers present in previous but not current run."
    },
    "RunDiff": {
      "properties": {
        "entity": {
          "anyOf": [
            {
              "$ref": "#/$defs/FieldChange"
            },
            {
              "type": "null"
            }
          ]
        },
        "confidence_delta": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Confidence Delta"
        },
        "registrar": {
          "anyOf": [
            {
              "$ref": "#/$defs/FieldChange"
            },
            {
              "type": "null"
            }
          ]
        },
        "nameservers": {
          "anyOf": [
            {
              "$ref": "#/$defs/NameserverDiff"
            },
            {
              "type": "null"
            }
          ]
        },
        "verdict": {
          "anyOf": [
            {
              "$ref": "#/$defs/VerdictChange"
            },
            {
              "type": "null"
            }
          ]
        },
        "significance": {
          "type": "string",
          "enum": [
            "material",
            "minor",
            "none"
          ],
          "title": "Significance",
          "default": "none"
        },
        "significance_reasons": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Significance Reasons"
        }
      },
      "type": "object",
      "title": "RunDiff",
      "description": "Diff between this run and the previous run.\n\nAll change fields are None when unchanged. The entire diff is None for\nthe first run in a domain's history (no previous run to compare).\n\nAttributes:\n    entity: Entity attribution change (from/to display names).\n    confidence_delta: Change in top-entity confidence score.\n    registrar: Registrar change (from/to).\n    nameservers: Nameserver additions and removals.\n    verdict: Attribution verdict transition, when both runs have a verdict.\n    significance: Whether this change is worth acting on -- ``material``\n        (an operator/verdict/registrar/NS-migration event a monitor would\n        alert on), ``minor`` (a timeline detail), or ``none``.\n    significance_reasons: Ordered, human-readable reasons for the\n        significance classification (most significant first)."
    },
    "VerdictChange": {
      "properties": {
        "from": {
          "type": "string",
          "title": "From"
        },
        "to": {
          "type": "string",
          "title": "To"
        },
        "direction": {
          "type": "string",
          "enum": [
            "upgrade",
            "downgrade",
            "lateral"
          ],
          "title": "Direction"
        },
        "operator": {
          "anyOf": [
            {
              "$ref": "#/$defs/FieldChange"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "from",
        "to",
        "direction"
      ],
      "title": "VerdictChange",
      "description": "A change in the attribution verdict between consecutive runs.\n\nPopulated only when both runs carry an attribution verdict (runs\npersisted before verdicts existed have ``verdict=None`` and produce no\nVerdictChange). ``direction`` is relative to the tier ordinal:\n``upgrade`` when attribution strengthened, ``downgrade`` when it weakened,\n``lateral`` when the tier held but the operator identity changed.\n\nAttributes:\n    from_tier: Previous verdict tier (serialized as \"from\").\n    to_tier: Current verdict tier (serialized as \"to\").\n    direction: upgrade, downgrade, or lateral.\n    operator: Operator identity change, when the named operator differs."
    }
  }
}