{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/phishunt-io/json-schema/phishunt-io-campaign-schema.json",
  "title": "Campaign",
  "description": "Full campaign object - the CampaignSummary fields plus an evidence breakdown and every member. Shared-infrastructure grouping of public detections, not an attribution claim. This is the LIVE shape (`state` is always \"live\" here); a key that is no longer live but whose history is retained returns the different, thinner ArchivedCampaign shape instead (still HTTP 200) - see `GET /api/v1/campaigns/{id}`.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/phishunt-io-openapi.yml#/components/schemas/Campaign",
  "type": "object",
  "properties": {
    "state": {
      "type": "string",
      "enum": [
        "live"
      ],
      "description": "Always \"live\" on this shape - see ArchivedCampaign for the non-live variant."
    },
    "data_status": {
      "type": "string",
      "enum": [
        "ok",
        "stale",
        "missing"
      ],
      "description": "Same freshness signal as CampaignsResponse.data_status."
    },
    "id": {
      "type": "integer",
      "deprecated": true,
      "description": "Deprecated - versioned per daily rebuild (the same campaign can have many different ids over its lifetime), kept only for backward compatibility. Use `key` for permalinks or anything that needs to survive a rebuild."
    },
    "key": {
      "type": "string",
      "description": "Stable campaign identifier; use this for permalinks."
    },
    "size": {
      "type": "integer",
      "description": "Number of distinct registrable domains (Public Suffix List, private section included) in this cluster. Sibling subdomains of one domain count once; each platform tenant counts once."
    },
    "host_count": {
      "type": "integer",
      "description": "Number of hostnames (members.length)."
    },
    "active_count": {
      "type": "integer",
      "description": "Number of hostnames that are currently active detections."
    },
    "brands": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "confidence": {
      "type": "string",
      "enum": [
        "possible campaign",
        "suspected cluster"
      ],
      "description": "The two words this project ever uses for a cluster's confidence. Derived from `confidence_score`: >= 0.70 is \"possible campaign\", >= 0.40 is \"suspected cluster\" (below 0.40, \"weak\", is never surfaced by this API)."
    },
    "confidence_score": {
      "type": "number",
      "format": "float",
      "description": "Raw campaign_confidence float (0-1) this cluster's `confidence` label is thresholded from. Formula: clamp(0.45*D + 0.25*V + 0.20*T + 0.10*B, 0, 1) * S - see `confidence_metrics` for the D/V/T/B/S breakdown."
    },
    "confidence_metrics": {
      "type": "object",
      "description": "The confidence formula's per-component breakdown (each 0-1). D = link strength, V = evidence diversity, T = time compactness, B = strong-link share, S = size discount multiplier. Can be an empty object for a cluster with no internal edges yet.",
      "properties": {
        "D": {
          "type": "number",
          "format": "float"
        },
        "V": {
          "type": "number",
          "format": "float"
        },
        "T": {
          "type": "number",
          "format": "float"
        },
        "B": {
          "type": "number",
          "format": "float"
        },
        "S": {
          "type": "number",
          "format": "float"
        }
      }
    },
    "first_seen": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "last_activity": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "top_evidence": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "type": {
          "type": "string"
        },
        "coverage": {
          "type": "string"
        }
      }
    },
    "url": {
      "type": "string",
      "description": "Link to the /campaigns/{key}/ page for this cluster."
    },
    "algorithm_version": {
      "type": [
        "string",
        "null"
      ]
    },
    "generated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "evidence_summary": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CampaignEvidenceSummaryItem"
      }
    },
    "first_tracked": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When this stable key's lineage was first tracked (oldest `valid_from` across every cluster_id this key has ever carried)."
    },
    "history": {
      "type": "array",
      "description": "Every transition (created/grew/shrank) this stable key's lineage has gone through, oldest first. Rebuilt daily; retained for 180 days.",
      "items": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "event": {
            "type": "string",
            "enum": [
              "created",
              "grew",
              "shrank"
            ]
          },
          "size": {
            "type": "integer"
          },
          "joined": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Domains that joined at this transition."
          },
          "left": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Domains that left at this transition."
          }
        }
      }
    },
    "relationships": {
      "type": "array",
      "description": "Per-pair evidence drill-down: one entry per FORMATION internal edge (the edges that actually caused these members to be grouped together, as opposed to a merely-related or same-kit edge below the clustering threshold), sorted by score descending and capped at 50 pairs - see `relationships_truncated`.",
      "items": {
        "$ref": "#/$defs/Relationship"
      }
    },
    "relationships_truncated": {
      "type": "boolean",
      "description": "True when this cluster has more than 50 formation-edge pairs and `relationships` was cut to the 50 strongest."
    },
    "members": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CampaignMember"
      }
    },
    "domains": {
      "type": "array",
      "description": "One entry per distinct registrable domain in this cluster, sorted by domain. Sibling hostnames under one domain (or one platform tenant) are grouped into a single entry here.",
      "items": {
        "$ref": "#/$defs/CampaignDomainGroup"
      }
    }
  },
  "$defs": {
    "CampaignDomainGroup": {
      "type": "object",
      "description": "One registrable domain and the hostnames grouped under it within a campaign.",
      "properties": {
        "domain": {
          "type": "string",
          "description": "The registrable domain (Public Suffix List, private section included)."
        },
        "host_count": {
          "type": "integer",
          "description": "Number of hostnames under this domain."
        },
        "active_count": {
          "type": "integer",
          "description": "Number of those hostnames that are currently active detections."
        },
        "hosts": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Every hostname grouped under this domain."
        },
        "uuids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "uuid of each hostname in `hosts` that still has a live indicator row - can be shorter than `hosts` when some do not."
        }
      }
    },
    "CampaignEvidenceSummaryItem": {
      "type": "object",
      "description": "One (signal, value) pair shared across a cluster's members.",
      "properties": {
        "type": {
          "type": "string",
          "description": "Stable evidence-signal identifier."
        },
        "value": {
          "type": [
            "string",
            "null"
          ],
          "description": "Display value for this signal (e.g. the shared cert fingerprint, IP, or registrar name). Not a claim about intent."
        },
        "members_matching": {
          "type": "integer",
          "description": "Distinct members touched by an internal edge carrying this signal with a nonzero contribution."
        }
      }
    },
    "CampaignMember": {
      "type": "object",
      "description": "One member indicator of a campaign/cluster.",
      "properties": {
        "uuid": {
          "type": "string",
          "format": "uuid"
        },
        "domain": {
          "type": "string"
        },
        "registrable_domain": {
          "type": "string",
          "description": "This member's registrable domain (Public Suffix List, private section included). Equals `domain` for a member that is its own apex; several members can share the same `registrable_domain` (see the campaign's `domains` grouping)."
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Null when the member has been pruned from the live dataset (retention) but is still listed for completeness."
        },
        "company": {
          "type": "string",
          "description": "Targeted brand slug."
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "offline"
          ]
        },
        "first_seen": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "relationship_score": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 100,
          "description": "Best (highest) score among this cluster's internal edges touching this member. Null when the member has no internal edge."
        },
        "relationship_tier": {
          "type": [
            "string",
            "null"
          ],
          "description": "Score tier of the same best internal edge relationship_score is drawn from (e.g. \"high\"/\"medium\"/\"low\"). Null under the same condition as relationship_score."
        },
        "detail_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "image": {
          "type": [
            "string",
            "null"
          ],
          "description": "Screenshot path, relative to the static root. Coverage is not guaranteed for every member."
        },
        "phishunt_score": {
          "type": [
            "integer",
            "null"
          ],
          "description": "This member's own detection score (0-100) from the 5-layer detector - unrelated to relationship_score."
        },
        "ip": {
          "type": [
            "string",
            "null"
          ]
        },
        "asn": {
          "type": [
            "string",
            "null"
          ]
        },
        "org": {
          "type": [
            "string",
            "null"
          ],
          "description": "Hosting organization."
        },
        "country": {
          "type": [
            "string",
            "null"
          ],
          "description": "Hosting country."
        },
        "registrar": {
          "type": [
            "string",
            "null"
          ]
        },
        "cert": {
          "type": [
            "string",
            "null"
          ],
          "description": "TLS certificate issuer."
        },
        "gsb_category": {
          "type": [
            "string",
            "null"
          ],
          "description": "Google Safe Browsing threat category, when flagged."
        },
        "malicious_google": {
          "type": [
            "string",
            "null"
          ],
          "description": "\"1\" or \"0\" - unlike the equivalent field on the Site schema (`/api/v1/domains`, `/feed.json`), this is NOT cast to a real JSON boolean here; it is passed straight through from the underlying text column. An empty string means that source was never asked (urlscan timeout or quota). Null when the member has no live row."
        },
        "malicious_openphish": {
          "type": [
            "string",
            "null"
          ],
          "description": "Same \"1\"/\"0\" string convention as malicious_google - see its note."
        },
        "malicious_phishtank": {
          "type": [
            "string",
            "null"
          ],
          "description": "Same \"1\"/\"0\" string convention as malicious_google - see its note."
        },
        "malicious_tweetfeed": {
          "type": [
            "string",
            "null"
          ],
          "description": "Same \"1\"/\"0\" string convention as malicious_google - see its note."
        },
        "malicious_urlscan": {
          "type": [
            "string",
            "null"
          ],
          "description": "Same \"1\"/\"0\" string convention as malicious_google - see its note."
        }
      }
    },
    "Relationship": {
      "type": "object",
      "description": "One member-to-member link that actually formed this cluster (a FORMATION internal edge). Shared-infrastructure grouping of public detections, not an attribution claim.",
      "properties": {
        "domain_a": {
          "type": "string"
        },
        "domain_b": {
          "type": "string"
        },
        "detail_url_a": {
          "type": [
            "string",
            "null"
          ],
          "description": "Link to domain_a's detail page. Null when domain_a no longer has a live indicator row (pruned by retention)."
        },
        "detail_url_b": {
          "type": [
            "string",
            "null"
          ],
          "description": "Link to domain_b's detail page. Null when domain_b no longer has a live indicator row (pruned by retention)."
        },
        "score": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100,
          "description": "This edge's persisted relationship score."
        },
        "tier": {
          "type": "string",
          "description": "Persisted score tier for this edge (e.g. \"high\"/\"medium\"/\"low\")."
        },
        "demotion_reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "When set, the engine demoted this edge's display tier after scoring (e.g. failed_high_gate, same_kit_cap) - a display-only adjustment; it does not undo formation."
        },
        "first_reproduced": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Date part of this edge's `valid_from` - when this specific link was first recorded."
        },
        "evidence": {
          "type": "array",
          "description": "This pair's evidence rows with a positive contribution, sorted by `contributed` descending, capped at 12. Rows whose signal has no fixed display label are omitted.",
          "items": {
            "$ref": "#/$defs/RelationshipEvidence"
          }
        },
        "discounted": {
          "type": "array",
          "description": "Evidence rows the engine dampened to zero or below (e.g. hub_cardinality_cap, correlated-signal dampening) - contributed nothing to `score`, kept separately here (\"what did NOT count and why\") rather than dropped. Sorted by `contributed` descending (least discounted first), capped at 6.",
          "items": {
            "$ref": "#/$defs/RelationshipEvidence"
          }
        }
      }
    },
    "RelationshipEvidence": {
      "type": "object",
      "description": "One evidence row within a Relationship's `evidence` or `discounted` list.",
      "properties": {
        "label": {
          "type": "string",
          "description": "Fixed, human-readable label for this signal (e.g. \"same IP\", \"same TLS cert\"). Never a de-underscored raw signal id."
        },
        "signal": {
          "type": "string",
          "description": "Stable evidence-signal identifier, e.g. `same_ip`, `cert_fingerprint_exact`."
        },
        "category": {
          "type": [
            "string",
            "null"
          ],
          "description": "The engine's evidence category for this signal."
        },
        "contributed": {
          "type": [
            "number",
            "null"
          ],
          "description": "Points this row contributed toward the edge's `score`. <= 0 rows only ever appear in `discounted`."
        },
        "idf_factor": {
          "type": [
            "number",
            "null"
          ],
          "format": "float",
          "description": "Inverse-document-frequency discount applied to this signal's base weight - a value shared by many sites scores lower than one shared by few."
        },
        "dampened_by": {
          "type": [
            "string",
            "null"
          ],
          "description": "When set, the reason this row's contribution was reduced (e.g. hub_cardinality_cap, correlated-signal dampening)."
        }
      }
    }
  }
}