{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sectora-io/json-schema/sectora-io-scan-schema.json",
  "title": "Scan",
  "description": "Represents a security scan against a target.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sectora-io-openapi.yml#/components/schemas/Scan",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique scan identifier."
    },
    "target": {
      "type": "string",
      "description": "The target URL or identifier being scanned."
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "completed",
        "completed_with_errors",
        "failed",
        "cancelled"
      ],
      "description": "Current scan status."
    },
    "scan_type": {
      "type": "string",
      "enum": [
        "dast",
        "api",
        "sca",
        "secrets",
        "sast"
      ],
      "description": "Type of security scan."
    },
    "progress": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100,
      "description": "Scan progress percentage (0-100)."
    },
    "summary": {
      "$ref": "#/$defs/ScanSummary"
    },
    "error_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "Error details if the scan failed."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "When the scan was created."
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the scan began executing."
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the scan finished."
    },
    "project_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Project this scan belongs to, if any."
    }
  },
  "$defs": {
    "ScanSummary": {
      "type": "object",
      "description": "Aggregated vulnerability counts for a scan.",
      "properties": {
        "total_vulnerabilities": {
          "type": "integer",
          "description": "Total number of vulnerabilities found."
        },
        "critical_count": {
          "type": "integer",
          "description": "Number of critical severity findings."
        },
        "high_count": {
          "type": "integer",
          "description": "Number of high severity findings."
        },
        "medium_count": {
          "type": "integer",
          "description": "Number of medium severity findings."
        },
        "low_count": {
          "type": "integer",
          "description": "Number of low severity findings."
        },
        "info_count": {
          "type": "integer",
          "description": "Number of informational findings."
        }
      }
    }
  }
}