{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/portscan-com/json-schema/portscan-com-scan-result-schema.json",
  "title": "ScanResult",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/portscan-com-openapi.json#/components/schemas/ScanResult",
  "type": "object",
  "properties": {
    "ip": {
      "type": "string"
    },
    "scan_type": {
      "type": "string",
      "enum": [
        "fast",
        "deep"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "complete",
        "incomplete",
        "failed",
        "none"
      ],
      "description": "'incomplete' = host too slow or filtered to finish the full range; ports_open holds what was found, partial=true. Never treat as a complete result."
    },
    "ports_open": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Port"
      }
    },
    "ports_filtered": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Port"
      }
    },
    "service_banners": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "ptr_record": {
      "type": [
        "string",
        "null"
      ]
    },
    "queue_position": {
      "type": "integer",
      "description": "Number of scans ahead of this one (only present while queued or running)"
    },
    "duration_ms": {
      "type": "integer"
    },
    "completed_at": {
      "type": "integer"
    },
    "expires_at": {
      "type": "integer"
    },
    "fail_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "partial": {
      "type": "boolean",
      "description": "True when status is incomplete: results are partial, not a full scan of the range."
    },
    "chunks_complete": {
      "type": "integer"
    },
    "total_chunks": {
      "type": "integer"
    }
  },
  "$defs": {
    "Port": {
      "type": "object",
      "properties": {
        "port": {
          "type": "integer"
        },
        "state": {
          "type": "string",
          "enum": [
            "open",
            "closed",
            "filtered"
          ]
        },
        "service": {
          "type": [
            "string",
            "null"
          ]
        },
        "banner": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}