Create a new Holdout
1 min
POST
https://api.optimizely.com/flags/v1//projects/{project_id}/holdouts
project_idintegerThe project identifier
acceptstringGenerated from available response content types
bodyobject<p>Request body schema for creating or updating a holdout.</p>
<p>Holdouts are experiments that reserve a portion of your traffic to measure the impact of your feature flags and experiments. They help establish a control group by excluding a percentage of users from seeing any experiments, allowing you to measure the overall impact of your experimentation program.</p>
201<p>Successful retrieval, creation or update of a Holdout.</p>
<p>The response includes RESTful JSON (<a href="https://restfuljson.org/" target="_blank">https://restfuljson.org/</a>) styled links. If a
link is not present in the response, it indicates a user is not authorized to access
the related resource.</p>
400<p>Bad Request - Invalid input data or validation failure.</p>
<p>Common causes:</p>
<ul>
<li>Missing required fields (<code>key</code> or <code>name</code>)</li>
<li>Duplicate holdout key within the project</li>
<li>Invalid <code>key</code> format (must be alphanumeric with underscores/hyphens only)</li>
<li><code>traffic_allocation</code> outside valid range (0-10000)</li>
<li>Field length limits exceeded</li>
<li>Invalid JSON structure in request body</li>
<li>Malformed audience conditions or metrics configuration</li>
</ul>
401Invalid credentials
403Do not have permission to perform the operation
curl --request POST \
--url https://api.optimizely.com/flags/v1//projects/{project_id}/holdouts \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"key": "annual_growth_holdout",
"metrics": [
{
"aggregator": "",
"event_properties": {
"filter": {
"conditions": [
{
"name": "",
"operator": "",
"type": "",
"value": ""
}
]
}
},
"winning_direction": ""
}
],
"name": "Annual Growth Control Group",
"scope": "global",
"scope_type": "exclude"
}'