{
  "openapi": "3.1.0",
  "info": {
    "title": "Utility Hub | B2B & Web3",
    "version": "1.0.0",
    "description": "Deterministic lead hygiene, document extraction and offline wallet signing review. All POST requests use UTF-8 JSON with a 2 MiB limit. Origin authentication accepts the RapidAPI gateway proxy secret or a provider-issued direct trial key."
  },
  "servers": [
    {
      "url": "https://api-hub.sicbot.cn"
    }
  ],
  "tags": [
    {
      "name": "Utilities"
    },
    {
      "name": "Reference"
    }
  ],
  "paths": {
    "/v1/leads/clean": {
      "post": {
        "operationId": "cleanLeads",
        "summary": "Sales lead cleaner",
        "description": "Normalize JSON or CSV contacts and merge personal email or profile matches. A name and domain match may join an unambiguous group. sourceRows are 1-based input records. Suggested email corrections are advisory. CRM readiness covers name, usable email, domain, title and profile with hygiene deductions.",
        "tags": [
          "Utilities"
        ],
        "security": [
          {
            "RapidAPIProxySecret": []
          },
          {
            "DirectApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadRequest"
              },
              "examples": {
                "array": {
                  "summary": "Duplicate CRM exports",
                  "value": [
                    {
                      "name": "Ada Stone",
                      "title": "cto",
                      "email": "ADA@example.com"
                    },
                    {
                      "email": "ada@example.com",
                      "company": "Example",
                      "linkedinUrl": "https://linkedin.com/in/ada-stone/"
                    }
                  ]
                },
                "wrapped": {
                  "summary": "JSON envelope",
                  "value": {
                    "leads": [
                      {
                        "email": "buyer@gmial.com",
                        "title": "VP of Sales"
                      }
                    ]
                  }
                },
                "csv": {
                  "summary": "CSV with CRM headers",
                  "value": {
                    "csvText": "Full Name,Work Email,Job Title\nAda Stone,ada@example.com,CTO"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sales lead cleaner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadResult"
                },
                "examples": {
                  "array": {
                    "summary": "Duplicate CRM exports",
                    "value": {
                      "inputCount": 2,
                      "uniqueCount": 1,
                      "duplicatesRemoved": 1,
                      "records": [
                        {
                          "name": "Ada Stone",
                          "company": "Example",
                          "email": "ada@example.com",
                          "companyDomain": "example.com",
                          "title": "Chief Technology Officer",
                          "linkedinUrl": "https://www.linkedin.com/in/ada-stone",
                          "emailFlags": [],
                          "suggestedEmail": "",
                          "seniority": "Executive",
                          "department": "Engineering",
                          "missingFields": [],
                          "crmReadinessScore": 100,
                          "sourceRows": [
                            1,
                            2
                          ]
                        }
                      ]
                    }
                  },
                  "wrapped": {
                    "summary": "JSON envelope",
                    "value": {
                      "inputCount": 1,
                      "uniqueCount": 1,
                      "duplicatesRemoved": 0,
                      "records": [
                        {
                          "name": "",
                          "company": "",
                          "email": "buyer@gmial.com",
                          "companyDomain": "",
                          "title": "Vice President of Sales",
                          "linkedinUrl": "",
                          "emailFlags": [
                            "possible_typo"
                          ],
                          "suggestedEmail": "buyer@gmail.com",
                          "seniority": "VP",
                          "department": "Sales",
                          "missingFields": [
                            "name",
                            "companyDomain",
                            "linkedinUrl"
                          ],
                          "crmReadinessScore": 30,
                          "sourceRows": [
                            1
                          ]
                        }
                      ]
                    }
                  },
                  "csv": {
                    "summary": "CSV with CRM headers",
                    "value": {
                      "inputCount": 1,
                      "uniqueCount": 1,
                      "duplicatesRemoved": 0,
                      "records": [
                        {
                          "name": "Ada Stone",
                          "company": "",
                          "email": "ada@example.com",
                          "companyDomain": "example.com",
                          "title": "Chief Technology Officer",
                          "linkedinUrl": "",
                          "emailFlags": [],
                          "suggestedEmail": "",
                          "seniority": "Executive",
                          "department": "Engineering",
                          "missingFields": [
                            "linkedinUrl"
                          ],
                          "crmReadinessScore": 80,
                          "sourceRows": [
                            1
                          ]
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "411": {
            "$ref": "#/components/responses/LengthRequired"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMedia"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/docs/clean": {
      "post": {
        "operationId": "cleanDocument",
        "summary": "Document and HTML cleaner",
        "description": "Supply one document. HTML boilerplate is removed. Sections point to 1-based Markdown lines. Tokens are estimated at four UTF-8 bytes per token. The hash covers the exact returned Markdown. HTTPS mode validates every DNS address and redirect and enforces an eight-second total deadline and a 2 MiB response limit.",
        "tags": [
          "Utilities"
        ],
        "security": [
          {
            "RapidAPIProxySecret": []
          },
          {
            "DirectApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentRequest"
              },
              "examples": {
                "html": {
                  "summary": "HTML article with a table",
                  "value": {
                    "html": "<nav>Home</nav><h1>Plans</h1><table><tr><th>Tier</th><th>Quota</th></tr><tr><td>Pro</td><td>10000</td></tr></table>"
                  }
                },
                "markdown": {
                  "summary": "Markdown headings",
                  "value": {
                    "markdown": "# Quarterly review\n\n## Sales\n\nPipeline grew."
                  }
                },
                "text": {
                  "summary": "Remove navigation lines",
                  "value": {
                    "text": "Skip to main content\nQuarterly review"
                  }
                },
                "url": {
                  "summary": "Public HTTPS document",
                  "value": {
                    "url": "https://example.com/"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Document and HTML cleaner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentResult"
                },
                "examples": {
                  "html": {
                    "summary": "HTML article with a table",
                    "value": {
                      "markdown": "# Plans\n\n| Tier | Quota |\n| --- | --- |\n| Pro | 10000 |",
                      "sections": [
                        {
                          "level": 1,
                          "title": "Plans",
                          "line": 1
                        }
                      ],
                      "tables": [
                        {
                          "headers": [
                            "Tier",
                            "Quota"
                          ],
                          "rows": [
                            [
                              "Pro",
                              "10000"
                            ]
                          ]
                        }
                      ],
                      "wordCount": 5,
                      "estimatedTokens": 14,
                      "sha256": "f12b45fe48f794010112680eb07917a4c1365bfb849dd8db9151419fecd4f1d4"
                    }
                  },
                  "markdown": {
                    "summary": "Markdown headings",
                    "value": {
                      "markdown": "# Quarterly review\n\n## Sales\n\nPipeline grew.",
                      "sections": [
                        {
                          "level": 1,
                          "title": "Quarterly review",
                          "line": 1
                        },
                        {
                          "level": 2,
                          "title": "Sales",
                          "line": 3
                        }
                      ],
                      "tables": [],
                      "wordCount": 5,
                      "estimatedTokens": 11,
                      "sha256": "c14adedc4d536fd3dc14985b29298f53a512caaa47a52bf9fa404b8fe6dbf0de"
                    }
                  },
                  "text": {
                    "summary": "Remove navigation lines",
                    "value": {
                      "markdown": "Quarterly review",
                      "sections": [],
                      "tables": [],
                      "wordCount": 2,
                      "estimatedTokens": 4,
                      "sha256": "c6e5d4e4c49abb33dd8c7d177f91940a21c789681b77b93260dafe225a5b7867"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "411": {
            "$ref": "#/components/responses/LengthRequired"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMedia"
          },
          "502": {
            "$ref": "#/components/responses/FetchFailed"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/FetchTimedOut"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/web3/triage": {
      "post": {
        "operationId": "triageWeb3",
        "summary": "Static transaction and contract triage",
        "description": "Supply one EVM calldata string, EIP-712 message, Solidity snippet or Solana instruction. Parsed SPL Token and System instructions and compiled token transfers, approvals and System transfers receive semantic analysis. Unrecognized operations are reported explicitly. Findings are heuristic and require review. No RPC, signature verification or simulation runs. Scores use the highest rule weight plus one fifth of other distinct rule weights, capped at 100.",
        "tags": [
          "Utilities"
        ],
        "security": [
          {
            "RapidAPIProxySecret": []
          },
          {
            "DirectApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Web3Request"
              },
              "examples": {
                "approval": {
                  "summary": "Inspect a maximum token allowance",
                  "value": {
                    "calldata": "0x095ea7b30000000000000000000000001111111111111111111111111111111111111111ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
                  }
                },
                "permit": {
                  "summary": "Review a Permit2 allowance",
                  "value": {
                    "typedData": {
                      "primaryType": "PermitSingle",
                      "domain": {
                        "name": "Permit2",
                        "chainId": 1,
                        "verifyingContract": "0x2222222222222222222222222222222222222222"
                      },
                      "message": {
                        "details": {
                          "token": "0x1111111111111111111111111111111111111111",
                          "amount": "1461501637330902918203684832716283019655932542975",
                          "expiration": 1900000000,
                          "nonce": 1
                        },
                        "spender": "0x3333333333333333333333333333333333333333",
                        "sigDeadline": 1900000000
                      }
                    }
                  }
                },
                "source": {
                  "summary": "Locate a privileged fee setter",
                  "value": {
                    "solidity": "interface Asset { function setSellFee(uint256 fee) external; }"
                  }
                },
                "solana": {
                  "summary": "Review a parsed token delegate",
                  "value": {
                    "instruction": {
                      "program": "spl-token",
                      "parsed": {
                        "type": "approve",
                        "info": {
                          "delegate": "ExampleDelegate",
                          "amount": "5000"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Static transaction and contract triage result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Web3Result"
                },
                "examples": {
                  "approval": {
                    "summary": "Inspect a maximum token allowance",
                    "value": {
                      "inputType": "calldata",
                      "riskScore": 90,
                      "severity": "critical",
                      "findings": [
                        {
                          "code": "unlimited_approval",
                          "weight": 90,
                          "message": "Allowance equals the maximum field value.",
                          "action": "Use a spending cap for the intended amount.",
                          "evidence": {
                            "amount": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
                            "spender": "0x1111111111111111111111111111111111111111"
                          }
                        }
                      ],
                      "scope": "Offline indicators only. Runtime state, identity and execution outcomes are unverified."
                    }
                  },
                  "permit": {
                    "summary": "Review a Permit2 allowance",
                    "value": {
                      "inputType": "typedData",
                      "riskScore": 97,
                      "severity": "critical",
                      "findings": [
                        {
                          "code": "permit2",
                          "weight": 35,
                          "message": "A Permit2 authorization can delegate token spending.",
                          "action": "Verify the Permit2 deployment, token, spender and expiry.",
                          "evidence": {}
                        },
                        {
                          "code": "unlimited_approval",
                          "weight": 90,
                          "message": "Allowance equals the maximum field value.",
                          "action": "Use a spending cap for the intended amount.",
                          "evidence": {
                            "amount": "1461501637330902918203684832716283019655932542975",
                            "token": "0x1111111111111111111111111111111111111111",
                            "spender": "0x3333333333333333333333333333333333333333",
                            "expiration": "1900000000"
                          }
                        }
                      ],
                      "scope": "Offline indicators only. Runtime state, identity and execution outcomes are unverified."
                    }
                  },
                  "source": {
                    "summary": "Locate a privileged fee setter",
                    "value": {
                      "inputType": "solidity",
                      "riskScore": 60,
                      "severity": "medium",
                      "findings": [
                        {
                          "code": "fee_control",
                          "weight": 60,
                          "message": "The source contains a matching control indicator.",
                          "action": "Check fee caps and administrator privileges.",
                          "evidence": {
                            "symbol": "setSellFee",
                            "line": 1
                          }
                        }
                      ],
                      "scope": "Offline indicators only. Runtime state, identity and execution outcomes are unverified."
                    }
                  },
                  "solana": {
                    "summary": "Review a parsed token delegate",
                    "value": {
                      "inputType": "instruction",
                      "riskScore": 35,
                      "severity": "medium",
                      "findings": [
                        {
                          "code": "token_allowance",
                          "weight": 35,
                          "message": "The spender receives a token allowance.",
                          "action": "Verify the spender, token units and spending cap.",
                          "evidence": {
                            "amount": "5000",
                            "delegate": "ExampleDelegate"
                          }
                        }
                      ],
                      "scope": "Offline indicators only. Runtime state, identity and execution outcomes are unverified."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidInput"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "411": {
            "$ref": "#/components/responses/LengthRequired"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMedia"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "operationId": "getHealth",
        "tags": [
          "Reference"
        ],
        "summary": "Service health",
        "description": "Get process uptime, service version and route inventory.",
        "security": [],
        "responses": {
          "200": {
            "description": "Get process uptime, service version and route inventory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                },
                "examples": {
                  "success": {
                    "summary": "Service health",
                    "value": {
                      "status": "ok",
                      "version": "1.0.0",
                      "uptimeSeconds": 1.25,
                      "endpoints": [
                        "/healthz",
                        "/",
                        "/openapi.json",
                        "/v1/leads/clean",
                        "/v1/docs/clean",
                        "/v1/web3/triage"
                      ]
                    }
                  }
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    },
    "/": {
      "get": {
        "operationId": "getLandingPage",
        "tags": [
          "Reference"
        ],
        "summary": "Developer reference",
        "description": "Open the interactive catalog, pricing and shell quickstarts.",
        "security": [],
        "responses": {
          "200": {
            "description": "Open the interactive catalog, pricing and shell quickstarts.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                },
                "examples": {
                  "success": {
                    "summary": "Developer reference",
                    "value": "<!doctype html><html lang=\"en\"><title>Utility Hub · Developer reference</title><h1>B2B &amp; Web3 Utility API</h1></html>"
                  }
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenAPI",
        "tags": [
          "Reference"
        ],
        "summary": "OpenAPI 3.1 contract",
        "description": "Download the complete importable OpenAPI document. The response example illustrates its envelope.",
        "security": [],
        "responses": {
          "200": {
            "description": "Download the complete importable OpenAPI document. The response example illustrates its envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "openapi": {
                      "const": "3.1.0"
                    },
                    "info": {
                      "type": "object"
                    },
                    "paths": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "openapi",
                    "info",
                    "paths"
                  ],
                  "additionalProperties": true
                },
                "examples": {
                  "success": {
                    "summary": "OpenAPI 3.1 contract",
                    "value": {
                      "openapi": "3.1.0",
                      "info": {
                        "title": "Utility Hub | B2B & Web3",
                        "version": "1.0.0"
                      },
                      "paths": {}
                    }
                  }
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Lead": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "fullName": {
            "type": [
              "string",
              "null"
            ]
          },
          "firstName": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastName": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "companyDomain": {
            "type": [
              "string",
              "null"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "linkedinUrl": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [],
        "additionalProperties": true,
        "description": "Contact fields accept strings or null. CSV and JSON keys ignore case, spaces and punctuation. Common CRM aliases are accepted. Extra columns are ignored."
      },
      "LeadRequest": {
        "oneOf": [
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Lead"
            },
            "maxItems": 500
          },
          {
            "type": "object",
            "properties": {
              "leads": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Lead"
                },
                "maxItems": 500
              }
            },
            "required": [
              "leads"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "csvText": {
                "type": "string"
              }
            },
            "required": [
              "csvText"
            ],
            "additionalProperties": false
          }
        ]
      },
      "GoldenRecord": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "companyDomain": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "linkedinUrl": {
            "type": "string"
          },
          "suggestedEmail": {
            "type": "string"
          },
          "seniority": {
            "type": "string"
          },
          "department": {
            "type": "string"
          },
          "emailFlags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "missingFields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "crmReadinessScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "sourceRows": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        },
        "required": [
          "name",
          "company",
          "email",
          "companyDomain",
          "title",
          "linkedinUrl",
          "suggestedEmail",
          "seniority",
          "department",
          "emailFlags",
          "missingFields",
          "crmReadinessScore",
          "sourceRows"
        ],
        "additionalProperties": false
      },
      "LeadResult": {
        "type": "object",
        "properties": {
          "inputCount": {
            "type": "integer",
            "minimum": 0
          },
          "uniqueCount": {
            "type": "integer",
            "minimum": 0
          },
          "duplicatesRemoved": {
            "type": "integer",
            "minimum": 0
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GoldenRecord"
            }
          }
        },
        "required": [
          "inputCount",
          "uniqueCount",
          "duplicatesRemoved",
          "records"
        ],
        "additionalProperties": false
      },
      "DocumentRequest": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "html": {
                "type": "string"
              }
            },
            "required": [
              "html"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "markdown": {
                "type": "string"
              }
            },
            "required": [
              "markdown"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              }
            },
            "required": [
              "text"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://",
                "maxLength": 8192
              }
            },
            "required": [
              "url"
            ],
            "additionalProperties": false
          }
        ]
      },
      "DocumentResult": {
        "type": "object",
        "properties": {
          "markdown": {
            "type": "string"
          },
          "sections": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "level": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 6
                },
                "title": {
                  "type": "string"
                },
                "line": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "required": [
                "level",
                "title",
                "line"
              ],
              "additionalProperties": false
            }
          },
          "tables": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "headers": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "rows": {
                  "type": "array",
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "headers",
                "rows"
              ],
              "additionalProperties": false
            }
          },
          "wordCount": {
            "type": "integer",
            "minimum": 0
          },
          "estimatedTokens": {
            "type": "integer",
            "minimum": 0
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "markdown",
          "sections",
          "tables",
          "wordCount",
          "estimatedTokens",
          "sha256"
        ],
        "additionalProperties": false
      },
      "TypedData": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "object"
          },
          "primaryType": {
            "type": "string",
            "minLength": 1
          },
          "types": {
            "type": "object"
          },
          "message": {
            "type": "object"
          }
        },
        "required": [
          "primaryType",
          "message"
        ],
        "additionalProperties": true
      },
      "Instruction": {
        "type": "object",
        "properties": {
          "program": {
            "type": "string"
          },
          "programId": {
            "type": "string"
          },
          "accounts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "data": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "prefixItems": [
                  {
                    "type": "string"
                  },
                  {
                    "const": "base64"
                  }
                ],
                "minItems": 2,
                "maxItems": 2
              }
            ]
          },
          "parsed": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "info": {
                "type": "object"
              }
            },
            "required": [
              "type",
              "info"
            ],
            "additionalProperties": true
          }
        },
        "required": [],
        "additionalProperties": true
      },
      "Web3Request": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "calldata": {
                "type": "string",
                "pattern": "^0x([a-fA-F0-9]{2}){4,}$"
              }
            },
            "required": [
              "calldata"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "typedData": {
                "$ref": "#/components/schemas/TypedData"
              }
            },
            "required": [
              "typedData"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "solidity": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "solidity"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "instruction": {
                "$ref": "#/components/schemas/Instruction"
              }
            },
            "required": [
              "instruction"
            ],
            "additionalProperties": false
          }
        ]
      },
      "Finding": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "weight": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "message": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "evidence": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "code",
          "weight",
          "message",
          "action",
          "evidence"
        ],
        "additionalProperties": false
      },
      "Web3Result": {
        "type": "object",
        "properties": {
          "inputType": {
            "enum": [
              "calldata",
              "typedData",
              "solidity",
              "instruction"
            ]
          },
          "riskScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "severity": {
            "enum": [
              "low",
              "medium",
              "high",
              "critical"
            ]
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Finding"
            },
            "minItems": 1
          },
          "scope": {
            "type": "string"
          }
        },
        "required": [
          "inputType",
          "riskScore",
          "severity",
          "findings",
          "scope"
        ],
        "additionalProperties": false
      },
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "const": "ok"
          },
          "version": {
            "type": "string"
          },
          "uptimeSeconds": {
            "type": "number",
            "minimum": 0
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "status",
          "version",
          "uptimeSeconds",
          "endpoints"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    },
    "responses": {
      "InvalidInput": {
        "description": "Invalid input or a disallowed document address.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "Invalid input or a disallowed document address.",
                "value": {
                  "error": "URL must resolve only to public addresses."
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid origin credentials.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "Missing or invalid origin credentials.",
                "value": {
                  "error": "Valid origin credentials required."
                }
              }
            }
          }
        }
      },
      "MethodNotAllowed": {
        "description": "Unsupported HTTP method.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "Unsupported HTTP method.",
                "value": {
                  "error": "Method not allowed."
                }
              }
            }
          }
        }
      },
      "LengthRequired": {
        "description": "Content-Length is required.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "Content-Length is required.",
                "value": {
                  "error": "Content-Length required."
                }
              }
            }
          }
        }
      },
      "TooLarge": {
        "description": "Request or upstream document exceeds 2 MiB.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "Request or upstream document exceeds 2 MiB.",
                "value": {
                  "error": "Request exceeds 2 MiB."
                }
              }
            }
          }
        }
      },
      "UnsupportedMedia": {
        "description": "Unsupported content type or encoding.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "Unsupported content type or encoding.",
                "value": {
                  "error": "Supply uncompressed application/json."
                }
              }
            }
          }
        }
      },
      "FetchFailed": {
        "description": "The document origin could not supply the requested content.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "The document origin could not supply the requested content.",
                "value": {
                  "error": "Unable to retrieve HTTPS document."
                }
              }
            }
          }
        }
      },
      "Unavailable": {
        "description": "Origin authentication is unconfigured or fetch capacity is exhausted.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "Origin authentication is unconfigured or fetch capacity is exhausted.",
                "value": {
                  "error": "Origin authentication is unconfigured."
                }
              }
            }
          }
        }
      },
      "FetchTimedOut": {
        "description": "The document fetch exceeded eight seconds.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "The document fetch exceeded eight seconds.",
                "value": {
                  "error": "Document fetch timed out."
                }
              }
            }
          }
        }
      },
      "InternalError": {
        "description": "Unexpected server error.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "error": {
                "summary": "Unexpected server error.",
                "value": {
                  "error": "Internal server error."
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "RapidAPIProxySecret": {
        "type": "apiKey",
        "in": "header",
        "name": "X-RapidAPI-Proxy-Secret",
        "description": "Provider-side gateway authentication. RapidAPI injects this header."
      },
      "DirectApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Provider-issued enterprise trial credential."
      }
    }
  }
}
