PostHog · Schema

PatchedAlert

A/B TestingAnalyticsFeature FlagsOpen SourceProduct AnalyticsSession Recording

Properties

Name Type Description
id string
created_by object
created_at string
insight integer Insight ID monitored by this alert. Note: Response returns full InsightBasicSerializer object.
name string Human-readable name for the alert.
subscribed_users array User IDs to subscribe to this alert. Note: Response returns full UserBasicSerializer object.
threshold object Threshold configuration with bounds and type for evaluating the alert.
condition object Alert condition type. Determines how the value is evaluated: absolute_value, relative_increase, or relative_decrease.
state string Current alert state: Firing, Not firing, Errored, or Snoozed.
enabled boolean Whether the alert is actively being evaluated.
last_notified_at string
last_checked_at string
next_check_at string
checks array Alert check results. By default returns the last 5. Use checks_date_from and checks_date_to (e.g. '-24h', '-7d') to get checks within a time window, checks_limit to cap how many are returned (default
checks_total integer Total alert checks matching the retrieve filters (date window). Only set on alert retrieve; omitted otherwise.
config object Trends-specific alert configuration. Includes series_index (which series to monitor) and check_ongoing_interval (whether to check the current incomplete interval).
detector_config object
calculation_interval object How often the alert is checked: hourly, daily, weekly, or monthly. * `hourly` - hourly * `daily` - daily * `weekly` - weekly * `monthly` - monthly
snoozed_until string Snooze the alert until this time. Pass a relative date string (e.g. '2h', '1d') or null to unsnooze.
skip_weekend boolean Skip alert evaluation on weekends (Saturday and Sunday, local to project timezone).
schedule_restriction object Blocked local time windows (HH:MM in the project timezone). Interval is half-open [start, end): start inclusive, end exclusive. Use blocked_windows array of {start, end}. Null disables.
last_value number The last calculated value from the most recent alert check.
investigation_agent_enabled boolean When enabled, an investigation agent runs on the state transition to firing and writes findings to a Notebook linked from the alert check. Only effective for detector-based (anomaly) alerts.
investigation_gates_notifications boolean When enabled (and investigation_agent_enabled is on), notification dispatch is held until the investigation agent produces a verdict. Notifications are suppressed when the verdict is false_positive (a
investigation_inconclusive_action object How to handle an 'inconclusive' verdict when notifications are gated. 'notify' is the safe default — an agent that can't be sure is itself useful signal. * `notify` - Notify * `suppress` - Suppress
View JSON Schema on GitHub

JSON Schema

posthog-patchedalert-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/PatchedAlert",
  "title": "PatchedAlert",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "created_by": {
      "allOf": [
        {
          "$ref": "#/components/schemas/UserBasic"
        }
      ],
      "readOnly": true
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "insight": {
      "type": "integer",
      "description": "Insight ID monitored by this alert. Note: Response returns full InsightBasicSerializer object."
    },
    "name": {
      "type": "string",
      "description": "Human-readable name for the alert."
    },
    "subscribed_users": {
      "type": "array",
      "items": {
        "type": "integer"
      },
      "description": "User IDs to subscribe to this alert. Note: Response returns full UserBasicSerializer object."
    },
    "threshold": {
      "allOf": [
        {
          "$ref": "#/components/schemas/Threshold"
        }
      ],
      "description": "Threshold configuration with bounds and type for evaluating the alert."
    },
    "condition": {
      "allOf": [
        {
          "$ref": "#/components/schemas/AlertCondition"
        }
      ],
      "nullable": true,
      "description": "Alert condition type. Determines how the value is evaluated: absolute_value, relative_increase, or relative_decrease."
    },
    "state": {
      "type": "string",
      "readOnly": true,
      "description": "Current alert state: Firing, Not firing, Errored, or Snoozed."
    },
    "enabled": {
      "type": "boolean",
      "description": "Whether the alert is actively being evaluated."
    },
    "last_notified_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true,
      "nullable": true
    },
    "last_checked_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true,
      "nullable": true
    },
    "next_check_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true,
      "nullable": true
    },
    "checks": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/AlertCheck"
      },
      "readOnly": true,
      "description": "Alert check results. By default returns the last 5. Use checks_date_from and checks_date_to (e.g. '-24h', '-7d') to get checks within a time window, checks_limit to cap how many are returned (default 5, max 500), and checks_offset to skip the newest N checks for pagination (0-based). Newest checks first. Only populated on retrieve."
    },
    "checks_total": {
      "type": "integer",
      "nullable": true,
      "readOnly": true,
      "description": "Total alert checks matching the retrieve filters (date window). Only set on alert retrieve; omitted otherwise."
    },
    "config": {
      "allOf": [
        {
          "$ref": "#/components/schemas/TrendsAlertConfig"
        }
      ],
      "nullable": true,
      "description": "Trends-specific alert configuration. Includes series_index (which series to monitor) and check_ongoing_interval (whether to check the current incomplete interval)."
    },
    "detector_config": {
      "allOf": [
        {
          "$ref": "#/components/schemas/DetectorConfig"
        }
      ],
      "nullable": true
    },
    "calculation_interval": {
      "allOf": [
        {
          "$ref": "#/components/schemas/CalculationIntervalEnum"
        }
      ],
      "description": "How often the alert is checked: hourly, daily, weekly, or monthly.\n\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly"
    },
    "snoozed_until": {
      "type": "string",
      "nullable": true,
      "description": "Snooze the alert until this time. Pass a relative date string (e.g. '2h', '1d') or null to unsnooze."
    },
    "skip_weekend": {
      "type": "boolean",
      "nullable": true,
      "description": "Skip alert evaluation on weekends (Saturday and Sunday, local to project timezone)."
    },
    "schedule_restriction": {
      "allOf": [
        {
          "$ref": "#/components/schemas/AlertScheduleRestriction"
        }
      ],
      "nullable": true,
      "description": "Blocked local time windows (HH:MM in the project timezone). Interval is half-open [start, end): start inclusive, end exclusive. Use blocked_windows array of {start, end}. Null disables."
    },
    "last_value": {
      "type": "number",
      "format": "double",
      "readOnly": true,
      "nullable": true,
      "description": "The last calculated value from the most recent alert check."
    },
    "investigation_agent_enabled": {
      "type": "boolean",
      "description": "When enabled, an investigation agent runs on the state transition to firing and writes findings to a Notebook linked from the alert check. Only effective for detector-based (anomaly) alerts."
    },
    "investigation_gates_notifications": {
      "type": "boolean",
      "description": "When enabled (and investigation_agent_enabled is on), notification dispatch is held until the investigation agent produces a verdict. Notifications are suppressed when the verdict is false_positive (and optionally when inconclusive). A safety-net task force-fires after a few minutes if the investigation stalls."
    },
    "investigation_inconclusive_action": {
      "allOf": [
        {
          "$ref": "#/components/schemas/InvestigationInconclusiveActionEnum"
        }
      ],
      "description": "How to handle an 'inconclusive' verdict when notifications are gated. 'notify' is the safe default \u2014 an agent that can't be sure is itself useful signal.\n\n* `notify` - Notify\n* `suppress` - Suppress"
    }
  }
}