{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/merlonix-com/json-schema/merlonix-com-asset-create-schema.json",
  "title": "AssetCreate",
  "description": "Request body for creating a monitored asset (TD-925).",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/merlonix-com-openapi.yml#/components/schemas/AssetCreate",
  "type": "object",
  "required": [
    "asset_type",
    "hostname"
  ],
  "properties": {
    "asset_type": {
      "type": "string",
      "enum": [
        "domain",
        "hostname",
        "certificate",
        "dns_record"
      ]
    },
    "hostname": {
      "type": "string",
      "description": "The hostname / domain to monitor."
    },
    "attestation_id": {
      "type": "string",
      "format": "uuid",
      "description": "Optional ownership attestation; must belong to the tenant."
    },
    "label": {
      "type": "string",
      "maxLength": 120,
      "description": "Optional human label."
    },
    "client_name": {
      "type": "string",
      "maxLength": 120
    },
    "client_id": {
      "type": "string",
      "format": "uuid",
      "description": "Optional client bucket; defaults to Unassigned."
    },
    "check_interval_sec": {
      "type": "integer",
      "minimum": 60,
      "maximum": 86400,
      "description": "Check cadence. Clamped up to the plan minimum if faster than the tier allows."
    },
    "ssl_enabled": {
      "type": "boolean"
    },
    "dns_enabled": {
      "type": "boolean"
    },
    "domain_enabled": {
      "type": "boolean",
      "description": "Opt into monitored domain-expiry (RDAP) checks."
    },
    "dnsbl_enabled": {
      "type": "boolean",
      "description": "Opt into monitored DNS-blocklist (DNSBL) checks."
    },
    "dns_security_enabled": {
      "type": "boolean",
      "description": "Opt into monitored DNSSEC + DANE/TLSA posture checks (informational)."
    },
    "security_headers_enabled": {
      "type": "boolean",
      "description": "Opt into the monitored HTTP security-header check (re-grades the six core headers on cadence + alerts when one disappears; informational)."
    },
    "email_auth_enabled": {
      "type": "boolean",
      "description": "Opt into the monitored email-auth (SPF/DMARC/MTA-STS/BIMI) posture check."
    },
    "ct_watch_enabled": {
      "type": "boolean",
      "description": "Opt into Certificate-Transparency rogue/shadow-cert monitoring. Paid monitoring tiers only (team/agency/compliance)."
    },
    "agent_readiness_enabled": {
      "type": "boolean",
      "description": "Opt into monitored Agent-Readiness checks."
    },
    "mcp_health_enabled": {
      "type": "boolean",
      "description": "Opt into monitored MCP-server health checks (discovers the MCP endpoint from /.well-known/mcp.json and runs a real JSON-RPC handshake + tools/list; alerts on downtime and tool/schema drift)."
    },
    "heartbeat_enabled": {
      "type": "boolean",
      "description": "Opt into the inbound heartbeat (dead-man's-switch) monitor. The ingest token is server-minted on first enable."
    },
    "heartbeat_period_sec": {
      "type": "integer",
      "minimum": 1,
      "description": "Expected heartbeat interval in seconds."
    },
    "heartbeat_grace_sec": {
      "type": "integer",
      "minimum": 0,
      "description": "Tolerance in seconds before a missed beat is declared dead."
    },
    "port_enabled": {
      "type": "boolean",
      "description": "Opt into the outbound TCP-port monitor."
    },
    "port_check_port": {
      "type": "integer",
      "minimum": 1,
      "maximum": 65535,
      "description": "TCP port to probe on the asset's hostname."
    },
    "psi_enabled": {
      "type": "boolean",
      "description": "Opt into the PageSpeed Insights (Lighthouse) performance monitor. Paid monitoring tiers only (team/agency/compliance)."
    },
    "psi_check_url": {
      "type": "string",
      "format": "uri",
      "description": "Optional override URL to measure with PageSpeed Insights (defaults to https://<hostname>)."
    },
    "health_enabled": {
      "type": "boolean",
      "description": "Opt into the application-health monitor (polls a JSON health endpoint). Paid monitoring tiers only (team/agency/compliance)."
    },
    "health_check_url": {
      "type": "string",
      "format": "uri",
      "description": "JSON health endpoint to poll (laravel-health / Oh Dear shape, with a generic fallback). SSRF-guarded."
    },
    "health_check_config": {
      "type": "object",
      "description": "TD-941 application-health config. headers: auth header(s) sent with the GET (≤10, envelope headers rejected, values never logged); stale_after_sec: freshness window in seconds (30..86400, default 600).",
      "properties": {
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "maxLength": 2048
          }
        },
        "stale_after_sec": {
          "type": "integer",
          "minimum": 30,
          "maximum": 86400
        }
      }
    },
    "crawl_enabled": {
      "type": "boolean",
      "description": "Opt into the broken-links / mixed-content crawler. Paid monitoring tiers only (team/agency/compliance)."
    },
    "crawl_root_url": {
      "type": "string",
      "format": "uri",
      "description": "Optional crawl root URL (defaults to https://<hostname>)."
    },
    "injection_scan_enabled": {
      "type": "boolean",
      "description": "Opt into the prompt-injection / hidden-text scan (computed-DOM render). Paid monitoring tiers only (team/agency/compliance)."
    },
    "uptime_check_url": {
      "type": "string",
      "format": "uri",
      "description": "Enables HTTP uptime checks when set (GET probe). For method/headers/body/redirect assertions use uptime_check_config."
    },
    "uptime_check_config": {
      "type": "object",
      "description": "TD-935 structured uptime probe (wins over uptime_check_url). method=GET|HEAD|POST|PUT|PATCH; optional custom headers (≤20, forbidden envelope headers rejected), body (≤8KiB, body-bearing methods only), expected_status, keyword_match, and expected_final_url (redirect-target assertion — DOWN if the final URL after one redirect hop differs). Timing reported: ttfb_ms (headers received) and response_time_ms (total/body read). Cloudflare Workers fetch() exposes no DNS/TCP/TLS phase breakdown, so those are not reported.",
      "required": [
        "check_url"
      ],
      "properties": {
        "check_url": {
          "type": "string",
          "format": "uri"
        },
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "HEAD",
            "POST",
            "PUT",
            "PATCH"
          ]
        },
        "expected_status": {
          "type": "integer",
          "minimum": 100,
          "maximum": 599
        },
        "keyword_match": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 200
        },
        "timeout_ms": {
          "type": "integer",
          "minimum": 1000,
          "maximum": 30000
        },
        "headers": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string",
            "maxLength": 1024
          }
        },
        "body": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 8192
        },
        "expected_final_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        }
      }
    },
    "vendor_dependencies": {
      "type": "array",
      "maxItems": 11,
      "items": {
        "type": "string",
        "enum": [
          "stripe",
          "cloudflare",
          "aws",
          "openai",
          "anthropic",
          "vercel",
          "github",
          "shopify",
          "slack",
          "google_cloud",
          "azure"
        ]
      }
    }
  }
}