{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/onyphe/json-schema/onyphe-search-response-schema.json",
  "title": "SearchResponse",
  "x-generated": "2026-11-16",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/onyphe-openapi.yml#/components/schemas/SearchResponse",
  "type": "object",
  "properties": {
    "count": {
      "type": "integer",
      "description": "Number of results in this page."
    },
    "error": {
      "type": "integer",
      "description": "0 on success."
    },
    "max_page": {
      "type": "integer"
    },
    "myip": {
      "type": "string",
      "description": "Caller IP as seen by ONYPHE."
    },
    "page": {
      "type": "integer"
    },
    "page_size": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "$ref": "#/$defs/CtiscanDocument"
          },
          {
            "$ref": "#/$defs/DatascanDocument"
          }
        ]
      }
    },
    "status": {
      "type": "string"
    },
    "text": {
      "type": "string"
    },
    "took": {
      "description": "Seconds; sometimes sent as a string (`\"0.030\"`).",
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "string"
        }
      ]
    },
    "total": {
      "type": "integer",
      "description": "Total matching documents; paging is capped at the 10,000 result ceiling."
    }
  },
  "required": [
    "error",
    "results"
  ],
  "$defs": {
    "CtiscanDocument": {
      "type": "object",
      "description": "**ctiscan / ctiurl data model** (IP enrichment and CTI). Layered, one document\nper service (`ctiscan`) or URL (`ctiurl`). Only the most-used layers are listed;\n`additionalProperties` is true. Single-field values are often arrays.\n",
      "additionalProperties": true,
      "properties": {
        "@category": {
          "type": "string",
          "enum": [
            "ctiscan",
            "ctiurl"
          ]
        },
        "@timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "seen_date": {
          "type": "string",
          "format": "date"
        },
        "tag": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "source": {
          "type": "string"
        },
        "ip": {
          "type": "object",
          "description": "Scanned address and its network context.",
          "additionalProperties": true,
          "properties": {
            "dest": {
              "type": "string",
              "description": "Scanned IP address."
            },
            "asn": {
              "type": "string"
            },
            "organization": {
              "type": "string"
            },
            "country": {
              "type": "string"
            },
            "subnet": {
              "type": "string"
            },
            "netname": {
              "type": "string"
            }
          }
        },
        "tcp": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "dest": {
              "type": "integer",
              "description": "Port of this service."
            }
          }
        },
        "services": {
          "type": "object",
          "description": "Every open port seen on the host.",
          "additionalProperties": true,
          "properties": {
            "port": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Port numbers as strings (\"443\")."
            }
          }
        },
        "app": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "protocol": {
              "type": "string"
            },
            "device": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "tls": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "String, not a JSON boolean."
            },
            "data": {
              "type": "object",
              "description": "Raw application response, up to ~1 MB.",
              "additionalProperties": true,
              "properties": {
                "text": {
                  "type": "string"
                },
                "length": {
                  "type": "integer"
                },
                "md5": {
                  "type": "string"
                }
              }
            }
          }
        },
        "component": {
          "type": "object",
          "description": "Detected products, vendors, versions and CPEs.",
          "additionalProperties": true,
          "properties": {
            "cpe": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "product": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "vendor": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "version": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "http": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "code": {
              "type": "integer"
            },
            "url": {
              "type": "string"
            }
          }
        },
        "html": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "title": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string",
                  "description": "Full-text."
                },
                "raw": {
                  "type": "string",
                  "description": "Exact/regexp."
                }
              }
            }
          }
        },
        "cert": {
          "type": "object",
          "additionalProperties": true,
          "description": "Certificate layer (subject, issuer, serial, fingerprints, validity)."
        },
        "dns": {
          "type": "object",
          "additionalProperties": true,
          "description": "Forward and reverse DNS."
        },
        "favicon": {
          "type": "object",
          "additionalProperties": true
        },
        "compat": {
          "type": "object",
          "additionalProperties": true,
          "description": "Mirrors some datascan names to ease porting. Query-side names are still `compat.*`."
        },
        "scanner": {
          "type": "object",
          "additionalProperties": true
        },
        "trackquery": {
          "type": "string"
        }
      }
    },
    "DatascanDocument": {
      "type": "object",
      "description": "**datascan data model**, shared by `datascan`, `vulnscan` and `riskscan`\n(ASM). Flat, with application sub-objects under `app`. `cve` and `cpe` are\nroot fields. `riskscan` documents carry `risk::*` tags; `vulnscan` documents\ncarry a verdict tag. `additionalProperties` is true.\n",
      "additionalProperties": true,
      "properties": {
        "@category": {
          "type": "string",
          "enum": [
            "datascan",
            "vulnscan",
            "riskscan"
          ]
        },
        "@timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "seen_date": {
          "type": "string",
          "format": "date"
        },
        "ip": {
          "type": "string"
        },
        "ipv6": {
          "type": "string"
        },
        "port": {
          "type": "integer"
        },
        "transport": {
          "type": "string"
        },
        "protocol": {
          "type": "string"
        },
        "tls": {
          "type": "string",
          "enum": [
            "true",
            "false"
          ],
          "description": "String, not a JSON boolean."
        },
        "status": {
          "type": "integer",
          "description": "Application status."
        },
        "hostname": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Deduplicated hostnames from DNS and certificates."
        },
        "domain": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "url": {
          "type": "string"
        },
        "asn": {
          "type": "string"
        },
        "organization": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "subnet": {
          "type": "string"
        },
        "product": {
          "type": "string"
        },
        "productvendor": {
          "type": "string"
        },
        "productversion": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "cpe": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "cpecount": {
          "type": "integer"
        },
        "cve": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "CVE identifiers detected on the service (vulnscan; propagated to riskscan/datascan)."
        },
        "cvecount": {
          "type": "integer"
        },
        "tag": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Examples: `risk::exposeddatabase`, `risk::criticalcve` (riskscan);\n`vulnerable`, `notvulnerable`, `maybevulnerable`, `unknownvulnerable`,\n`vulnerableversion`, `notvulnerableversion`, `maybevulnerableversion`,\n`partialversion`, `unknownversion`, `version` (vulnscan);\n`cisa::kev`, `onyphe::kev`, `anssi::top10`, `nsa::top25`, `log4shell`;\n`open` (unauthenticated access).\n"
        },
        "data": {
          "type": "string",
          "description": "Raw response, capped at 16384 bytes."
        },
        "device": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "class": {
              "type": "string"
            },
            "product": {
              "type": "string"
            },
            "productvendor": {
              "type": "string"
            },
            "productversion": {
              "type": "string"
            }
          }
        },
        "app": {
          "type": "object",
          "additionalProperties": true,
          "description": "Protocol sub-objects such as `app.http`, `app.smb`."
        },
        "trackquery": {
          "type": "string"
        }
      }
    }
  }
}