Kyverno ClusterPolicyReports API

Cluster-scoped policy report endpoints

OpenAPI Specification

kyverno-clusterpolicyreports-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Kyverno Policy Reporter ClusterPolicyReports API
  description: The Kyverno Policy Reporter REST API provides endpoints for querying PolicyReport and ClusterPolicyReport custom resources generated by Kyverno. It exposes policy results, status counts, and resource-level violation data, serving as the backend for the Policy Reporter UI. The API enables programmatic access to policy compliance status across namespaces and clusters.
  version: 2.0.0
  contact:
    name: Kyverno Community
    url: https://kyverno.io/community/
  termsOfService: https://kyverno.io/
servers:
- url: http://localhost:8080
  description: Default Policy Reporter server
tags:
- name: ClusterPolicyReports
  description: Cluster-scoped policy report endpoints
paths:
  /api/v1/cluster-policy-reports:
    get:
      operationId: listClusterPolicyReports
      summary: Kyverno List cluster-scoped policy reports
      description: Returns a paginated list of ClusterPolicyReport resources. These reports cover cluster-scoped resources such as Nodes, Namespaces, and ClusterRoles that are not bound to a specific namespace.
      tags:
      - ClusterPolicyReports
      parameters:
      - $ref: '#/components/parameters/sourceParam'
      - $ref: '#/components/parameters/pageParam'
      - $ref: '#/components/parameters/perPageParam'
      responses:
        '200':
          description: Paginated list of cluster policy reports
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PolicyReportList'
components:
  schemas:
    PolicyReport:
      type: object
      description: A PolicyReport or ClusterPolicyReport resource summary
      properties:
        name:
          type: string
          description: Name of the policy report resource
          example: cpol-require-labels
        namespace:
          type: string
          description: Namespace of the report (empty for cluster-scoped reports)
          example: default
        source:
          type: string
          description: Policy engine that generated the report
          example: kyverno
        summary:
          $ref: '#/components/schemas/ResultCounts'
        creationTimestamp:
          type: string
          format: date-time
          description: Timestamp when the policy report was created
    PolicyReportList:
      type: object
      description: Paginated list of policy reports
      properties:
        items:
          type: array
          description: List of policy report summaries
          items:
            $ref: '#/components/schemas/PolicyReport'
        count:
          type: integer
          description: Total number of policy reports matching the query
          example: 42
    ResultCounts:
      type: object
      description: Aggregated counts of policy results grouped by status
      properties:
        pass:
          type: integer
          description: Number of passing results
          example: 45
        fail:
          type: integer
          description: Number of failing results
          example: 3
        warn:
          type: integer
          description: Number of warning results
          example: 1
        error:
          type: integer
          description: Number of error results
          example: 0
        skip:
          type: integer
          description: Number of skipped results
          example: 2
  parameters:
    sourceParam:
      name: source
      in: query
      description: Filter results by policy source (e.g., kyverno, trivy)
      required: false
      schema:
        type: string
        example: kyverno
    pageParam:
      name: page
      in: query
      description: Page number for paginated results (1-based)
      required: false
      schema:
        type: integer
        minimum: 1
        default: 1
    perPageParam:
      name: perPage
      in: query
      description: Number of results per page
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 250
        default: 20
externalDocs:
  description: Policy Reporter API Reference
  url: https://kyverno.github.io/policy-reporter/core/api-reference/