{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/scanmalware-com/json-schema/scanmalware-com-ct-dns-response-schema.json",
  "title": "CtDnsResponse",
  "description": "DNS observations for a domain and, by default, its subdomains.",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/scanmalware-com-openapi.json#/components/schemas/CtDnsResponse",
  "properties": {
    "domain": {
      "type": "string",
      "title": "Domain",
      "description": "The domain queried, normalised to lower case."
    },
    "dns_records": {
      "items": {
        "$ref": "#/$defs/CtDnsRecord"
      },
      "type": "array",
      "title": "Dns Records",
      "description": "The 100 most recent observations."
    },
    "ip_addresses": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Ip Addresses",
      "description": "Addresses for the apex and www ONLY. Each subdomain's own addresses are in its record's `ip` field."
    },
    "total_records": {
      "type": "integer",
      "title": "Total Records",
      "description": "Number of entries in `dns_records`."
    },
    "subdomains": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Subdomains",
      "description": "Distinct hostnames below the domain, `www` included. Names that were NXDOMAIN every time we resolved them are listed in `subdomains_unresolved` instead."
    },
    "subdomain_count": {
      "type": "integer",
      "title": "Subdomain Count",
      "description": "Number of entries in `subdomains`."
    },
    "subdomains_unresolved": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Subdomains Unresolved",
      "description": "ALWAYS PRESENT. Hostnames below the domain that appear in certificates but were NXDOMAIN every time we resolved them. Most are retired or internal names. Kept apart from `subdomains` so that list holds names that existed in public DNS when observed."
    },
    "subdomains_unresolved_count": {
      "type": "integer",
      "title": "Subdomains Unresolved Count",
      "description": "Number of entries in `subdomains_unresolved`.",
      "default": 0
    },
    "subdomains_truncated": {
      "type": "boolean",
      "title": "Subdomains Truncated",
      "description": "True when `subdomain_limit` was reached, so a partial list is never mistaken for a complete one. ⚠️ This answers ONLY 'did the cap bite'. It is `false` on a degraded response too, because no cap was reached — check `degraded` for 'is this an answer at all'."
    },
    "degraded": {
      "type": "boolean",
      "title": "Degraded",
      "description": "ALWAYS PRESENT. `false` means the counters are a measurement: we looked and this is what exists. `true` means we could NOT look, and every zero above is an absence of data about the domain rather than a fact about it — retry rather than recording `subdomain_count: 0`. This is the field to branch on; `subdomains_truncated` answers a different question."
    },
    "degraded_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Degraded Reason",
      "description": "Present only when `degraded` is true. One of `back_pressure` (we shed this request to protect the upstream store and never queried it — by far the most common, and a plain retry usually succeeds), `timeout`, `circuit_open`, `partial_result`, `upstream_error`, `internal_error`."
    },
    "stale": {
      "type": "boolean",
      "title": "Stale",
      "description": "ALWAYS PRESENT. `true` means this is a real, previously-measured answer served from cache past its freshness window, because a re-look could not be performed. The hostnames in it are genuine; the list may be missing anything observed since. `degraded` stays `false` — the counters are a measurement, just an older one."
    },
    "stale_age_seconds": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Stale Age Seconds",
      "description": "Present only when `stale` is true: how long ago this answer was measured."
    },
    "stale_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Stale Reason",
      "description": "Present only when `stale` is true: why the re-look did not happen. Same vocabulary as `degraded_reason`."
    },
    "partial": {
      "type": "boolean",
      "title": "Partial",
      "description": "ALWAYS PRESENT. `true` means this is a real answer but the subdomain search was narrowed, as `partial_reason` describes. Every hostname in it is genuine; names below `domain` may be missing. `degraded` stays `false` and `subdomains_truncated` is unaffected.",
      "default": false
    },
    "partial_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Partial Reason",
      "description": "Present only when `partial` is true. Currently always `large_parent_recent_only`: `domain` sits two or more labels below a registrable domain that holds a very large number of hostnames, so older observations were matched on `domain` itself and names below it are listed from recent observations only."
    },
    "error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error",
      "description": "Human-readable form of `degraded_reason`. Present only when `degraded` is true; absent on success. Branch on `degraded`/`degraded_reason`, not on this string — its wording is not a stable interface."
    },
    "nameserver_hosts": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Nameserver Hosts",
      "description": "Hostnames below `domain` that other domains name as their nameserver (from registry delegation data), sorted. NOT from certificates, so never part of `subdomains`. Present only when this answer was measured with it; absent on older cached answers."
    },
    "nameserver_host_count": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Nameserver Host Count",
      "description": "Number of entries in `nameserver_hosts`."
    },
    "nameserver_hosts_truncated": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Nameserver Hosts Truncated",
      "description": "True when `nameserver_hosts` reached `subdomain_limit`."
    },
    "rdns_hosts": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Rdns Hosts",
      "description": "Hostnames below `domain` seen as reverse-DNS (PTR) names of IP addresses, sorted. NOT from certificates, so never part of `subdomains`; a PTR name need not resolve forward. Present only when this answer was measured with it."
    },
    "rdns_host_count": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Rdns Host Count",
      "description": "Number of entries in `rdns_hosts`."
    },
    "rdns_hosts_truncated": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Rdns Hosts Truncated",
      "description": "True when `rdns_hosts` reached `subdomain_limit`."
    },
    "other_hosts_degraded": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Other Hosts Degraded",
      "description": "Present together with `nameserver_hosts` and `rdns_hosts`. `true` means those two lists could not be looked up and their zeros are not a measurement; the certificate fields above are unaffected."
    }
  },
  "type": "object",
  "required": [
    "domain",
    "total_records",
    "subdomain_count",
    "subdomains_truncated",
    "degraded",
    "stale"
  ],
  "$defs": {
    "CtDnsRecord": {
      "properties": {
        "domain": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Domain",
          "description": "The hostname this record is for."
        },
        "ip": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Ip",
          "description": "Addresses it resolved to. FREQUENTLY EMPTY, and that is meaningful, not missing data: the hostname was published in a certificate but did not resolve when observed. `resolution_error` says why."
        },
        "record_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Record Type",
          "description": "DNS record type, e.g. A or AAAA."
        },
        "timestamp": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Timestamp",
          "description": "When the observation was made (ISO 8601)."
        },
        "ttl": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ttl",
          "description": "Record TTL in seconds."
        },
        "root_domain": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Root Domain",
          "description": "Registrable parent of `domain`."
        },
        "resolution_error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Resolution Error",
          "description": "Why `ip` is empty, e.g. `nxdomain`. Null when it resolved."
        }
      },
      "type": "object",
      "title": "CtDnsRecord",
      "description": "One observed DNS record for a hostname seen in Certificate Transparency."
    }
  }
}