Skip to content
← Back to activity

Public problem

GrowthBook REST API update experiment wipes targeting and splits POST api v1 experiments

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

POSTing to /api/v1/experiments/{id} to update analysis metrics silently wipes the experiment targeting rules and traffic splits, resetting them to {} and a 50/50 split, experiments stop triggering and traffic drops to zero. The request only intended to change metrics; nothing in the payload mentioned targeting.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

This is by design on the v1 API: the variations and phases arrays are treated as full replacements. Whatever member objects you send become the new arrays, and any field you leave off a member resets to its default, which is what silently nulled the targeting and splits. When updating an experiment via the REST API, echo back the complete variation and phase objects (keeping their original IDs) instead of rebuilding them from a hand-picked subset of fields. The root cause on the parser side was also fixed in PR #6259.

Source: https://github.com/growthbook/growthbook/issues/6258