{
  "openapi": "3.1.0",
  "info": {
    "title": "Lead-Anything API (W4-C06)",
    "version": "1.0.0",
    "summary": "Public Company Signal, Tech Stack, ICP Lookalike, Hiring Intent & Buyer-Readiness Engine ($0 on Miss, Parked, Fake-200, or SSRF 422)",
    "description": "Deterministic 5-dimension public corporate intelligence engine analyzing public websites, HTTP headers, HTML tags, DNS TXT/MX/CNAME records, /.well-known endpoints, public ATS boards (Greenhouse/Lever/Ashby) and /careers pages, RSS/Atom/changelog feeds, and SEC Form D filings. Enforces strict SSRF blocking (HTTP 422, billed_micros=0), anti-fake-200 WAF/CAPTCHA/parking gating (billed_micros=0), cross-tenant adaptive 7d-30d verified-hit archive caching (100% new tenant / 10% same-tenant repeat), SHA-256 verification receipts, public corporate intel only, zero private PII harvesting, zero cold email sending, and zero customer data resale.",
    "contact": {
      "name": "Lead-Anything Operations",
      "email": "ops@fastmesh.dev",
      "url": "https://lead.fastmesh.dev"
    }
  },
  "servers": [
    {
      "url": "https://lead.fastmesh.dev",
      "description": "Production HTTPS Gateway"
    },
    {
      "url": "http://127.0.0.1:9006",
      "description": "Local Upstream Instance"
    }
  ],
  "tags": [
    {
      "name": "System",
      "description": "Health, OpenAPI discovery, and transparent prepaid credit pricing"
    },
    {
      "name": "Intelligence",
      "description": "5-dimension public corporate signal extraction, ICP lookalike ranking, and concurrent CSV/JSON batch enrichment"
    },
    {
      "name": "MCP",
      "description": "Native JSON-RPC 2.0 Model Context Protocol endpoint"
    },
    {
      "name": "Billing",
      "description": "Creem.io HMAC-SHA256 webhook receiver for idempotent prepaid credit fulfillment"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": ["System"],
        "operationId": "getHealth",
        "summary": "Service liveness, archive cache telemetry, ledger stats, and zero-on-miss runtime metadata",
        "responses": {
          "200": {
            "description": "Service is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "tags": ["System"],
        "operationId": "getOpenApiSpec",
        "summary": "Return this OpenAPI 3.1.0 machine-readable schema",
        "responses": {
          "200": {
            "description": "OpenAPI 3.1.0 JSON document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pricing": {
      "get": {
        "tags": ["System"],
        "operationId": "getPricing",
        "summary": "Return prepaid Creem credit packs ($19/$79/$249), micro-USD unit prices, and $0-on-miss SLA",
        "responses": {
          "200": {
            "description": "Prepaid SKU catalog and micro-USD pricing schedule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/analyze": {
      "post": {
        "tags": ["Intelligence"],
        "operationId": "analyzeAccount",
        "summary": "Full 5-dimension buyer-readiness account scorecard ($0.020 verified hit; $0 on miss, parked/shell, fake-200/CAPTCHA, or SSRF 422)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalyzeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Full buyer-readiness scorecard envelope (billed_micros=0 if dead/parked/shell, fake-200/CAPTCHA, unreachable, or empty)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyzeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON request body (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Hard max_cost_micros budget cap exceeded before execution (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "SSRF blocked (localhost, RFC1918, metadata, IPv6-local, unsafe redirect) or invalid/junk domain (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account": {
      "post": {
        "tags": ["Intelligence"],
        "operationId": "analyzeAccountAlias",
        "summary": "Canonical alias of POST /v1/analyze with identical request/response contract and $0-on-miss SLA",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalyzeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Full buyer-readiness scorecard envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyzeResponse"
                }
              }
            }
          },
          "402": {
            "description": "Budget cap exceeded (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "SSRF blocked or invalid/junk domain (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tech-stack": {
      "post": {
        "tags": ["Intelligence"],
        "operationId": "detectTechStack",
        "summary": "Detect public CDN/Hosting, Payment Rails, CRM/Analytics, Email/Auth (SPF/DMARC/MX), Frameworks, and /.well-known endpoints ($0.008 verified hit; $0 on miss/fake-200/SSRF 422)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TechStackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deterministic tech stack detection profile and evidence receipts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TechStackResponse"
                }
              }
            }
          },
          "402": {
            "description": "Budget cap exceeded (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "SSRF blocked or invalid domain (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/lookalike": {
      "post": {
        "tags": ["Intelligence"],
        "operationId": "scoreLookalikes",
        "summary": "Deterministically rank candidate accounts (0-100) against 1-5 benchmark ICP accounts using industry cosine, tech-stack Jaccard, pricing alignment, and maturity proximity ($0.012 verified hit)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LookalikeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ranked lookalike candidates with 4-dimension subscores and match_reasons",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LookalikeResponse"
                }
              }
            }
          },
          "402": {
            "description": "Budget cap exceeded (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid benchmarks or empty candidates (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signals": {
      "post": {
        "tags": ["Intelligence"],
        "operationId": "extractSignals",
        "summary": "Parse public hiring intent (/careers, Greenhouse/Lever/Ashby JSON) and growth pulse (RSS/Atom, /changelog, SEC Form D, press releases) with evidence snippets ($0.010 verified hit; $0 when empty)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignalsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Hiring intent and growth pulse extraction envelope (billed_micros=0 when 0 roles and 0 events)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignalsResponse"
                }
              }
            }
          },
          "402": {
            "description": "Budget cap exceeded (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "SSRF blocked or invalid domain (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/batch": {
      "post": {
        "tags": ["Intelligence"],
        "operationId": "batchEnrich",
        "summary": "Concurrent multi-account CSV/JSON batch enrichment (50+ accounts) with deterministic ordering, optional CSV export, per-row $0-on-miss protection, and hard max_cost_micros cap ($0.015 per verified item)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ordered batch enrichment results with cumulative micro-USD accounting and optional CSV export",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchResponse"
                }
              }
            }
          },
          "402": {
            "description": "Hard max_cost_micros cap exceeded (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid or empty accounts list / CSV payload (billed_micros=0)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "tags": ["MCP"],
        "operationId": "mcpJsonRpc",
        "summary": "Native JSON-RPC 2.0 Model Context Protocol endpoint (initialize, notifications/initialized, ping, tools/list, tools/call for lead_analyze_account, lead_detect_tech_stack, lead_score_lookalikes, lead_parse_hiring_pulse, lead_batch_enrich)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpJsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 MCP response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/McpJsonRpcResponse"
                }
              }
            }
          },
          "202": {
            "description": "JSON-RPC 2.0 notification accepted (no response body)"
          }
        }
      }
    },
    "/webhooks/creem": {
      "post": {
        "tags": ["Billing"],
        "operationId": "creemWebhook",
        "summary": "HMAC-SHA256 verified idempotent Creem.io prepaid credit fulfillment webhook (accepts X-Creem-Signature or creem-signature)",
        "parameters": [
          {
            "name": "X-Creem-Signature",
            "in": "header",
            "required": false,
            "description": "HMAC-SHA256 hex digest (optionally prefixed with sha256=) computed with CREEM_WEBHOOK_SECRET",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "creem-signature",
            "in": "header",
            "required": false,
            "description": "Standard Creem webhook HMAC-SHA256 signature header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreemWebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook processed or idempotently replayed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreemWebhookResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON payload"
          },
          "401": {
            "description": "Invalid X-Creem-Signature / creem-signature HMAC-SHA256 digest"
          },
          "503": {
            "description": "CREEM_WEBHOOK_SECRET is not configured on this instance"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "required": ["status", "ok", "engine_id", "service", "port", "zero_on_miss_billing"],
        "properties": {
          "status": { "type": "string", "example": "ok" },
          "ok": { "type": "boolean", "example": true },
          "engine_id": { "type": "string", "example": "W4-C06" },
          "service": { "type": "string", "example": "lead-anything" },
          "port": { "type": "integer", "example": 9006 },
          "zero_on_miss_billing": { "type": "boolean", "example": true },
          "zero_on_miss": { "type": "boolean", "example": true },
          "archive_cache": { "type": "object" },
          "cache_stats": { "type": "object" },
          "ledger_stats": { "type": "object" },
          "dimensions": {
            "type": "array",
            "items": { "type": "string" }
          },
          "timestamp_utc": { "type": "string", "format": "date-time" }
        }
      },
      "PricingResponse": {
        "type": "object",
        "properties": {
          "schema_version": { "type": "string" },
          "engine_id": { "type": "string", "example": "W4-C06" },
          "product_name": { "type": "string", "example": "Lead-Anything" },
          "currency": { "type": "string", "example": "USD" },
          "zero_on_miss_sla": { "type": "object" },
          "unit_prices_micros": { "type": "object" },
          "skus": {
            "type": "array",
            "items": { "type": "object" }
          }
        }
      },
      "CompanyProfile": {
        "type": "object",
        "properties": {
          "domain": { "type": "string", "example": "stripe.com" },
          "company_name": { "type": "string", "example": "Stripe" },
          "industry": { "type": "string", "example": "developer payments infrastructure" },
          "keywords": {
            "type": "array",
            "items": { "type": "string" }
          },
          "description": { "type": "string" },
          "technologies": {
            "type": "array",
            "items": { "type": "string" }
          },
          "pricing_model": { "type": "string", "example": "usage_based" },
          "team_size": { "type": "integer", "example": 500 },
          "stage": { "type": "string", "example": "growth" }
        }
      },
      "OfflineSnapshot": {
        "type": "object",
        "description": "Optional deterministic offline snapshot for zero-network evaluation or replay testing",
        "properties": {
          "status_code": { "type": "integer", "example": 200 },
          "headers": { "type": "object" },
          "html": { "type": "string" },
          "dns_records": { "type": "object" },
          "well_known": { "type": "object" },
          "careers_html": { "type": "string" },
          "greenhouse_json": { "type": "object" },
          "lever_json": { "type": "array", "items": { "type": "object" } },
          "ashby_json": { "type": "object" },
          "job_postings": { "type": "array", "items": { "type": "object" } },
          "rss_xml": { "type": "string" },
          "changelog_html": { "type": "string" },
          "sec_form_d_xml": { "type": "string" },
          "press_releases": { "type": "array", "items": { "type": "object" } },
          "company_profile": { "$ref": "#/components/schemas/CompanyProfile" }
        }
      },
      "AnalyzeRequest": {
        "type": "object",
        "description": "Provide `domain` or `url` (public corporate domain; private/loopback/metadata hosts blocked with HTTP 422 and billed_micros=0).",
        "properties": {
          "domain": { "type": "string", "example": "stripe.com" },
          "url": { "type": "string", "format": "uri", "example": "https://stripe.com" },
          "benchmarks": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "oneOf": [
                { "type": "string" },
                { "$ref": "#/components/schemas/CompanyProfile" }
              ]
            }
          },
          "candidate_profile": { "$ref": "#/components/schemas/CompanyProfile" },
          "snapshot": { "$ref": "#/components/schemas/OfflineSnapshot" },
          "probe_well_known": { "type": "boolean", "default": true },
          "probe_live_subpages": { "type": "boolean", "default": false },
          "tenant_id": { "type": "string", "default": "public" },
          "max_cost_micros": { "type": "integer", "minimum": 0, "example": 50000 },
          "allow_cache": { "type": "boolean", "default": true },
          "verify": { "type": "boolean", "default": false },
          "confirm": { "type": "boolean", "default": false },
          "byok_provider": { "type": ["string", "null"] },
          "allow_managed_fallback": { "type": "boolean", "default": false }
        }
      },
      "AnalyzeResponse": {
        "type": "object",
        "required": [
          "ok",
          "status",
          "status_code",
          "billed_micros",
          "receipt_sha256"
        ],
        "properties": {
          "ok": { "type": "boolean" },
          "engine_id": { "type": "string", "example": "W4-C06" },
          "service": { "type": "string", "example": "lead-anything" },
          "status": { "type": "string", "example": "verified" },
          "status_code": { "type": "integer", "example": 200 },
          "domain": { "type": "string", "example": "stripe.com" },
          "final_url": { "type": "string" },
          "buyer_readiness_score": { "type": "number", "minimum": 0, "maximum": 100 },
          "tier": { "type": "string", "enum": ["HOT", "WARM", "MONITOR", "COLD"] },
          "tech_stack": { "type": "object" },
          "icp_match": { "type": ["object", "null"] },
          "hiring_intent": { "type": "object" },
          "growth_pulse": { "type": "object" },
          "scorecard": { "type": "object" },
          "billed_micros": { "type": "integer", "minimum": 0 },
          "upstream_cost_micros": { "type": "integer", "minimum": 0 },
          "cache_hit": { "type": "boolean" },
          "cache_status": { "type": "string" },
          "billing_tier": { "type": "string" },
          "fake_200_detected": { "type": "boolean" },
          "blocked_reason": { "type": ["string", "null"] },
          "receipt_sha256": { "type": "string" },
          "observed_at_utc": { "type": "string", "format": "date-time" },
          "trace": { "type": "object" }
        }
      },
      "TechStackRequest": {
        "type": "object",
        "properties": {
          "domain": { "type": "string", "example": "vercel.com" },
          "url": { "type": "string", "format": "uri" },
          "snapshot": { "$ref": "#/components/schemas/OfflineSnapshot" },
          "probe_well_known": { "type": "boolean", "default": true },
          "tenant_id": { "type": "string", "default": "public" },
          "max_cost_micros": { "type": "integer", "minimum": 0 },
          "allow_cache": { "type": "boolean", "default": true },
          "byok_provider": { "type": ["string", "null"] },
          "allow_managed_fallback": { "type": "boolean", "default": false }
        }
      },
      "TechStackResponse": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "status": { "type": "string" },
          "status_code": { "type": "integer" },
          "domain": { "type": "string" },
          "tech_stack": { "type": "object" },
          "billed_micros": { "type": "integer", "minimum": 0 },
          "cache_hit": { "type": "boolean" },
          "cache_status": { "type": "string" },
          "billing_tier": { "type": "string" },
          "receipt_sha256": { "type": "string" }
        }
      },
      "LookalikeRequest": {
        "type": "object",
        "required": ["benchmarks", "candidates"],
        "properties": {
          "benchmarks": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "oneOf": [
                { "type": "string" },
                { "$ref": "#/components/schemas/CompanyProfile" }
              ]
            }
          },
          "candidates": {
            "type": "array",
            "minItems": 1,
            "items": {
              "oneOf": [
                { "type": "string" },
                { "$ref": "#/components/schemas/CompanyProfile" }
              ]
            }
          },
          "weights": {
            "type": "object",
            "properties": {
              "industry_keyword_cosine": { "type": "number", "default": 0.35 },
              "tech_stack_jaccard": { "type": "number", "default": 0.3 },
              "pricing_model_alignment": { "type": "number", "default": 0.2 },
              "team_maturity_proximity": { "type": "number", "default": 0.15 }
            }
          },
          "tenant_id": { "type": "string", "default": "public" },
          "max_cost_micros": { "type": "integer", "minimum": 0 },
          "allow_cache": { "type": "boolean", "default": true }
        }
      },
      "LookalikeResponse": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "status": { "type": "string" },
          "status_code": { "type": "integer" },
          "lookalike": { "type": "object" },
          "ranked_candidates": {
            "type": "array",
            "items": { "type": "object" }
          },
          "billed_micros": { "type": "integer", "minimum": 0 },
          "cache_hit": { "type": "boolean" },
          "cache_status": { "type": "string" },
          "receipt_sha256": { "type": "string" }
        }
      },
      "SignalsRequest": {
        "type": "object",
        "properties": {
          "domain": { "type": "string", "example": "stripe.com" },
          "url": { "type": "string", "format": "uri" },
          "snapshot": { "$ref": "#/components/schemas/OfflineSnapshot" },
          "probe_live_subpages": { "type": "boolean", "default": true },
          "tenant_id": { "type": "string", "default": "public" },
          "max_cost_micros": { "type": "integer", "minimum": 0 },
          "allow_cache": { "type": "boolean", "default": true }
        }
      },
      "SignalsResponse": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "status": { "type": "string" },
          "status_code": { "type": "integer" },
          "domain": { "type": "string" },
          "hiring_intent": { "type": "object" },
          "growth_pulse": { "type": "object" },
          "billed_micros": { "type": "integer", "minimum": 0 },
          "cache_hit": { "type": "boolean" },
          "receipt_sha256": { "type": "string" }
        }
      },
      "BatchRequest": {
        "type": "object",
        "description": "Provide `accounts` array or `csv_text` string (50+ accounts supported).",
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "oneOf": [
                { "type": "string" },
                { "type": "object" }
              ]
            }
          },
          "csv_text": { "type": "string" },
          "benchmarks": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "oneOf": [
                { "type": "string" },
                { "$ref": "#/components/schemas/CompanyProfile" }
              ]
            }
          },
          "export_csv": { "type": "boolean", "default": false },
          "tenant_id": { "type": "string", "default": "public" },
          "max_cost_micros": { "type": "integer", "minimum": 0 },
          "allow_cache": { "type": "boolean", "default": true },
          "max_workers": { "type": "integer", "minimum": 1, "maximum": 12, "default": 8 }
        }
      },
      "BatchResponse": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "status": { "type": "string" },
          "status_code": { "type": "integer" },
          "batch_id": { "type": "string" },
          "total_accounts": { "type": "integer" },
          "verified_hits": { "type": "integer" },
          "cache_hits": { "type": "integer" },
          "unbilled_count": { "type": "integer" },
          "total_billed_micros": { "type": "integer", "minimum": 0 },
          "billed_micros": { "type": "integer", "minimum": 0 },
          "budget_cap_reached": { "type": "boolean" },
          "batch_sha256": { "type": "string" },
          "receipt_sha256": { "type": "string" },
          "elapsed_ms": { "type": "number" },
          "results": {
            "type": "array",
            "items": { "type": "object" }
          },
          "csv_export": { "type": ["string", "null"] }
        }
      },
      "McpJsonRpcRequest": {
        "type": "object",
        "required": ["jsonrpc", "method"],
        "properties": {
          "jsonrpc": { "type": "string", "const": "2.0" },
          "id": { "type": ["string", "integer", "null"] },
          "method": {
            "type": "string",
            "enum": ["initialize", "notifications/initialized", "ping", "tools/list", "tools/call"]
          },
          "params": { "type": "object" }
        }
      },
      "McpJsonRpcResponse": {
        "type": "object",
        "required": ["jsonrpc"],
        "properties": {
          "jsonrpc": { "type": "string", "const": "2.0" },
          "id": { "type": ["string", "integer", "null"] },
          "result": { "type": "object" },
          "error": { "type": "object" }
        }
      },
      "CreemWebhookEvent": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "example": "evt_01JXYZ..." },
          "eventType": {
            "type": "string",
            "enum": ["checkout.completed", "refund.created", "dispute.created"]
          },
          "object": {
            "type": "object",
            "properties": {
              "id": { "type": "string" },
              "product": { "type": "object" },
              "order": { "type": "object" },
              "customer": { "type": "object" },
              "metadata": {
                "type": "object",
                "properties": {
                  "tenant_id": { "type": "string" },
                  "sku_id": {
                    "type": "string",
                    "enum": ["sku_lead_starter_19", "sku_lead_growth_79", "sku_lead_scale_249"]
                  }
                }
              }
            }
          }
        }
      },
      "CreemWebhookResult": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean" },
          "status_code": { "type": "integer", "example": 200 },
          "event_id": { "type": "string" },
          "event_type": { "type": "string" },
          "tenant_id": { "type": "string" },
          "sku_id": { "type": "string" },
          "credit_micros_delta": { "type": "integer" },
          "balance_micros": { "type": "integer" },
          "duplicate": { "type": "boolean" },
          "idempotent": { "type": "boolean" },
          "payer_sha256_12": { "type": "string" },
          "payload_sha256": { "type": "string" }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean", "const": false },
          "status": { "type": "string" },
          "status_code": { "type": "integer" },
          "error_code": { "type": "string" },
          "blocked_reason": { "type": ["string", "null"] },
          "billed_micros": { "type": "integer", "const": 0 },
          "receipt_sha256": { "type": "string" }
        }
      }
    }
  }
}
