experiments

Trigger a batch recalculation of all metrics for this experiment.

Returns 201 with the new pending recalculation, or 200 with the active one if a recalculation is already pending or in progress for this experiment. A manual trigger within five minutes after the latest completed run finished returns 429 with a Retry-After header. The response payload intentionally does not include the results array — at POST time the workflow has just been queued and no per-metric results exist yet. Clients should poll GET metrics_recalculation/{id}/ for results as the workflow progresses.

post/api/projects/{project_id}/experiments/{id}/metrics_recalculation/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/experiments/{id}/metrics_recalculation/
  • Auth: HTTP bearer

Path parameters

idinteger required

A unique integer value identifying this experiment.

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

trigger'manual' | 'manual_retry' | 'cold_run' | 'heal_latest_run' | 'experiment_config_change' | 'metric_config_change'
  • manual - Manual
  • manual_retry - Manual Retry
  • cold_run - Cold Run
  • heal_latest_run - Heal Latest Run
  • experiment_config_change - Experiment Config Change
  • metric_config_change - Metric Config Change

Response

idstring uuid required

Unique identifier for this recalculation job

experiment_idinteger required

ID of the experiment being recalculated

status'pending' | 'in_progress' | 'completed' | 'failed' required
  • pending - Pending
  • in_progress - In Progress
  • completed - Completed
  • failed - Failed
total_metricsinteger required

Total number of metrics to recalculate

completed_metricsinteger required

Number of metrics with a COMPLETED result row in this run (derived, not stored)

failed_metricsinteger required

Number of failed metrics in this run (derived): FAILED result rows plus discovery-step failures that never made it to a result row

metric_errorsunknown required
created_atstring date-time required

When the job was created

started_atstring date-time nullable required

When processing started

completed_atstring date-time nullable required

When processing completed

query_tostring date-time nullable required

Upper time bound the metrics in this run were calculated against (the data freshness cutoff). Shared by every metric in the run; null until processing starts

is_existingboolean required

True if returning an existing job rather than a newly created one

Changes

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