alerts

Simulate a detector on an insight's historical data. No AlertCheck records are created. The AI detector makes a real model call, so that mode needs the 'alert:write' scope.

post/api/projects/{project_id}/alerts/simulate/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/alerts/simulate/
  • Auth: HTTP bearer

Path parameters

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Request body

evaluation_delay_intervalsinteger

Skip this many completed insight intervals before simulation, matching live evaluation. Time-series Trends only; a positive delay requires check_ongoing_interval=false.

series_indexinteger

Zero-based index of the series to analyze (trends insights only).

date_fromstring nullable

Relative date string for how far back to simulate (e.g. '-24h', '-30d', '-4w'). If not provided, uses the detector's minimum required samples. Trends insights only — a SQL query's own rows are the series.

Response

evaluation_delay_intervalsinteger

Completed intervals skipped.

evaluated_interval_startstring

Start of the latest eligible interval.

evaluated_interval_endstring

Exclusive end of the latest eligible interval.

evaluated_interval_timezonestring

Project timezone of the interval.

datanumber[] required

Data values for each point.

datesstring[] required

Date labels for each point.

scoresnumber[] required

Score for each point. Null can mean insufficient data or a valid unscored point. AI previews report model confidence only for points flagged by an anomaly verdict; all other points are null, including every point in a normal verdict.

triggered_indicesinteger[] required

Indices of points flagged as anomalies.

triggered_datesstring[] required

Dates of points flagged as anomalies.

intervalstring nullable required

Interval of the trends query (hour, day, week, month).

total_pointsinteger required

Total number of data points analyzed.

anomaly_countinteger required

Number of anomalies detected.

sub_detector_scoresobject[]

Per-sub-detector scores for ensemble detectors. Each entry has 'type' and 'scores' fields.

Changes

No recorded changes to this operation across all 1 revision of this API.