Autoresearch
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
POST | |
POST | |
POST | |
GET | |
POST |
Create autoresearch train
Start an asynchronous training run for this pipeline. Creates a Task/TaskRun sandbox where the autoresearch agent iterates on features and models, and returns the run immediately with status 'running'. Poll the training run until it reaches a terminal status (completed or failed). A pipeline's first run has no champion until it completes and promotion runs; on a retrain the existing champion stays live and keeps scoring until a new one is promoted.
Required API key scopes
autoresearch:writequery:readinsight:readPath parameters
- idstring
Request parameters
- iteration_budgetinteger
Response
Example request
POST /api /projects /:project_id /autoresearch /:id /trainExample response
Status 200 The created training run. Poll it through the training runs endpoint.
Status 400 A training run is already in progress, the pipeline is paused, or the pipeline's target or creator is no longer valid.
Status 403 The caller has no PostHog Desktop access, which cloud runs need, or the request comes from inside a sandbox.
Status 404 The pipeline does not exist or is archived.
Status 429 The team is over its PostHog Desktop usage limit.
Status 503 PostHog Desktop access could not be checked. Try again.
Create autoresearch train
Start an asynchronous training run for this pipeline. Creates a Task/TaskRun sandbox where the autoresearch agent iterates on features and models, and returns the run immediately with status 'running'. Poll the training run until it reaches a terminal status (completed or failed). A pipeline's first run has no champion until it completes and promotion runs; on a retrain the existing champion stays live and keeps scoring until a new one is promoted.
Required API key scopes
autoresearch:writequery:readinsight:readPath parameters
- idstring
Request parameters
- iteration_budgetinteger
Response
Example request
POST /api /projects /:project_id /autoresearch /:id /trainExample response
Status 200 The created training run. Poll it through the training runs endpoint.
Status 400 A training run is already in progress, the pipeline is paused, or the pipeline's target or creator is no longer valid.
Status 403 The caller has no PostHog Desktop access, which cloud runs need, or the request comes from inside a sandbox.
Status 404 The pipeline does not exist or is archived.
Status 429 The team is over its PostHog Desktop usage limit.
Status 503 PostHog Desktop access could not be checked. Try again.
Create autoresearch validate online
Validate predictions against realized outcomes for all matured prediction dates. A prediction date is matured when today >= prediction_date + horizon_days. Computes realized AUC, Brier score, calibration error (ECE), and lift@10/20 per model. Updates the model's realized_score, calibration_error, and clears the is_preliminary flag. Already-validated dates are skipped. In production this is triggered by the daily Temporal validation workflow after inference runs.
Required API key scopes
autoresearch:writequery:readPath parameters
- idstring
Example request
POST /api /projects /:project_id /autoresearch /:id /validate_onlineExample response
Status 200 One AutoresearchRun per matured prediction date that was validated. Empty list when no prediction dates have matured yet.
Status 400 An action target needs the action:read scope.
Status 404 The pipeline does not exist or is archived.
Create autoresearch validate online
Validate predictions against realized outcomes for all matured prediction dates. A prediction date is matured when today >= prediction_date + horizon_days. Computes realized AUC, Brier score, calibration error (ECE), and lift@10/20 per model. Updates the model's realized_score, calibration_error, and clears the is_preliminary flag. Already-validated dates are skipped. In production this is triggered by the daily Temporal validation workflow after inference runs.
Required API key scopes
autoresearch:writequery:readPath parameters
- idstring
Example request
POST /api /projects /:project_id /autoresearch /:id /validate_onlineExample response
Status 200 One AutoresearchRun per matured prediction date that was validated. Empty list when no prediction dates have matured yet.
Status 400 An action target needs the action:read scope.
Status 404 The pipeline does not exist or is archived.
Create autoresearch resolve template
Resolve a template key and optional overrides into a concrete pipeline config. For activity-based templates ('likely_active_soon', 'at_risk_of_inactivity', 'return_after_first_use'), the target event is auto-resolved from your event schema — check resolved_activity_event and activity_event_alternatives, then override if needed. For 'feature_adoption' and 'repeat_key_behavior', supply target_event. After resolving, call autoresearch-validate-create to check volume and warnings, then autoresearch-create to create the pipeline.
Required API key scopes
autoresearch:readquery:readRequest parameters
- template_key
- target_eventstring
- horizon_daysinteger
Response
Example request
POST /api /projects /:project_id /autoresearch /resolve-templateExample response
Status 200 Resolved pipeline config. Pass target_event, horizon_days, training_lookback_days, training_population, inference_population, and output_person_property directly to autoresearch-create. Always run autoresearch-validate-create on the resolved config before creating.
Status 400 Unknown template key or missing required target_event override.
Create autoresearch resolve template
Resolve a template key and optional overrides into a concrete pipeline config. For activity-based templates ('likely_active_soon', 'at_risk_of_inactivity', 'return_after_first_use'), the target event is auto-resolved from your event schema — check resolved_activity_event and activity_event_alternatives, then override if needed. For 'feature_adoption' and 'repeat_key_behavior', supply target_event. After resolving, call autoresearch-validate-create to check volume and warnings, then autoresearch-create to create the pipeline.
Required API key scopes
autoresearch:readquery:readRequest parameters
- template_key
- target_eventstring
- horizon_daysinteger
Response
Example request
POST /api /projects /:project_id /autoresearch /resolve-templateExample response
Status 200 Resolved pipeline config. Pass target_event, horizon_days, training_lookback_days, training_population, inference_population, and output_person_property directly to autoresearch-create. Always run autoresearch-validate-create on the resolved config before creating.
Status 400 Unknown template key or missing required target_event override.
List all autoresearch templates
Return all built-in autoresearch prediction templates. Each entry describes what the template predicts, its default horizon and prediction mode, and whether it requires you to supply a target_event. After choosing a template, call autoresearch-resolve-template-create to get a fully resolved pipeline config ready to pass to autoresearch-create.
Required API key scopes
autoresearch:readExample request
GET /api /projects /:project_id /autoresearch /templatesExample response
Status 200
List all autoresearch templates
Return all built-in autoresearch prediction templates. Each entry describes what the template predicts, its default horizon and prediction mode, and whether it requires you to supply a target_event. After choosing a template, call autoresearch-resolve-template-create to get a fully resolved pipeline config ready to pass to autoresearch-create.
Required API key scopes
autoresearch:readExample request
GET /api /projects /:project_id /autoresearch /templatesExample response
Status 200
Create autoresearch validate
Validate a proposed pipeline's target event and population before creating it. Returns volume estimates, base rate, and any warnings. Creation does not enforce the result: 'horizon_exceeds_lookback' and an 'error' 'population_too_large' mean a run would fail, and the other 'error' codes mean the data is too thin for a reliable model. Call this before autoresearch-create.
Required API key scopes
autoresearch:readquery:readRequest parameters
- target_eventstringDefault:
- target_definition
- horizon_daysintegerDefault:
7 - training_lookback_daysintegerDefault:
180 - training_populationobject
- inference_populationobject
Response
Example request
POST /api /projects /:project_id /autoresearch /validateExample response
Status 200 Validation result with volume estimates, base rate, and warnings.
Create autoresearch validate
Validate a proposed pipeline's target event and population before creating it. Returns volume estimates, base rate, and any warnings. Creation does not enforce the result: 'horizon_exceeds_lookback' and an 'error' 'population_too_large' mean a run would fail, and the other 'error' codes mean the data is too thin for a reliable model. Call this before autoresearch-create.
Required API key scopes
autoresearch:readquery:readRequest parameters
- target_eventstringDefault:
- target_definition
- horizon_daysintegerDefault:
7 - training_lookback_daysintegerDefault:
180 - training_populationobject
- inference_populationobject
Response
Example request
POST /api /projects /:project_id /autoresearch /validate