experiments

Facts about this project that decide how to configure a new experiment.

Returns the team's experiment defaults, which SDKs call feature flags, traffic on a target surface, the baseline of a candidate metric, how recent experiments were set up, and the most reused shared metrics. Each section has its own status, so a slow or failed read leaves the others valid. POST because the inputs describe a plan rather than a resource; the endpoint only reads.

post/api/projects/{project_id}/experiments/setup_context/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/experiments/setup_context/
  • 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

target_eventstring nullable

Event that marks a visit to the surface under test, for example '$pageview' or '$screen'. Needed for target_surface and for the baseline in candidate_metric.

target_url_containsstring nullable

Only counts target events whose $current_url contains this text, ignoring case. Needs target_event to be '$pageview'.

metric_eventstring nullable

Event of the candidate primary metric. With target_event, candidate_metric returns a baseline. Without it, candidate_metric returns only the event's volume. Also marks the shared metrics that count this event.

previous_experiments_limitinteger

How many experiments to return, most recently launched first, then drafts, 1 to 25.

shared_metrics_limitinteger

How many shared metrics to return, most reused first, 1 to 25.

Response

Changes

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