---
updatedAt: 2026-10-28T15:16:17.000Z
agentTools:
  projectIndex: https://docs.cast.ai/llms.txt
---

# GetAuditHistogram returns a histogram of audit events bucketed by time and grouped by severity.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "servers": [
    {
      "url": "https://api.cast.ai/",
      "description": "US endpoint"
    },
    {
      "url": "https://api.eu.cast.ai/",
      "description": "EU endpoint"
    },
    {
      "url": "https://api.india.cast.ai/",
      "description": "India endpoint"
    }
  ],
  "info": {
    "title": "CAST.AI API documentation",
    "version": "1.0.0",
    "description": "### Feature maturity indicators (may appear on resources, operations and request/response fields)\n - **(BETA)** - new or experimental features, subject to change\n - **(Deprecated)** - outdated or replaced features (a reason and removal date will be provided in the description)\n"
  },
  "tags": [
    {
      "name": "AuditV2API"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    },
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v2/audit/histogram": {
      "get": {
        "operationId": "AuditV2API_GetAuditHistogram",
        "parameters": [
          {
            "description": "The date and time to query from.",
            "in": "query",
            "name": "fromDate",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "The date and time to query to. Defaults to now if not set.",
            "in": "query",
            "name": "toDate",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Plain-text search over audit event fields.",
            "in": "query",
            "name": "filter.search",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "List of audit event cluster IDs.",
            "explode": true,
            "in": "query",
            "name": "filter.clusters",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "List of audit event domains, e.g. \"platform\", \"autoscaler\".",
            "explode": true,
            "in": "query",
            "name": "filter.domains",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "List of audit event resources, e.g. \"cluster\", \"node\".",
            "explode": true,
            "in": "query",
            "name": "filter.resources",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "List of audit event actions, e.g. \"created\", \"deleted\".",
            "explode": true,
            "in": "query",
            "name": "filter.actions",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "List of audit event source services, e.g. \"provisioner\", \"woop\".",
            "explode": true,
            "in": "query",
            "name": "filter.sources",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "List of severity levels for audit events, e.g. \"info\", \"error\".",
            "explode": true,
            "in": "query",
            "name": "filter.severity",
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "Number of histogram buckets to return. Defaults to 100, capped at 1000.",
            "in": "query",
            "name": "numBuckets",
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/castai.audit.v2.GetAuditHistogramResponse"
                }
              }
            },
            "description": "A successful response."
          }
        },
        "summary": "GetAuditHistogram returns a histogram of audit events bucketed by time and grouped by severity.",
        "tags": [
          "AuditV2API"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "castai.audit.v2.GetAuditHistogramResponse": {
        "description": "GetAuditHistogramResponse is the response to a request for an audit event histogram.",
        "properties": {
          "interval": {
            "description": "The bucket interval used for the histogram, e.g. \"1m\", \"10m\", \"1h\", \"6h\", \"1d\".",
            "type": "string"
          },
          "buckets": {
            "description": "Histogram buckets containing event counts per time slice.",
            "items": {
              "$ref": "#/components/schemas/castai.audit.v2.HistogramBucket"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "castai.audit.v2.HistogramBucket": {
        "description": "HistogramBucket represents a single time bucket in the histogram.",
        "properties": {
          "time": {
            "description": "The start time of this bucket.",
            "format": "date-time",
            "type": "string"
          },
          "total": {
            "description": "Total number of events in this bucket.",
            "format": "int64",
            "type": "string"
          },
          "severity": {
            "additionalProperties": {
              "format": "int64",
              "type": "string"
            },
            "description": "Event count grouped by severity level.\nKeys are severity strings: \"info\", \"warning\", \"error\", \"critical\".",
            "type": "object"
          }
        },
        "type": "object"
      }
    }
  }
}
```