openapi: 3.1.0
info:
  title: ZeroPath Webhook Events
  version: 1.0.0
  description: Schemas for webhook event payloads sent by ZeroPath.
paths: {}
webhooks:
  SCAN_STARTED:
    post:
      operationId: SCAN_STARTED
      description: Webhook event SCAN_STARTED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_SCAN_STARTED"
      responses:
        "200":
          description: OK
  SCAN_COMPLETE:
    post:
      operationId: SCAN_COMPLETE
      description: Webhook event SCAN_COMPLETE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_SCAN_COMPLETE"
      responses:
        "200":
          description: OK
  PR_SCAN_STARTED:
    post:
      operationId: PR_SCAN_STARTED
      description: Webhook event PR_SCAN_STARTED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_PR_SCAN_STARTED"
      responses:
        "200":
          description: OK
  PR_SCAN_COMPLETE:
    post:
      operationId: PR_SCAN_COMPLETE
      description: Webhook event PR_SCAN_COMPLETE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_PR_SCAN_COMPLETE"
      responses:
        "200":
          description: OK
  NEW_VULNERABILITIES_PR:
    post:
      operationId: NEW_VULNERABILITIES_PR
      description: Webhook event NEW_VULNERABILITIES_PR
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_NEW_VULNERABILITIES_PR"
      responses:
        "200":
          description: OK
  NEW_VULNERABILITIES_FULL_SCAN:
    post:
      operationId: NEW_VULNERABILITIES_FULL_SCAN
      description: Webhook event NEW_VULNERABILITIES_FULL_SCAN
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_NEW_VULNERABILITIES_FULL_SCAN"
      responses:
        "200":
          description: OK
  VULNERABILITY_PATCHED:
    post:
      operationId: VULNERABILITY_PATCHED
      description: Webhook event VULNERABILITY_PATCHED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_VULNERABILITY_PATCHED"
      responses:
        "200":
          description: OK
  VULNERABILITY_REOPENED:
    post:
      operationId: VULNERABILITY_REOPENED
      description: Webhook event VULNERABILITY_REOPENED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_VULNERABILITY_REOPENED"
      responses:
        "200":
          description: OK
  AUDIT_LOG_EVENT:
    post:
      operationId: AUDIT_LOG_EVENT
      description: Webhook event AUDIT_LOG_EVENT
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_AUDIT_LOG_EVENT"
      responses:
        "200":
          description: OK
  SCAN_FAILED:
    post:
      operationId: SCAN_FAILED
      description: Webhook event SCAN_FAILED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_SCAN_FAILED"
      responses:
        "200":
          description: OK
  SCAN_SCHEDULED:
    post:
      operationId: SCAN_SCHEDULED
      description: Webhook event SCAN_SCHEDULED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_SCAN_SCHEDULED"
      responses:
        "200":
          description: OK
  LONG_RUNNING_SCAN:
    post:
      operationId: LONG_RUNNING_SCAN
      description: Webhook event LONG_RUNNING_SCAN
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_LONG_RUNNING_SCAN"
      responses:
        "200":
          description: OK
  PR_BLOCKED:
    post:
      operationId: PR_BLOCKED
      description: Webhook event PR_BLOCKED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_PR_BLOCKED"
      responses:
        "200":
          description: OK
  PR_MERGED_WITH_ISSUES:
    post:
      operationId: PR_MERGED_WITH_ISSUES
      description: Webhook event PR_MERGED_WITH_ISSUES
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_PR_MERGED_WITH_ISSUES"
      responses:
        "200":
          description: OK
  REPORT_COMPLETE:
    post:
      operationId: REPORT_COMPLETE
      description: Webhook event REPORT_COMPLETE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_REPORT_COMPLETE"
      responses:
        "200":
          description: OK
  SCA_NEW_CVE:
    post:
      operationId: SCA_NEW_CVE
      description: Webhook event SCA_NEW_CVE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_SCA_NEW_CVE"
      responses:
        "200":
          description: OK
  SCA_NEW_ISSUE:
    post:
      operationId: SCA_NEW_ISSUE
      description: Webhook event SCA_NEW_ISSUE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_SCA_NEW_ISSUE"
      responses:
        "200":
          description: OK
  INBOUND_WEBHOOK:
    post:
      operationId: INBOUND_WEBHOOK
      description: Webhook event INBOUND_WEBHOOK
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_INBOUND_WEBHOOK"
      responses:
        "200":
          description: OK
  PATCH_PR_DENIED:
    post:
      operationId: PATCH_PR_DENIED
      description: Webhook event PATCH_PR_DENIED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_PATCH_PR_DENIED"
      responses:
        "200":
          description: OK
  VULNERABILITY_STATUS_CHANGED:
    post:
      operationId: VULNERABILITY_STATUS_CHANGED
      description: Webhook event VULNERABILITY_STATUS_CHANGED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_VULNERABILITY_STATUS_CHANGED"
      responses:
        "200":
          description: OK
  SCA_SCAN_COMPLETE:
    post:
      operationId: SCA_SCAN_COMPLETE
      description: Webhook event SCA_SCAN_COMPLETE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_SCA_SCAN_COMPLETE"
      responses:
        "200":
          description: OK
  SCA_SCAN_STARTED:
    post:
      operationId: SCA_SCAN_STARTED
      description: Webhook event SCA_SCAN_STARTED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_SCA_SCAN_STARTED"
      responses:
        "200":
          description: OK
  SCA_SCAN_FAILED:
    post:
      operationId: SCA_SCAN_FAILED
      description: Webhook event SCA_SCAN_FAILED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_SCA_SCAN_FAILED"
      responses:
        "200":
          description: OK
  REPO_ADDED:
    post:
      operationId: REPO_ADDED
      description: Webhook event REPO_ADDED
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookPayload_REPO_ADDED"
      responses:
        "200":
          description: OK
components:
  schemas:
    NotificationEventType:
      type: string
      enum:
        - SCAN_STARTED
        - SCAN_COMPLETE
        - PR_SCAN_STARTED
        - PR_SCAN_COMPLETE
        - NEW_VULNERABILITIES_PR
        - NEW_VULNERABILITIES_FULL_SCAN
        - VULNERABILITY_PATCHED
        - VULNERABILITY_REOPENED
        - AUDIT_LOG_EVENT
        - SCAN_FAILED
        - SCAN_SCHEDULED
        - LONG_RUNNING_SCAN
        - PR_BLOCKED
        - PR_MERGED_WITH_ISSUES
        - REPORT_COMPLETE
        - SCA_NEW_CVE
        - SCA_NEW_ISSUE
        - INBOUND_WEBHOOK
        - PATCH_PR_DENIED
        - VULNERABILITY_STATUS_CHANGED
        - SCA_SCAN_COMPLETE
        - SCA_SCAN_STARTED
        - SCA_SCAN_FAILED
        - REPO_ADDED
      description: Type of event being delivered. Matches internal NotificationEventType.
    WebhookOrganization:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
      required:
        - id
      additionalProperties: false
    WebhookRepository:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
      required:
        - id
        - name
      additionalProperties: false
    WebhookVulnerabilitySummary:
      type: object
      properties:
        total:
          type: integer
          minimum: 0
        by_severity:
          type: object
          properties:
            critical:
              type: integer
              minimum: 0
            high:
              type: integer
              minimum: 0
            medium:
              type: integer
              minimum: 0
            low:
              type: integer
              minimum: 0
            info:
              type: integer
              minimum: 0
          required:
            - critical
            - high
            - medium
            - low
            - info
          additionalProperties: false
      required:
        - total
        - by_severity
      additionalProperties: false
    WebhookScan:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        status:
          type: string
          enum:
            - started
            - completed
            - failed
            - scheduled
            - blocked
            - merged_with_issues
            - unknown
        duration_minutes:
          type: integer
          minimum: 0
        vulnerability_summary:
          $ref: "#/components/schemas/WebhookVulnerabilitySummary"
        url:
          type: string
      required:
        - id
        - type
        - status
        - url
      additionalProperties: false
    WebhookAuditLog:
      type: object
      properties:
        id:
          type: string
        endpoint:
          type: string
        arguments: {}
        caller:
          type: object
          properties:
            id:
              type: string
            email:
              type: string
          additionalProperties: false
        timestamp:
          type: string
          format: date-time
      required:
        - id
        - endpoint
        - timestamp
      additionalProperties: false
    WebhookVulnerability:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
          description: URL to view the vulnerability in the ZeroPath UI
      required:
        - id
        - url
      additionalProperties: true
      description: Vulnerability object. May contain additional fields depending on
        the event type.
    WebhookVulnerabilityReference:
      type: object
      properties:
        id:
          type: string
          description: Vulnerability/Issue ID
        url:
          type: string
          description: URL to view the vulnerability in the ZeroPath UI
      required:
        - id
        - url
      additionalProperties: false
      description: Reference to a vulnerability with its ID and URL
    WebhookEvent:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        organization:
          $ref: "#/components/schemas/WebhookOrganization"
        repository:
          $ref: "#/components/schemas/WebhookRepository"
        scan:
          $ref: "#/components/schemas/WebhookScan"
        audit_log:
          $ref: "#/components/schemas/WebhookAuditLog"
        error:
          type: string
        metadata:
          type: object
          additionalProperties: true
        vulnerability:
          $ref: "#/components/schemas/WebhookVulnerability"
      required:
        - timestamp
        - organization
      additionalProperties: false
    WebhookPayload:
      type: object
      properties:
        time:
          type: integer
          minimum: 0
          description: Unix epoch seconds
        host:
          type: string
        source:
          type: string
        sourcetype:
          $ref: "#/components/schemas/NotificationEventType"
        event:
          $ref: "#/components/schemas/WebhookEvent"
      required:
        - time
        - host
        - source
        - sourcetype
        - event
      additionalProperties: false
    WebhookPayloadVariants:
      oneOf:
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: SCAN_STARTED
                event:
                  type: object
                  properties:
                    scan:
                      $ref: "#/components/schemas/WebhookScan"
                  required:
                    - scan
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: PR_SCAN_STARTED
                event:
                  type: object
                  properties:
                    scan:
                      $ref: "#/components/schemas/WebhookScan"
                  required:
                    - scan
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: SCAN_COMPLETE
                event:
                  type: object
                  properties:
                    scan:
                      $ref: "#/components/schemas/WebhookScan"
                  required:
                    - scan
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: PR_SCAN_COMPLETE
                event:
                  type: object
                  properties:
                    scan:
                      $ref: "#/components/schemas/WebhookScan"
                  required:
                    - scan
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: SCAN_FAILED
                event:
                  type: object
                  properties:
                    scan:
                      $ref: "#/components/schemas/WebhookScan"
                    error:
                      type: string
                  required:
                    - scan
                    - error
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: NEW_VULNERABILITIES_PR
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        vulnerabilityIds:
                          type: array
                          items:
                            type: string
                          description: Array of vulnerability IDs (deprecated, use vulnerabilities
                            instead)
                        vulnerabilities:
                          type: array
                          items:
                            $ref: "#/components/schemas/WebhookVulnerabilityReference"
                          description: Array of vulnerability references with IDs and URLs
                      additionalProperties: true
                  anyOf:
                    - required:
                        - vulnerability
                    - required:
                        - scan
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: NEW_VULNERABILITIES_FULL_SCAN
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        vulnerabilityIds:
                          type: array
                          items:
                            type: string
                          description: Array of vulnerability IDs (deprecated, use vulnerabilities
                            instead)
                        vulnerabilities:
                          type: array
                          items:
                            $ref: "#/components/schemas/WebhookVulnerabilityReference"
                          description: Array of vulnerability references with IDs and URLs
                      additionalProperties: true
                  anyOf:
                    - required:
                        - vulnerability
                    - required:
                        - scan
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: LONG_RUNNING_SCAN
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        runningMinutes:
                          type: integer
                          minimum: 0
                      required:
                        - runningMinutes
                      additionalProperties: true
                  required:
                    - metadata
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: AUDIT_LOG_EVENT
                event:
                  type: object
                  properties:
                    audit_log:
                      $ref: "#/components/schemas/WebhookAuditLog"
                  required:
                    - audit_log
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: SCAN_SCHEDULED
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        scheduleId:
                          type: string
                        crontab:
                          type: string
                        action:
                          type: string
                          enum:
                            - created
                            - updated
                            - deleted
                      required:
                        - scheduleId
                        - crontab
                        - action
                      additionalProperties: true
                  required:
                    - metadata
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: PR_BLOCKED
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        prId:
                          type: string
                        prNumber:
                          type: integer
                      required:
                        - prId
                        - prNumber
                      additionalProperties: true
                  required:
                    - metadata
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: PR_MERGED_WITH_ISSUES
                event:
                  type: object
                  properties:
                    scan:
                      $ref: "#/components/schemas/WebhookScan"
                    metadata:
                      type: object
                      properties:
                        prUrl:
                          type: string
                        prNumber:
                          type: integer
                        prTitle:
                          type: string
                        mergedBy:
                          type: string
                        targetBranch:
                          type: string
                        vulnerabilityIds:
                          type: array
                          items:
                            type: string
                          description: Array of vulnerability IDs (deprecated, use vulnerabilities
                            instead)
                        vulnerabilities:
                          type: array
                          items:
                            $ref: "#/components/schemas/WebhookVulnerabilityReference"
                          description: Array of vulnerability references with IDs and URLs
                      required:
                        - prUrl
                        - targetBranch
                      additionalProperties: true
                  required:
                    - scan
                    - metadata
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  enum:
                    - VULNERABILITY_REOPENED
                    - VULNERABILITY_PATCHED
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        vulnerabilityId:
                          type: string
                        vulnerabilityUrl:
                          type: string
                          description: URL to view the vulnerability in the ZeroPath UI
                        reason:
                          type: string
                          description: Reason for reopening (VULNERABILITY_REOPENED only)
                        prUrl:
                          type: string
                          description: PR URL for the patch (VULNERABILITY_PATCHED only)
                        patchId:
                          type: string
                          description: Patch ID (VULNERABILITY_PATCHED only)
                      additionalProperties: true
                  anyOf:
                    - required:
                        - metadata
                    - required:
                        - vulnerability
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: REPORT_COMPLETE
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        reportId:
                          type: string
                        month:
                          type: integer
                          minimum: 1
                          maximum: 12
                        year:
                          type: integer
                        title:
                          type: string
                        fileSize:
                          type: number
                          description: File size in bytes
                        userId:
                          type: string
                          description: User who requested the report
                      required:
                        - reportId
                      additionalProperties: true
                  required:
                    - metadata
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: SCA_NEW_CVE
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        alertId:
                          type: string
                        cveId:
                          type: string
                        summary:
                          type: string
                        description:
                          type: string
                        severity:
                          type: number
                          description: Severity score
                        aliases:
                          type: array
                          items:
                            type: string
                          description: CVE aliases
                        references:
                          type: array
                          items:
                            type: string
                          description: Reference URLs
                        totalAffectedCount:
                          type: integer
                          minimum: 0
                        affectedIssuesShown:
                          type: integer
                          minimum: 0
                          maximum: 20
                        hasMoreThan20:
                          type: boolean
                        affectedRepositoryIds:
                          type: array
                          items:
                            type: string
                          description: Array of affected repository IDs
                        affectedIssues:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              url:
                                type: string
                                description: URL to view the vulnerability in the ZeroPath UI
                              repositoryId:
                                type: string
                              repositoryName:
                                type: string
                              scanId:
                                type: string
                              score:
                                type: number
                              uiLink:
                                type: string
                            required:
                              - id
                              - url
                              - repositoryId
                              - scanId
                            additionalProperties: false
                          description: Detailed information about affected issues
                      required:
                        - alertId
                        - cveId
                        - summary
                        - totalAffectedCount
                        - affectedIssuesShown
                        - hasMoreThan20
                      additionalProperties: true
                    vulnerability:
                      type: object
                      properties:
                        alertId:
                          type: string
                        packageIdentifier:
                          type: string
                        summary:
                          type: string
                        description:
                          type: string
                        severity:
                          type: number
                        totalAffectedCount:
                          type: integer
                          minimum: 0
                        affectedIssues:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              url:
                                type: string
                              repositoryId:
                                type: string
                              repositoryName:
                                type: string
                              scanId:
                                type: string
                              score:
                                type: number
                              uiLink:
                                type: string
                            additionalProperties: false
                      additionalProperties: true
                  required:
                    - metadata
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: VULNERABILITY_STATUS_CHANGED
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        vulnerabilityIds:
                          type: array
                          items:
                            type: string
                          description: IDs of issues whose status changed in this batch
                        vulnCount:
                          type: integer
                          minimum: 0
                          description: Number of affected issues in this notification
                        newStatus:
                          type: string
                          description: New status applied to the issues (e.g. FALSE_POSITIVE,
                            ACCEPTED_RISK, RESOLVED)
                        previousStatus:
                          type: string
                          description: Status the issues had before the change. May be empty when
                            previously unset.
                        changedBy:
                          type: string
                          description: Email or display name of the user, AI assistant, or integration
                            that triaged the issues
                      required:
                        - vulnerabilityIds
                        - vulnCount
                        - newStatus
                        - changedBy
                      additionalProperties: true
                  required:
                    - metadata
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: PATCH_PR_DENIED
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        vulnerabilityId:
                          type: string
                          description: ID of the vulnerability the patch PR was addressing
                        prUrl:
                          type: string
                          description: URL of the patch PR that was closed without merge
                        patchId:
                          type: string
                          description: ID of the ZeroPath patch
                        vulnTitle:
                          type: string
                          description: Generated title of the vulnerability
                        localBranch:
                          type: string
                          description: Branch name the patch PR was created from
                      required:
                        - vulnerabilityId
                        - prUrl
                        - patchId
                      additionalProperties: true
                  required:
                    - metadata
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: SCA_SCAN_STARTED
                event:
                  type: object
                  properties:
                    scan:
                      $ref: "#/components/schemas/WebhookScan"
                  required:
                    - scan
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: SCA_SCAN_COMPLETE
                event:
                  type: object
                  properties:
                    scan:
                      $ref: "#/components/schemas/WebhookScan"
                  required:
                    - scan
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: SCA_SCAN_FAILED
                event:
                  type: object
                  properties:
                    scan:
                      $ref: "#/components/schemas/WebhookScan"
                    error:
                      type: string
                  required:
                    - scan
                    - error
                  additionalProperties: true
        - allOf:
            - $ref: "#/components/schemas/WebhookPayload"
            - type: object
              properties:
                sourcetype:
                  const: REPO_ADDED
                event:
                  type: object
                  properties:
                    metadata:
                      type: object
                      properties:
                        vcsType:
                          type: string
                          description: Source control system the repository was added from (e.g. 'github',
                            'gitlab', 'bitbucket')
                        repoUrl:
                          type: string
                          description: URL or full name of the newly connected repository
                      required:
                        - vcsType
                      additionalProperties: true
                  required:
                    - metadata
                  additionalProperties: true
    WebhookPayload_SCAN_STARTED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: SCAN_STARTED
            event:
              type: object
              properties:
                scan:
                  $ref: "#/components/schemas/WebhookScan"
              required:
                - scan
              additionalProperties: true
    WebhookPayload_SCAN_COMPLETE:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: SCAN_COMPLETE
            event:
              type: object
              properties:
                scan:
                  $ref: "#/components/schemas/WebhookScan"
              required:
                - scan
              additionalProperties: true
    WebhookPayload_PR_SCAN_STARTED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: PR_SCAN_STARTED
            event:
              type: object
              properties:
                scan:
                  $ref: "#/components/schemas/WebhookScan"
              required:
                - scan
              additionalProperties: true
    WebhookPayload_PR_SCAN_COMPLETE:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: PR_SCAN_COMPLETE
            event:
              type: object
              properties:
                scan:
                  $ref: "#/components/schemas/WebhookScan"
              required:
                - scan
              additionalProperties: true
    WebhookPayload_NEW_VULNERABILITIES_PR:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: NEW_VULNERABILITIES_PR
            event:
              type: object
              properties:
                metadata:
                  type: object
                  properties:
                    vulnerabilityIds:
                      type: array
                      items:
                        type: string
                      description: Array of vulnerability IDs (deprecated, use vulnerabilities
                        instead)
                    vulnerabilities:
                      type: array
                      items:
                        $ref: "#/components/schemas/WebhookVulnerabilityReference"
                      description: Array of vulnerability references with IDs and URLs
                  additionalProperties: true
              anyOf:
                - required:
                    - vulnerability
                - required:
                    - scan
              additionalProperties: true
    WebhookPayload_NEW_VULNERABILITIES_FULL_SCAN:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: NEW_VULNERABILITIES_FULL_SCAN
            event:
              type: object
              properties:
                metadata:
                  type: object
                  properties:
                    vulnerabilityIds:
                      type: array
                      items:
                        type: string
                      description: Array of vulnerability IDs (deprecated, use vulnerabilities
                        instead)
                    vulnerabilities:
                      type: array
                      items:
                        $ref: "#/components/schemas/WebhookVulnerabilityReference"
                      description: Array of vulnerability references with IDs and URLs
                  additionalProperties: true
              anyOf:
                - required:
                    - vulnerability
                - required:
                    - scan
              additionalProperties: true
    WebhookPayload_VULNERABILITY_PATCHED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: VULNERABILITY_PATCHED
            event:
              type: object
              properties:
                metadata:
                  type: object
                  properties:
                    vulnerabilityId:
                      type: string
                    vulnerabilityUrl:
                      type: string
                      description: URL to view the vulnerability in the ZeroPath UI
                    reason:
                      type: string
                      description: Reason for reopening (VULNERABILITY_REOPENED only)
                    prUrl:
                      type: string
                      description: PR URL for the patch (VULNERABILITY_PATCHED only)
                    patchId:
                      type: string
                      description: Patch ID (VULNERABILITY_PATCHED only)
                  additionalProperties: true
              anyOf:
                - required:
                    - metadata
                - required:
                    - vulnerability
              additionalProperties: true
    WebhookPayload_VULNERABILITY_REOPENED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: VULNERABILITY_REOPENED
            event:
              type: object
              properties:
                metadata:
                  type: object
                  properties:
                    vulnerabilityId:
                      type: string
                    vulnerabilityUrl:
                      type: string
                      description: URL to view the vulnerability in the ZeroPath UI
                    reason:
                      type: string
                      description: Reason for reopening (VULNERABILITY_REOPENED only)
                    prUrl:
                      type: string
                      description: PR URL for the patch (VULNERABILITY_PATCHED only)
                    patchId:
                      type: string
                      description: Patch ID (VULNERABILITY_PATCHED only)
                  additionalProperties: true
              anyOf:
                - required:
                    - metadata
                - required:
                    - vulnerability
              additionalProperties: true
    WebhookPayload_AUDIT_LOG_EVENT:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: AUDIT_LOG_EVENT
            event:
              type: object
              properties:
                audit_log:
                  $ref: "#/components/schemas/WebhookAuditLog"
              required:
                - audit_log
              additionalProperties: true
    WebhookPayload_SCAN_FAILED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: SCAN_FAILED
            event:
              type: object
              properties:
                scan:
                  $ref: "#/components/schemas/WebhookScan"
                error:
                  type: string
              required:
                - scan
                - error
              additionalProperties: true
    WebhookPayload_SCAN_SCHEDULED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: SCAN_SCHEDULED
            event:
              type: object
              properties:
                metadata:
                  type: object
                  properties:
                    scheduleId:
                      type: string
                    crontab:
                      type: string
                    action:
                      type: string
                      enum:
                        - created
                        - updated
                        - deleted
                  required:
                    - scheduleId
                    - crontab
                    - action
                  additionalProperties: true
              required:
                - metadata
              additionalProperties: true
    WebhookPayload_LONG_RUNNING_SCAN:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: LONG_RUNNING_SCAN
            event:
              type: object
              properties:
                metadata:
                  type: object
                  properties:
                    runningMinutes:
                      type: integer
                      minimum: 0
                  required:
                    - runningMinutes
                  additionalProperties: true
              required:
                - metadata
              additionalProperties: true
    WebhookPayload_PR_BLOCKED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: PR_BLOCKED
            event:
              type: object
              properties:
                metadata:
                  type: object
                  properties:
                    prId:
                      type: string
                    prNumber:
                      type: integer
                  required:
                    - prId
                    - prNumber
                  additionalProperties: true
              required:
                - metadata
              additionalProperties: true
    WebhookPayload_PR_MERGED_WITH_ISSUES:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: PR_MERGED_WITH_ISSUES
            event:
              type: object
              properties:
                scan:
                  $ref: "#/components/schemas/WebhookScan"
                metadata:
                  type: object
                  properties:
                    prUrl:
                      type: string
                    prNumber:
                      type: integer
                    prTitle:
                      type: string
                    mergedBy:
                      type: string
                    targetBranch:
                      type: string
                    vulnerabilityIds:
                      type: array
                      items:
                        type: string
                      description: Array of vulnerability IDs (deprecated, use vulnerabilities
                        instead)
                    vulnerabilities:
                      type: array
                      items:
                        $ref: "#/components/schemas/WebhookVulnerabilityReference"
                      description: Array of vulnerability references with IDs and URLs
                  required:
                    - prUrl
                    - targetBranch
                  additionalProperties: true
              required:
                - scan
                - metadata
              additionalProperties: true
    WebhookPayload_REPORT_COMPLETE:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: REPORT_COMPLETE
            event:
              type: object
              properties:
                metadata:
                  type: object
                  properties:
                    reportId:
                      type: string
                    month:
                      type: integer
                      minimum: 1
                      maximum: 12
                    year:
                      type: integer
                    title:
                      type: string
                    fileSize:
                      type: number
                      description: File size in bytes
                    userId:
                      type: string
                      description: User who requested the report
                  required:
                    - reportId
                  additionalProperties: true
              required:
                - metadata
              additionalProperties: true
    WebhookPayload_SCA_NEW_CVE:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: SCA_NEW_CVE
            event:
              type: object
              properties:
                metadata:
                  type: object
                  properties:
                    alertId:
                      type: string
                    cveId:
                      type: string
                    summary:
                      type: string
                    description:
                      type: string
                    severity:
                      type: number
                      description: Severity score
                    aliases:
                      type: array
                      items:
                        type: string
                      description: CVE aliases
                    references:
                      type: array
                      items:
                        type: string
                      description: Reference URLs
                    totalAffectedCount:
                      type: integer
                      minimum: 0
                    affectedIssuesShown:
                      type: integer
                      minimum: 0
                      maximum: 20
                    hasMoreThan20:
                      type: boolean
                    affectedRepositoryIds:
                      type: array
                      items:
                        type: string
                      description: Array of affected repository IDs
                    affectedIssues:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                          url:
                            type: string
                            description: URL to view the vulnerability in the ZeroPath UI
                          repositoryId:
                            type: string
                          repositoryName:
                            type: string
                          scanId:
                            type: string
                          score:
                            type: number
                          uiLink:
                            type: string
                        required:
                          - id
                          - url
                          - repositoryId
                          - scanId
                        additionalProperties: false
                      description: Detailed information about affected issues
                  required:
                    - alertId
                    - cveId
                    - summary
                    - totalAffectedCount
                    - affectedIssuesShown
                    - hasMoreThan20
                  additionalProperties: true
                vulnerability:
                  type: object
                  properties:
                    alertId:
                      type: string
                    packageIdentifier:
                      type: string
                    summary:
                      type: string
                    description:
                      type: string
                    severity:
                      type: number
                    totalAffectedCount:
                      type: integer
                      minimum: 0
                    affectedIssues:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                          url:
                            type: string
                          repositoryId:
                            type: string
                          repositoryName:
                            type: string
                          scanId:
                            type: string
                          score:
                            type: number
                          uiLink:
                            type: string
                        additionalProperties: false
                  additionalProperties: true
              required:
                - metadata
              additionalProperties: true
    WebhookPayload_SCA_NEW_ISSUE:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: SCA_NEW_ISSUE
    WebhookPayload_INBOUND_WEBHOOK:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: INBOUND_WEBHOOK
    WebhookPayload_PATCH_PR_DENIED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: PATCH_PR_DENIED
    WebhookPayload_VULNERABILITY_STATUS_CHANGED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: VULNERABILITY_STATUS_CHANGED
    WebhookPayload_SCA_SCAN_COMPLETE:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: SCA_SCAN_COMPLETE
    WebhookPayload_SCA_SCAN_STARTED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: SCA_SCAN_STARTED
    WebhookPayload_SCA_SCAN_FAILED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: SCA_SCAN_FAILED
    WebhookPayload_REPO_ADDED:
      allOf:
        - $ref: "#/components/schemas/WebhookPayload"
        - type: object
          properties:
            sourcetype:
              const: REPO_ADDED
