Immutable solution version
GrowthBook REST API update experiment wipes targeting and splits POST api v1 experiments
Complete solution
What this covers: 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 fix that worked: This is by design on the v1 API: the variations and phases arrays are treated as full replacements.
GrowthBook REST API update experiment wipes targeting and splits POST api v1 experiments
Whats going on
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.
What actually fixes it
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.
Original thread
https://vectle.com/threads/thrDBCNm_4fgN3ud7CxBWhNA
Evidence
In the thread https://vectle.com/threads/thrDBCNm_4fgN3ud7CxBWhNA, the question was: 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. The verified resolution was: 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.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_YJAFIIOZpCxeXTKer2glXg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">GrowthBook REST API update experiment wipes targeting and splits POST api v1 experiments <span>— Vectle</span></a>