// Initialize the client
var client = new AbtestingClient(
new AbtestingConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);
// Call the API
var response = await client.EstimateABTestAsync(
new EstimateABTestRequest
{
Configuration = new EstimateConfiguration
{
EmptySearch = new EmptySearch { Exclude = true },
MinimumDetectableEffect = new MinimumDetectableEffect
{
Size = 0.03,
Metric = Enum.Parse<EffectMetric>("ConversionRate"),
},
},
Variants = new List<AddABTestsVariant>
{
new AddABTestsVariant(new AbTestsVariant { Index = "AB_TEST_1", TrafficPercentage = 50 }),
new AddABTestsVariant(new AbTestsVariant { Index = "AB_TEST_2", TrafficPercentage = 50 }),
},
}
);
// print the response
Console.WriteLine(response);
// Initialize the client with your application region, eg. abtesting.ALGOLIA_APPLICATION_REGION
client, err := abtesting.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", abtesting.US)
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.EstimateABTest(client.NewApiEstimateABTestRequest(
abtesting.NewEmptyEstimateABTestRequest().SetConfiguration(
abtesting.NewEmptyEstimateConfiguration().SetEmptySearch(
abtesting.NewEmptyEmptySearch().SetExclude(true)).SetMinimumDetectableEffect(
abtesting.NewEmptyMinimumDetectableEffect().SetSize(0.03).SetMetric(abtesting.EffectMetric("conversionRate")))).SetVariants(
[]abtesting.AddABTestsVariant{*abtesting.AbTestsVariantAsAddABTestsVariant(
abtesting.NewEmptyAbTestsVariant().SetIndex("AB_TEST_1").SetTrafficPercentage(50)), *abtesting.AbTestsVariantAsAddABTestsVariant(
abtesting.NewEmptyAbTestsVariant().SetIndex("AB_TEST_2").SetTrafficPercentage(50))})))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)
// Initialize the client
AbtestingClient client = new AbtestingClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");
// Call the API
EstimateABTestResponse response = client.estimateABTest(
new EstimateABTestRequest()
.setConfiguration(
new EstimateConfiguration()
.setEmptySearch(new EmptySearch().setExclude(true))
.setMinimumDetectableEffect(new MinimumDetectableEffect().setSize(0.03).setMetric(EffectMetric.CONVERSION_RATE))
)
.setVariants(
Arrays.asList(
new AbTestsVariant().setIndex("AB_TEST_1").setTrafficPercentage(50),
new AbTestsVariant().setIndex("AB_TEST_2").setTrafficPercentage(50)
)
)
);
// print the response
System.out.println(response);
// Initialize the client
// Replace 'us' with your Algolia Application Region
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initAbtesting({ region: 'us' });
// Call the API
const response = await client.estimateABTest({
configuration: {
emptySearch: { exclude: true },
minimumDetectableEffect: { size: 0.03, metric: 'conversionRate' },
},
variants: [
{ index: 'AB_TEST_1', trafficPercentage: 50 },
{ index: 'AB_TEST_2', trafficPercentage: 50 },
],
});
// print the response
console.log(response);
// Initialize the client
var client = new AbtestingClient(
new AbtestingConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);
// Call the API
var response = await client.EstimateABTestAsync(
new EstimateABTestRequest
{
Configuration = new EstimateConfiguration
{
EmptySearch = new EmptySearch { Exclude = true },
MinimumDetectableEffect = new MinimumDetectableEffect
{
Size = 0.03,
Metric = Enum.Parse<EffectMetric>("ConversionRate"),
},
},
Variants = new List<AddABTestsVariant>
{
new AddABTestsVariant(new AbTestsVariant { Index = "AB_TEST_1", TrafficPercentage = 50 }),
new AddABTestsVariant(new AbTestsVariant { Index = "AB_TEST_2", TrafficPercentage = 50 }),
},
}
);
// print the response
Console.WriteLine(response);
// Initialize the client with your application region, eg. abtesting.ALGOLIA_APPLICATION_REGION
client, err := abtesting.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", abtesting.US)
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.EstimateABTest(client.NewApiEstimateABTestRequest(
abtesting.NewEmptyEstimateABTestRequest().SetConfiguration(
abtesting.NewEmptyEstimateConfiguration().SetEmptySearch(
abtesting.NewEmptyEmptySearch().SetExclude(true)).SetMinimumDetectableEffect(
abtesting.NewEmptyMinimumDetectableEffect().SetSize(0.03).SetMetric(abtesting.EffectMetric("conversionRate")))).SetVariants(
[]abtesting.AddABTestsVariant{*abtesting.AbTestsVariantAsAddABTestsVariant(
abtesting.NewEmptyAbTestsVariant().SetIndex("AB_TEST_1").SetTrafficPercentage(50)), *abtesting.AbTestsVariantAsAddABTestsVariant(
abtesting.NewEmptyAbTestsVariant().SetIndex("AB_TEST_2").SetTrafficPercentage(50))})))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)
// Initialize the client
AbtestingClient client = new AbtestingClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");
// Call the API
EstimateABTestResponse response = client.estimateABTest(
new EstimateABTestRequest()
.setConfiguration(
new EstimateConfiguration()
.setEmptySearch(new EmptySearch().setExclude(true))
.setMinimumDetectableEffect(new MinimumDetectableEffect().setSize(0.03).setMetric(EffectMetric.CONVERSION_RATE))
)
.setVariants(
Arrays.asList(
new AbTestsVariant().setIndex("AB_TEST_1").setTrafficPercentage(50),
new AbTestsVariant().setIndex("AB_TEST_2").setTrafficPercentage(50)
)
)
);
// print the response
System.out.println(response);
// Initialize the client
// Replace 'us' with your Algolia Application Region
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initAbtesting({ region: 'us' });
// Call the API
const response = await client.estimateABTest({
configuration: {
emptySearch: { exclude: true },
minimumDetectableEffect: { size: 0.03, metric: 'conversionRate' },
},
variants: [
{ index: 'AB_TEST_1', trafficPercentage: 50 },
{ index: 'AB_TEST_2', trafficPercentage: 50 },
],
});
// print the response
console.log(response);
// Initialize the client
val client = AbtestingClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = Option("ALGOLIA_APPLICATION_REGION")
)
// Call the API
val response = Await.result(
client.estimateABTest(
estimateABTestRequest = EstimateABTestRequest(
configuration = EstimateConfiguration(
emptySearch = Some(
EmptySearch(
exclude = Some(true)
)
),
minimumDetectableEffect = MinimumDetectableEffect(
size = 0.03,
metric = EffectMetric.withName("conversionRate")
)
),
variants = Seq(
AbTestsVariant(
index = "AB_TEST_1",
trafficPercentage = 50
),
AbTestsVariant(
index = "AB_TEST_2",
trafficPercentage = 50
)
)
)
),
Duration(100, "sec")
)
// print the response
println(response)
// Initialize the client
let client = try AbtestingClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)
// Call the API
let response = try await client.estimateABTest(estimateABTestRequest: AbtestingEstimateABTestRequest(
configuration: AbtestingEstimateConfiguration(
emptySearch: EmptySearch(exclude: true),
minimumDetectableEffect: AbtestingMinimumDetectableEffect(
size: 0.03,
metric: AbtestingEffectMetric.conversionRate
)
),
variants: [
AbtestingAddABTestsVariant.abtestingAbTestsVariant(AbtestingAbTestsVariant(
index: "AB_TEST_1",
trafficPercentage: 50
)),
AbtestingAddABTestsVariant.abtestingAbTestsVariant(AbtestingAbTestsVariant(
index: "AB_TEST_2",
trafficPercentage: 50
)),
]
))
// print the response
print(response)
{ "durationDays": 21, "sampleSizes": [ 23415 ]}
{
"message": "Invalid Application-Id or API-Key"
}
{
"message": "Invalid Application-Id or API-Key"
}
{
"message": "Invalid Application-Id or API-Key"
}
{
"message": "Invalid Application-Id or API-Key"
}
Replaced by POST /3/abtests/estimate.Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.Required ACL:analytics
Your Algolia API key with the necessary permissions to make the request.
Permissions are controlled through access control lists (ACL) and access restrictions.
The required ACL to make a request is listed in each endpoint's reference.
Sample size estimates for each variant. The first element is the control variant.
Each element is the estimated number of searches required to achieve the desired statistical significance.
Number of tracked searches needed to be able to detect the configured effect for the control variant.
Last modified on September 9, 2026
Was this page helpful?
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Algolia","description":"Build search, discovery, and AI experiences with Algolia. Guides, API references, libraries, UI components, and integrations for your stack.","colors":{"primary":"#3970ff","light":"#3970ff","dark":"#003DFF"},"logo":{"light":"https://mintcdn.com/algolia/kiecJp3hu-WXhj-3/logo/light.svg?fit=max\u0026auto=format\u0026n=kiecJp3hu-WXhj-3\u0026q=85\u0026s=bf613e260ca94c0eb23384e6c0d5c77f","dark":"https://mintcdn.com/algolia/kiecJp3hu-WXhj-3/logo/dark.svg?fit=max\u0026auto=format\u0026n=kiecJp3hu-WXhj-3\u0026q=85\u0026s=31a97f60063c111253c518bc0c638e70","href":"/doc"},"favicon":"https://mintcdn.com/algolia/ApgdWRCFtd9v2oPX/favicon.png?fit=max\u0026auto=format\u0026n=ApgdWRCFtd9v2oPX\u0026q=85\u0026s=91df7c93abadfb122ffc8e0f78cc2dc8","api":{"playground":{"display":"simple"},"examples":{"languages":["curl","csharp","dart","go","java","javascript","kotlin","php","python","ruby","scala","swift"],"autogenerate":false}},"navbar":{"links":[{"href":"https://dashboard.algolia.com/users/sign_in","label":"Log in"}],"primary":{"type":"button","label":"Create account","href":"https://www.algolia.com/users/sign_up"}},"footer":{"socials":{"linkedin":"https://www.linkedin.com/company/algolia","x":"https://twitter.com/algolia","discord":"https://alg.li/discord","youtube":"https://www.youtube.com/channel/UCTNkiq-SO8hay1PRx-it9Cw","website":"https://www.algolia.com"},"links":[{"items":[{"label":"Support","href":"https://support.algolia.com/hc/en-us"},{"label":"Glossary","href":"/doc/glossary"},{"label":"Privacy policy","href":"https://www.algolia.com/policies/privacy"},{"label":"Cookie settings","href":"https://www.algolia.com"}]}]},"seo":{"metatags":{"canonical":"https://www.algolia.com"},"organization":{"id":"https://www.algolia.com/#organization","name":"Algolia","url":"https://www.algolia.com","sameAs":["https://www.linkedin.com/company/algolia/","https://github.com/algolia","https://x.com/algolia","https://www.youtube.com/channel/UCTNkiq-SO8hay1PRx-it9Cw"]}},"fonts":{"heading":{"family":"Sora"}},"icons":{"library":"lucide"},"styling":{"eyebrows":"section","codeblocks":"system","latex":true},"integrations":{"segment":{"key":"cKQbv9nMHIUgdWswDLG0c3UdiUgBaUmA"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity"],"display":"header"},"metadata":{"timestamp":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"algolia","hasAudioNarration":false,"actualSubdomain":"algolia","customDomains":["www.algolia.com"],"gitSource":{"type":"github","owner":"algolia","repo":"docs-new","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aeca9e3dd9d9f5b04d8709f","collectionId":"faad69cf-2ddf-49c7-a639-be5faf8f8b97","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aeca9e3dd9d9f5b04d8709f"},"feedback":{"thumbs":true,"edits":true,"issues":true,"agentFeedback":false},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aedffff2f3197cf5b96845b","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"Libraries and tools","count":629},{"language":"default","tag":"Guides","count":585},{"language":"default","tag":"API clients","count":418},{"language":"default","tag":"Search and Discovery platform","count":408},{"language":"default","tag":"API reference","count":400},{"language":"default","tag":"Reference","count":293},{"language":"default","tag":"UI libraries","count":290},{"language":"default","tag":"Build Search UI","count":235},{"language":"default","tag":"Search","count":187},{"language":"default","tag":"React InstantSearch","count":169}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":":root{--radius: 0.5rem;--rounded-2xl: var(--radius);--rounded-xl: var(--radius);--rounded-lg: var(--radius);--rounded-md: var(--radius);--rounded-full: var(--radius);--icon-stroke: #000000;--border-color: rgb(var(--gray-200) / 0.5);--font-weight-headings-custom: 700;--docsearch-background-color: #f5f6f7;--filters-token-string-color: #b46900;--filters-token-error-color: #d7263d;--filters-token-paren-color: #005cc5;--filters-token-num-color: #6f42c1;--filters-token-operator-color: #22863a;--docsearch-sidepanel-border: var(--border-color);--docsearch-sidepanel-background: rgb(244, 246, 250);--docsearch-sidepanel-background-dark: #fff;--docsearch-hit-background-muted: rgb(247, 247, 248);--docsearch-searchbox-focus-background: #fff}:root.dark,html[data-theme=dark]{--icon-stroke: #ffffff;--border-color: rgb(var(--gray-900) / 0.8);--docsearch-background-color: #0a0b11 !important;--docsearch-dropdown-menu-background: #10121e;--docsearch-dropdown-menu-item-hover-background: #0a0b11;--docsearch-hit-color: #e5e7eb;--filters-token-string-color: #ffa657;--filters-token-error-color: #ff6b6b;--filters-token-paren-color: #79c0ff;--filters-token-num-color: #d2a8ff;--filters-token-operator-color: #7ee787;--docsearch-sidepanel-background: rgb(15, 17, 23);--docsearch-sidepanel-background-dark: rgba(11, 13, 17, 1);--docsearch-hit-background-muted: rgb(14, 17, 23);--docsearch-modal-background: #0a0b11;--docsearch-hit-focus-background: rgb(var(--gray-900))}.rounded-\\[0\\.85rem\\]{border-radius:var(--radius)}#banner{background-color:#23263b}#banner a{color:inherit}#background-div{background-color:#f6f6fa}.dark #background-div{background-color:#ffffff;opacity:0.03}#pagination{display:none}.background-lines{fill:#c5c9e0}.dark .background-lines{fill:#ffffff;fill-opacity:0.15}th{text-align:left}.tooltip{user-select:text}.prose a{font-weight:inherit}.prose a strong{font-weight:600}.katex-display>.katex{overflow-y:hidden}.prose a.link[href^=\"http\"]:not([href^=\"https://www.algolia.com/doc\"]){white-space:nowrap}.prose a.link[href^=\"http\"]:not([href^=\"https://www.algolia.com/doc\"])::after{display:inline-block;width:14px;height:14px;margin-left:4px;vertical-align:-2px;content:\"\";background-color:currentColor;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E\u003cpath d='M15 3h6v6'/%3E\u003cpath d='M10 14 21 3'/%3E\u003cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3C/svg%3E\") center / contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E\u003cpath d='M15 3h6v6'/%3E\u003cpath d='M10 14 21 3'/%3E\u003cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3C/svg%3E\") center / contain no-repeat}.prose h2 code,.prose h3 code,.prose h4 code{font-weight:700}.prose table a code{word-break:keep-all}[data-component-part=\"field-content\"]{margin-left:1.5rem}[data-component-part=\"code-block-root\"]{border-radius:var(--radius)}#content-area img{margin-inline:auto;background:transparent!important}#content-area img:not(.no-shadow){box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1)}#content-area video{margin-inline:auto}.video-embed{display:block;width:100%;min-width:0;max-width:var(--video-embed-max-width, 644px);aspect-ratio:16 / 9;height:auto;margin-inline:auto}button+div[aria-hidden=\"true\"]{background-color:#23263b;border-radius:var(--radius);box-shadow:0 0 0 1px #23263b0d, 0 4px 8px -2px #23263b40;color:#fff;padding:.5rem .75rem}#feedback-toolbar button{border-radius:var(--radius)}html.no-overflow{overflow:hidden}body.DocSearch--active{overflow:initial!important}.DocSearch-Container{visibility:hidden;opacity:0;transition:opacity 120ms ease;padding-top:5vh;position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0, 0, 0, 0.1);display:flex;align-items:flex-start;justify-content:center;z-index:200;cursor:initial}.DocSearch-Container.docsearch-ready{visibility:visible;opacity:1}.dark .DocSearch-Form,.dark .DocSearch-SearchBar{background-color:transparent!important}.DocSearch-Dropdown{border-top:1px solid var(--docsearch-subtle-color);scrollbar-color:#9698c3 #f5f6f7;scrollbar-width:thin}.dark .DocSearch-Container{--docsearch-text-color: #c4c7dc}.dark .DocSearch-Dropdown{scrollbar-color:#7f8497 #15172a}.dark .DocSearch-Close{color:#5172FF}.dark .DocSearch-Close svg{color:#5172FF}.dark .DocSearch-MagnifierLabel svg{color:#5172FF}.DocSearch-SidepanelButton.floating{display:none}.dark .DocSearch-Dropdown{border-color:#212139}.dark .DocSearch-Divider{border-color:#212139}.dark .DocSearch-Input{color:white;caret-color:white}.dark .DocSearch-Container{background-color:rgba(0, 0, 0, 0.6)!important}.dark .DocSearch-SearchBar,.dark .DocSearch-Form,.dark .DocSearch-Input{color:#ffffff!important}.dark .DocSearch-Input::placeholder{color:#ffffff!important;opacity:0.9}.dark .DocSearch-Reset,.dark .DocSearch-Reset span,.dark .DocSearch-Reset svg,.dark .DocSearch-Close,.dark .DocSearch-Close svg{color:#5172ff!important;fill:#5172ff!important;stroke:#5172ff!important}.dark .DocSearch-Cancel,.dark .DocSearch-Cancel svg{color:#ffffff!important;fill:#ffffff!important;stroke:#ffffff!important}.dark .DocSearch-MagnifierLabel,.dark .DocSearch-MagnifierLabel svg{color:#5172ff!important;fill:#5172ff!important;stroke:#5172ff!important}.dark .DocSearch-Dropdown{background-color:#0a0b11!important}.dark .DocSearch-Hits mark{background-color:transparent!important;color:#7aa2ff!important}.dark .DocSearch-Hit a{color:#e5e7eb!important;border-color:#1b1e29!important}.dark .DocSearch-Hit[aria-selected=true] .DocSearch-Hit-action,.dark .DocSearch-Hit[aria-selected=true] .DocSearch-Hit-icon{color:#7aa2ff}.dark .DocSearch-Title,.dark .DocSearch-Label{background-color:#0f1117!important}.dark .DocSearch-Title,.dark .DocSearch-Label,.dark .DocSearch-Hit-source{color:#e5e7eb!important}.dark .DocSearch-Footer{background-color:#0f1117!important;border-top:1px solid #1b1e29!important;color:#cbd5e1!important}.DocSearch-Hit--AskAI .DocSearch-AskAiScreen-Response .DocSearch-AskAiScreen-RelatedSources-Item-Link{background:var(--docsearch-hit-background-muted)!important}.DocSearch-Hit-AskAIButton-title-query{color:var(--docsearch-highlight-color)}.dark .DocSearch-Hit-AskAIButton-title-query{color:#7aa2ff!important}.dark .DocSearch-AskAiScreen-Response{color:#f5f6f7!important}.dark .DocSearch-Markdown-Content,.dark .DocSearch-Markdown-Content li{color:#cbd5e1!important}.dark .DocSearch-Markdown-Content a{color:#7aa2ff!important}.dark .DocSearch-AskAiScreen-RelatedSources-Item-Link{color:#cbd5e1}.dark .DocSearch-AskAiScreen-Response .DocSearch-CodeSnippet .DocSearch-CodeSnippet-CopyButton{background-color:#0f1117!important;color:#cbd5e1!important}.dark .DocSearch-AskAiScreen-Response .DocSearch-CodeSnippet pre{background-color:#0f1117!important;color:#e5e7eb!important}.dark .DocSearch-AskAiScreen-Response .DocSearch-CodeSnippet pre code{background-color:transparent!important;color:inherit!important}.DocSearch-Modal{position:relative;overflow:hidden;width:700px;max-width:90vw;border-radius:var(--radius);box-shadow:0 4px 12px rgba(0, 0, 0, 0.15)}.docsearch-expanded .DocSearch-Modal{max-height:auto;border-radius:var(--radius);box-shadow:0 25px 50px -12px rgba(0, 0, 0, 0.25)}@media (max-width: 768px){.DocSearch-Container{padding-top:0}.DocSearch-Modal{width:100vw;max-width:100vw;border-radius:var(--radius)}.docsearch-expanded .DocSearch-Modal{max-height:100vh;border-radius:var(--radius)}.DocSearch-Dropdown{height:calc(100vh - var(--docsearch-footer-height) - var(--docsearch-searchbox-height, var(--docsearch-searchbox-initial-height)))}.docsearch-sidepanel-toggle .docsearch-sidepanel-label,.docsearch-sidepanel-toggle .docsearch-sidepanel-shortcut{display:none}.docsearch-sidepanel-toggle{padding:0 0.5rem}}@media (min-width: 769px){.docsearch-sidepanel-toggle{border:1px solid transparent;box-shadow:0 0 0 1px rgba(156, 163, 175, 0.3)}.docsearch-sidepanel-toggle:hover{box-shadow:0 0 0 1px rgba(75, 85, 99, 0.3)}html.dark .docsearch-sidepanel-toggle{box-shadow:0 0 0 1px rgba(75, 85, 99, 0.3)}html.dark .docsearch-sidepanel-toggle:hover{box-shadow:0 0 0 1px rgba(107, 114, 128, 0.3)}}.DocSearch-Sidepanel-Header{height:3.0rem}.DocSearch-Sidepanel-Container.inline.side-right{border-bottom-left-radius:0;border-left:1px solid var(--docsearch-sidepanel-border);border-top-left-radius:0}.DocSearch-Sidepanel-Container{box-shadow:none}.DocSearch-MCP-Callout{font-size:0.875em;display:flex;align-items:center;gap:0.25rem;color:var(--docsearch-text-color);padding-inline:0.25rem 0.5rem;padding-block:0.25rem;border-radius:var(--docsearch-border-radius);background-color:var(--docsearch-hit-focus-background);min-block-size:1.5rem}.DocSearch-MCP-Callout:hover,.DocSearch-MCP-Callout:focus-visible{outline:2px solid var(--docsearch-highlight-color)}.DocSearch-MCP-Callout svg{height:1rem;width:1rem;color:var(--docsearch-highlight-color);margin-block-start:1px}html.dark #filter-validator{background-color:var(--shiki-dark-bg)}#filter-validator{.Token_EOF {\n color: transparent;\n }\n\n .Token_Empty_Str,\n .Token_Incomplete_Str,\n .Token_String,\n .Token_Term {\n color: var(--filters-token-string-color);\n }\n\n .Token_Error {\n color: var(--filters-token-error-color);\n }\n\n .Token_Open_Paren,\n .Token_Close_Paren,\n .Token_Open_Angled_Bracket,\n .Token_Close_Angled_Bracket,\n .Token_Comma,\n .Token_Facet_Separator {\n color: var(--filters-token-paren-color);\n }\n\n .Token_Num {\n color: var(--filters-token-num-color);\n }\n\n .Token_OR,\n .Token_AND,\n .Token_NOT,\n .Token_Operator,\n .Token_Range {\n color: var(--filters-token-operator-color);\n }}.nav-tag-pill-text{text-transform:uppercase;letter-spacing:1px}[data-group-tag]>button>div{display:flex;align-items:center;gap:0.5rem}.steps .step .prose ol{list-style-type:lower-alpha}.no-bullets ul{margin-top:1rem;padding-left:0;margin-left:0;list-style:none}@layer components{.prose .no-bullets li{margin:0.5rem 0;margin-left:0!important;padding-left:0!important;list-style:none}}.no-bullets a.link{border-bottom-color:transparent}.no-bullets a.link:hover,.no-bullets a.link:focus-visible{border-bottom-color:rgb(57, 112, 255)}.no-bullets li::before{content:none!important}.homepage-hero{background-color:#23263b;background-image:linear-gradient(\n 90deg,\n rgba(12, 30, 69, 0.82) 0%,\n rgba(12, 30, 69, 0.72) 34%,\n rgba(12, 30, 69, 0.58) 58%,\n rgba(12, 30, 69, 0.44) 100%\n ),\n url(\"/mintlify-assets/hero.png\");background-position:center, 72% center;background-repeat:no-repeat;background-size:cover}@supports (background-image: image-set(url(\"/mintlify-assets/hero.webp\") type(\"image/webp\") 1x)){.homepage-hero{background-image:linear-gradient(\n 90deg,\n rgba(12, 30, 69, 0.82) 0%,\n rgba(12, 30, 69, 0.72) 34%,\n rgba(12, 30, 69, 0.58) 58%,\n rgba(12, 30, 69, 0.44) 100%\n ),\n image-set(\n url(\"/mintlify-assets/hero.webp\") type(\"image/webp\") 1x,\n url(\"/mintlify-assets/hero.png\") type(\"image/png\") 1x\n )}}@supports (background-image: -webkit-image-set(url(\"/mintlify-assets/hero.webp\") type(\"image/webp\") 1x)){.homepage-hero{background-image:linear-gradient(\n 90deg,\n rgba(12, 30, 69, 0.82) 0%,\n rgba(12, 30, 69, 0.72) 34%,\n rgba(12, 30, 69, 0.58) 58%,\n rgba(12, 30, 69, 0.44) 100%\n ),\n -webkit-image-set(\n url(\"/mintlify-assets/hero.webp\") type(\"image/webp\") 1x,\n url(\"/mintlify-assets/hero.png\") type(\"image/png\") 1x\n )}}.homepage-hero-cta{display:inline-flex;align-items:center;justify-content:center;gap:0;padding:0.5rem 0.875rem;border-radius:var(--radius);background:linear-gradient(220deg, rgb(69, 122, 255) 0%, rgb(30, 89, 255) 60.16%);color:#fff!important;font-family:Sora, sans-serif;font-size:0.875rem;font-weight:700;line-height:1.5rem;letter-spacing:0.28px;text-decoration:none;transition:all 150ms ease}.homepage-hero-cta:hover{background:linear-gradient(138deg, rgba(118, 160, 255, 0.7) 0%, rgba(0, 61, 255, 0.7) 25.08%, rgba(151, 71, 255, 0.7) 56.38%, rgba(118, 160, 255, 0.7) 100%), rgb(0, 61, 255);color:#fff!important}@media (min-width: 1024px){.homepage-hero-cta{padding:0.75rem 1.25rem;font-size:1rem;letter-spacing:0.32px}}.sig-param-link{color:inherit;text-decoration:underline;text-decoration-style:dotted;text-decoration-thickness:1px;text-underline-offset:3px;text-decoration-color:color-mix(in srgb, currentColor 45%, transparent);cursor:pointer;border-radius:2px;transition:text-decoration-color 120ms ease, text-decoration-thickness 120ms ease}.sig-param-link:hover,.sig-param-link:focus-visible,.line:has(.sig-param-link:hover) .sig-param-link,.line:has(.sig-param-link:focus-visible) .sig-param-link{text-decoration-style:solid;text-decoration-thickness:2px;text-decoration-color:currentColor;outline:none}.mint-flavor-switcher-slot{min-height:2.75rem;margin:0.25rem 0 1.5rem}.mint-flavor-switcher-slot .mint-flavor-switcher{margin:0}"}],"page":{"pagePath":"doc/rest-api/abtesting/estimate-ab-test","slug":"/doc/rest-api/abtesting/estimate-ab-test","pageMetadata":{"title":"Estimate the sample size and duration of an A/B test","description":"This endpoint is deprecated. Use the A/B Testing API v3 instead.","openapi":"specs/abtesting.yml post /2/abtests/estimate","public":true,"href":"/doc/rest-api/abtesting/estimate-ab-test"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"This endpoint is deprecated. Use the A/B Testing API v3 instead.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,strong:`strong`,..._provideComponents(),...props.components};return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Replaced by `,_jsx(_components.code,{children:`POST /3/abtests/estimate`}),`.`]}),`\n`,_jsx(_components.p,{children:`Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Required ACL:`}),` `,_jsx(_components.code,{children:`analytics`})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"codeStyling":"system","config":{},"pageMetadata":{"title":"Estimate the sample size and duration of an A/B test","description":"This endpoint is deprecated. Use the A/B Testing API v3 instead.","openapi":"specs/abtesting.yml post /2/abtests/estimate","public":true,"href":"/doc/rest-api/abtesting/estimate-ab-test"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":["/_mintlify/custom/algolia/34bdaaeaccaa769c/docsearch.js","/_mintlify/custom/algolia/e18afef8ba6306ba/one-trust.js","/_mintlify/custom/algolia/5a5e6ade8ff45aec/utm-attribution.js","/_mintlify/custom/algolia/a4b9f2f416e55759/iframe-resize.js","/_mintlify/custom/algolia/dbca34a8de6b147e/instantsearch-api-signature-links.js","/_mintlify/custom/algolia/4e6ff31277aab3f2/segment-analytics.js","/_mintlify/custom/algolia/ae5f1d742fc727f6/optinmonster.js"],"openApiReferenceData":{"operation":{"tags":["abtest"],"operationId":"estimateABTest","deprecated":true,"x-acl":["analytics"],"summary":"Estimate the sample size and duration of an A/B test","description":"This endpoint is deprecated. Use the A/B Testing API v3 instead.","requestBody":"76b5a592-d7a3-49b5-9167-27abf71cbdd3","responses":{"200":"0df20bac-6ab6-4936-bf27-c6c18bd3b3a0","400":"6930b562-3265-4214-ad2f-274eced32fdb","402":"222d9d8e-55e0-4b20-b6c3-51e12907ba05","403":"7cc0a579-4c51-4c5c-800e-aac4ed9d7845","404":"b3440687-90cd-44c9-a0ad-decd4409ad9d"},"x-codeSamples":[{"lang":"csharp","label":"C#","source":"// Initialize the client\nvar client = new AbtestingClient(\n new AbtestingConfig(\"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", \"ALGOLIA_APPLICATION_REGION\")\n);\n\n// Call the API\nvar response = await client.EstimateABTestAsync(\n new EstimateABTestRequest\n {\n Configuration = new EstimateConfiguration\n {\n EmptySearch = new EmptySearch { Exclude = true },\n MinimumDetectableEffect = new MinimumDetectableEffect\n {\n Size = 0.03,\n Metric = Enum.Parse\u003cEffectMetric>(\"ConversionRate\"),\n },\n },\n Variants = new List\u003cAddABTestsVariant>\n {\n new AddABTestsVariant(new AbTestsVariant { Index = \"AB_TEST_1\", TrafficPercentage = 50 }),\n new AddABTestsVariant(new AbTestsVariant { Index = \"AB_TEST_2\", TrafficPercentage = 50 }),\n },\n }\n);\n\n// print the response\nConsole.WriteLine(response);"},{"lang":"go","label":"Go","source":"// Initialize the client with your application region, eg. abtesting.ALGOLIA_APPLICATION_REGION\nclient, err := abtesting.NewClient(\"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", abtesting.US)\nif err != nil {\n // The client can fail to initialize if you pass an invalid parameter.\n panic(err)\n}\n\n// Call the API\nresponse, err := client.EstimateABTest(client.NewApiEstimateABTestRequest(\n\n abtesting.NewEmptyEstimateABTestRequest().SetConfiguration(\n abtesting.NewEmptyEstimateConfiguration().SetEmptySearch(\n abtesting.NewEmptyEmptySearch().SetExclude(true)).SetMinimumDetectableEffect(\n abtesting.NewEmptyMinimumDetectableEffect().SetSize(0.03).SetMetric(abtesting.EffectMetric(\"conversionRate\")))).SetVariants(\n []abtesting.AddABTestsVariant{*abtesting.AbTestsVariantAsAddABTestsVariant(\n abtesting.NewEmptyAbTestsVariant().SetIndex(\"AB_TEST_1\").SetTrafficPercentage(50)), *abtesting.AbTestsVariantAsAddABTestsVariant(\n abtesting.NewEmptyAbTestsVariant().SetIndex(\"AB_TEST_2\").SetTrafficPercentage(50))})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}\n\n\n// print the response\nprint(response)"},{"lang":"java","label":"Java","source":"// Initialize the client\nAbtestingClient client = new AbtestingClient(\"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", \"ALGOLIA_APPLICATION_REGION\");\n\n// Call the API\nEstimateABTestResponse response = client.estimateABTest(\n new EstimateABTestRequest()\n .setConfiguration(\n new EstimateConfiguration()\n .setEmptySearch(new EmptySearch().setExclude(true))\n .setMinimumDetectableEffect(new MinimumDetectableEffect().setSize(0.03).setMetric(EffectMetric.CONVERSION_RATE))\n )\n .setVariants(\n Arrays.asList(\n new AbTestsVariant().setIndex(\"AB_TEST_1\").setTrafficPercentage(50),\n new AbTestsVariant().setIndex(\"AB_TEST_2\").setTrafficPercentage(50)\n )\n )\n);\n\n// print the response\nSystem.out.println(response);"},{"lang":"javascript","label":"JavaScript","source":"// Initialize the client\n// Replace 'us' with your Algolia Application Region\nconst client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initAbtesting({ region: 'us' });\n\n// Call the API\nconst response = await client.estimateABTest({\n configuration: {\n emptySearch: { exclude: true },\n minimumDetectableEffect: { size: 0.03, metric: 'conversionRate' },\n },\n variants: [\n { index: 'AB_TEST_1', trafficPercentage: 50 },\n { index: 'AB_TEST_2', trafficPercentage: 50 },\n ],\n});\n\n\n// print the response\nconsole.log(response);"},{"lang":"kotlin","label":"Kotlin","source":"// Initialize the client\nval client =\n AbtestingClient(\n appId = \"ALGOLIA_APPLICATION_ID\",\n apiKey = \"ALGOLIA_API_KEY\",\n region = \"ALGOLIA_APPLICATION_REGION\",\n )\n\n// Call the API\nvar response =\n client.estimateABTest(\n estimateABTestRequest =\n EstimateABTestRequest(\n configuration =\n EstimateConfiguration(\n emptySearch = EmptySearch(exclude = true),\n minimumDetectableEffect =\n MinimumDetectableEffect(\n size = 0.03,\n metric = EffectMetric.entries.first { it.value == \"conversionRate\" },\n ),\n ),\n variants =\n listOf(\n AbTestsVariant(index = \"AB_TEST_1\", trafficPercentage = 50),\n AbTestsVariant(index = \"AB_TEST_2\", trafficPercentage = 50),\n ),\n )\n )\n\n\n// print the response\nprintln(response)"},{"lang":"php","label":"PHP","source":"// Initialize the client\n$client = AbtestingClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');\n\n// Call the API\n$response = $client->estimateABTest(\n ['configuration' => ['emptySearch' => ['exclude' => true,\n ],\n 'minimumDetectableEffect' => ['size' => 0.03,\n 'metric' => 'conversionRate',\n ],\n ],\n 'variants' => [\n ['index' => 'AB_TEST_1',\n 'trafficPercentage' => 50,\n ],\n\n ['index' => 'AB_TEST_2',\n 'trafficPercentage' => 50,\n ],\n ],\n ],\n);\n\n\n// print the response\nvar_dump($response);"},{"lang":"python","label":"Python","source":"# Initialize the client\n# In an asynchronous context, you can use AbtestingClient instead, which exposes the exact same methods.\nclient = AbtestingClientSync(\n \"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", \"ALGOLIA_APPLICATION_REGION\"\n)\n\n# Call the API\nresponse = client.estimate_ab_test(\n estimate_ab_test_request={\n \"configuration\": {\n \"emptySearch\": {\n \"exclude\": True,\n },\n \"minimumDetectableEffect\": {\n \"size\": 0.03,\n \"metric\": \"conversionRate\",\n },\n },\n \"variants\": [\n {\n \"index\": \"AB_TEST_1\",\n \"trafficPercentage\": 50,\n },\n {\n \"index\": \"AB_TEST_2\",\n \"trafficPercentage\": 50,\n },\n ],\n },\n)\n\n\n# print the response\nprint(response)"},{"lang":"ruby","label":"Ruby","source":"# Initialize the client\nclient = Algolia::AbtestingClient.create(\"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", \"ALGOLIA_APPLICATION_REGION\")\n\n# Call the API\nresponse = client.estimate_ab_test(\n Algolia::Abtesting::EstimateABTestRequest.new(\n configuration: Algolia::Abtesting::EstimateConfiguration.new(\n empty_search: Algolia::Abtesting::EmptySearch.new(exclude: true),\n minimum_detectable_effect: Algolia::Abtesting::MinimumDetectableEffect.new(size: 0.03, metric: \"conversionRate\")\n ),\n variants: [\n Algolia::Abtesting::AbTestsVariant.new(index: \"AB_TEST_1\", traffic_percentage: 50),\n Algolia::Abtesting::AbTestsVariant.new(index: \"AB_TEST_2\", traffic_percentage: 50)\n ]\n )\n)\n\n\n# print the response\nputs(response)"},{"lang":"scala","label":"Scala","source":"// Initialize the client\nval client = AbtestingClient(\n appId = \"ALGOLIA_APPLICATION_ID\",\n apiKey = \"ALGOLIA_API_KEY\",\n region = Option(\"ALGOLIA_APPLICATION_REGION\")\n)\n\n// Call the API\nval response = Await.result(\n client.estimateABTest(\n estimateABTestRequest = EstimateABTestRequest(\n configuration = EstimateConfiguration(\n emptySearch = Some(\n EmptySearch(\n exclude = Some(true)\n )\n ),\n minimumDetectableEffect = MinimumDetectableEffect(\n size = 0.03,\n metric = EffectMetric.withName(\"conversionRate\")\n )\n ),\n variants = Seq(\n AbTestsVariant(\n index = \"AB_TEST_1\",\n trafficPercentage = 50\n ),\n AbTestsVariant(\n index = \"AB_TEST_2\",\n trafficPercentage = 50\n )\n )\n )\n ),\n Duration(100, \"sec\")\n)\n\n// print the response\nprintln(response)"},{"lang":"swift","label":"Swift","source":"// Initialize the client\nlet client = try AbtestingClient(appID: \"ALGOLIA_APPLICATION_ID\", apiKey: \"ALGOLIA_API_KEY\", region: .us)\n\n// Call the API\nlet response = try await client.estimateABTest(estimateABTestRequest: AbtestingEstimateABTestRequest(\n configuration: AbtestingEstimateConfiguration(\n emptySearch: EmptySearch(exclude: true),\n minimumDetectableEffect: AbtestingMinimumDetectableEffect(\n size: 0.03,\n metric: AbtestingEffectMetric.conversionRate\n )\n ),\n variants: [\n AbtestingAddABTestsVariant.abtestingAbTestsVariant(AbtestingAbTestsVariant(\n index: \"AB_TEST_1\",\n trafficPercentage: 50\n )),\n AbtestingAddABTestsVariant.abtestingAbTestsVariant(AbtestingAbTestsVariant(\n index: \"AB_TEST_2\",\n trafficPercentage: 50\n )),\n ]\n))\n\n// print the response\nprint(response)"},{"lang":"cURL","label":"curl","source":"curl --request POST \\\n --url https://analytics.us.algolia.com/2/abtests/estimate \\\n --header 'accept: application/json' \\\n --header 'content-type: application/json' \\\n --header 'x-algolia-api-key: ALGOLIA_API_KEY' \\\n --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \\\n --data '\n{\n \"configuration\": {\n \"featureFilters\": {\n \"dynamicReRanking\": true,\n \"aiPerso\": true,\n \"multiSignalRanking\": true\n },\n \"outliers\": {\n \"exclude\": true\n },\n \"emptySearch\": {\n \"exclude\": true\n },\n \"minimumDetectableEffect\": {\n \"size\": 0,\n \"metric\": \"addToCartRate\"\n }\n },\n \"variants\": [\n {\n \"index\": \"delcourt_production\",\n \"trafficPercentage\": 60,\n \"description\": \"Current production index\"\n },\n {\n \"index\": \"delcourt_production\",\n \"trafficPercentage\": 60,\n \"description\": \"Current production index\"\n }\n ]\n}\n'"}],"method":"post","type":"path","servers":["8336822e-1c83-4d94-9622-2332792b5009","6483a23a-9c9f-4348-be61-ad15b11fc72e"],"security":["fa9abb25-248a-41dd-bcf8-5f5f9f2643f1"],"path":"/2/abtests/estimate","baseUrlOptions":["https://analytics.{region}.algolia.com","https://analytics.algolia.com"],"title":"Estimate the sample size and duration of an A/B test","codeSamples":[{"label":"C#","lang":"csharp","source":"// Initialize the client\nvar client = new AbtestingClient(\n new AbtestingConfig(\"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", \"ALGOLIA_APPLICATION_REGION\")\n);\n\n// Call the API\nvar response = await client.EstimateABTestAsync(\n new EstimateABTestRequest\n {\n Configuration = new EstimateConfiguration\n {\n EmptySearch = new EmptySearch { Exclude = true },\n MinimumDetectableEffect = new MinimumDetectableEffect\n {\n Size = 0.03,\n Metric = Enum.Parse\u003cEffectMetric>(\"ConversionRate\"),\n },\n },\n Variants = new List\u003cAddABTestsVariant>\n {\n new AddABTestsVariant(new AbTestsVariant { Index = \"AB_TEST_1\", TrafficPercentage = 50 }),\n new AddABTestsVariant(new AbTestsVariant { Index = \"AB_TEST_2\", TrafficPercentage = 50 }),\n },\n }\n);\n\n// print the response\nConsole.WriteLine(response);"},{"label":"Go","lang":"go","source":"// Initialize the client with your application region, eg. abtesting.ALGOLIA_APPLICATION_REGION\nclient, err := abtesting.NewClient(\"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", abtesting.US)\nif err != nil {\n // The client can fail to initialize if you pass an invalid parameter.\n panic(err)\n}\n\n// Call the API\nresponse, err := client.EstimateABTest(client.NewApiEstimateABTestRequest(\n\n abtesting.NewEmptyEstimateABTestRequest().SetConfiguration(\n abtesting.NewEmptyEstimateConfiguration().SetEmptySearch(\n abtesting.NewEmptyEmptySearch().SetExclude(true)).SetMinimumDetectableEffect(\n abtesting.NewEmptyMinimumDetectableEffect().SetSize(0.03).SetMetric(abtesting.EffectMetric(\"conversionRate\")))).SetVariants(\n []abtesting.AddABTestsVariant{*abtesting.AbTestsVariantAsAddABTestsVariant(\n abtesting.NewEmptyAbTestsVariant().SetIndex(\"AB_TEST_1\").SetTrafficPercentage(50)), *abtesting.AbTestsVariantAsAddABTestsVariant(\n abtesting.NewEmptyAbTestsVariant().SetIndex(\"AB_TEST_2\").SetTrafficPercentage(50))})))\nif err != nil {\n // handle the eventual error\n panic(err)\n}\n\n\n// print the response\nprint(response)"},{"label":"Java","lang":"java","source":"// Initialize the client\nAbtestingClient client = new AbtestingClient(\"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", \"ALGOLIA_APPLICATION_REGION\");\n\n// Call the API\nEstimateABTestResponse response = client.estimateABTest(\n new EstimateABTestRequest()\n .setConfiguration(\n new EstimateConfiguration()\n .setEmptySearch(new EmptySearch().setExclude(true))\n .setMinimumDetectableEffect(new MinimumDetectableEffect().setSize(0.03).setMetric(EffectMetric.CONVERSION_RATE))\n )\n .setVariants(\n Arrays.asList(\n new AbTestsVariant().setIndex(\"AB_TEST_1\").setTrafficPercentage(50),\n new AbTestsVariant().setIndex(\"AB_TEST_2\").setTrafficPercentage(50)\n )\n )\n);\n\n// print the response\nSystem.out.println(response);"},{"label":"JavaScript","lang":"javascript","source":"// Initialize the client\n// Replace 'us' with your Algolia Application Region\nconst client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initAbtesting({ region: 'us' });\n\n// Call the API\nconst response = await client.estimateABTest({\n configuration: {\n emptySearch: { exclude: true },\n minimumDetectableEffect: { size: 0.03, metric: 'conversionRate' },\n },\n variants: [\n { index: 'AB_TEST_1', trafficPercentage: 50 },\n { index: 'AB_TEST_2', trafficPercentage: 50 },\n ],\n});\n\n\n// print the response\nconsole.log(response);"},{"label":"Kotlin","lang":"kotlin","source":"// Initialize the client\nval client =\n AbtestingClient(\n appId = \"ALGOLIA_APPLICATION_ID\",\n apiKey = \"ALGOLIA_API_KEY\",\n region = \"ALGOLIA_APPLICATION_REGION\",\n )\n\n// Call the API\nvar response =\n client.estimateABTest(\n estimateABTestRequest =\n EstimateABTestRequest(\n configuration =\n EstimateConfiguration(\n emptySearch = EmptySearch(exclude = true),\n minimumDetectableEffect =\n MinimumDetectableEffect(\n size = 0.03,\n metric = EffectMetric.entries.first { it.value == \"conversionRate\" },\n ),\n ),\n variants =\n listOf(\n AbTestsVariant(index = \"AB_TEST_1\", trafficPercentage = 50),\n AbTestsVariant(index = \"AB_TEST_2\", trafficPercentage = 50),\n ),\n )\n )\n\n\n// print the response\nprintln(response)"},{"label":"PHP","lang":"php","source":"// Initialize the client\n$client = AbtestingClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');\n\n// Call the API\n$response = $client->estimateABTest(\n ['configuration' => ['emptySearch' => ['exclude' => true,\n ],\n 'minimumDetectableEffect' => ['size' => 0.03,\n 'metric' => 'conversionRate',\n ],\n ],\n 'variants' => [\n ['index' => 'AB_TEST_1',\n 'trafficPercentage' => 50,\n ],\n\n ['index' => 'AB_TEST_2',\n 'trafficPercentage' => 50,\n ],\n ],\n ],\n);\n\n\n// print the response\nvar_dump($response);"},{"label":"Python","lang":"python","source":"# Initialize the client\n# In an asynchronous context, you can use AbtestingClient instead, which exposes the exact same methods.\nclient = AbtestingClientSync(\n \"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", \"ALGOLIA_APPLICATION_REGION\"\n)\n\n# Call the API\nresponse = client.estimate_ab_test(\n estimate_ab_test_request={\n \"configuration\": {\n \"emptySearch\": {\n \"exclude\": True,\n },\n \"minimumDetectableEffect\": {\n \"size\": 0.03,\n \"metric\": \"conversionRate\",\n },\n },\n \"variants\": [\n {\n \"index\": \"AB_TEST_1\",\n \"trafficPercentage\": 50,\n },\n {\n \"index\": \"AB_TEST_2\",\n \"trafficPercentage\": 50,\n },\n ],\n },\n)\n\n\n# print the response\nprint(response)"},{"label":"Ruby","lang":"ruby","source":"# Initialize the client\nclient = Algolia::AbtestingClient.create(\"ALGOLIA_APPLICATION_ID\", \"ALGOLIA_API_KEY\", \"ALGOLIA_APPLICATION_REGION\")\n\n# Call the API\nresponse = client.estimate_ab_test(\n Algolia::Abtesting::EstimateABTestRequest.new(\n configuration: Algolia::Abtesting::EstimateConfiguration.new(\n empty_search: Algolia::Abtesting::EmptySearch.new(exclude: true),\n minimum_detectable_effect: Algolia::Abtesting::MinimumDetectableEffect.new(size: 0.03, metric: \"conversionRate\")\n ),\n variants: [\n Algolia::Abtesting::AbTestsVariant.new(index: \"AB_TEST_1\", traffic_percentage: 50),\n Algolia::Abtesting::AbTestsVariant.new(index: \"AB_TEST_2\", traffic_percentage: 50)\n ]\n )\n)\n\n\n# print the response\nputs(response)"},{"label":"Scala","lang":"scala","source":"// Initialize the client\nval client = AbtestingClient(\n appId = \"ALGOLIA_APPLICATION_ID\",\n apiKey = \"ALGOLIA_API_KEY\",\n region = Option(\"ALGOLIA_APPLICATION_REGION\")\n)\n\n// Call the API\nval response = Await.result(\n client.estimateABTest(\n estimateABTestRequest = EstimateABTestRequest(\n configuration = EstimateConfiguration(\n emptySearch = Some(\n EmptySearch(\n exclude = Some(true)\n )\n ),\n minimumDetectableEffect = MinimumDetectableEffect(\n size = 0.03,\n metric = EffectMetric.withName(\"conversionRate\")\n )\n ),\n variants = Seq(\n AbTestsVariant(\n index = \"AB_TEST_1\",\n trafficPercentage = 50\n ),\n AbTestsVariant(\n index = \"AB_TEST_2\",\n trafficPercentage = 50\n )\n )\n )\n ),\n Duration(100, \"sec\")\n)\n\n// print the response\nprintln(response)"},{"label":"Swift","lang":"swift","source":"// Initialize the client\nlet client = try AbtestingClient(appID: \"ALGOLIA_APPLICATION_ID\", apiKey: \"ALGOLIA_API_KEY\", region: .us)\n\n// Call the API\nlet response = try await client.estimateABTest(estimateABTestRequest: AbtestingEstimateABTestRequest(\n configuration: AbtestingEstimateConfiguration(\n emptySearch: EmptySearch(exclude: true),\n minimumDetectableEffect: AbtestingMinimumDetectableEffect(\n size: 0.03,\n metric: AbtestingEffectMetric.conversionRate\n )\n ),\n variants: [\n AbtestingAddABTestsVariant.abtestingAbTestsVariant(AbtestingAbTestsVariant(\n index: \"AB_TEST_1\",\n trafficPercentage: 50\n )),\n AbtestingAddABTestsVariant.abtestingAbTestsVariant(AbtestingAbTestsVariant(\n index: \"AB_TEST_2\",\n trafficPercentage: 50\n )),\n ]\n))\n\n// print the response\nprint(response)"},{"label":"curl","lang":"cURL","source":"curl --request POST \\\n --url https://analytics.us.algolia.com/2/abtests/estimate \\\n --header 'accept: application/json' \\\n --header 'content-type: application/json' \\\n --header 'x-algolia-api-key: ALGOLIA_API_KEY' \\\n --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \\\n --data '\n{\n \"configuration\": {\n \"featureFilters\": {\n \"dynamicReRanking\": true,\n \"aiPerso\": true,\n \"multiSignalRanking\": true\n },\n \"outliers\": {\n \"exclude\": true\n },\n \"emptySearch\": {\n \"exclude\": true\n },\n \"minimumDetectableEffect\": {\n \"size\": 0,\n \"metric\": \"addToCartRate\"\n }\n },\n \"variants\": [\n {\n \"index\": \"delcourt_production\",\n \"trafficPercentage\": 60,\n \"description\": \"Current production index\"\n },\n {\n \"index\": \"delcourt_production\",\n \"trafficPercentage\": 60,\n \"description\": \"Current production index\"\n }\n ]\n}\n'"}],"requestExampleLanguages":["bash","csharp","dart","go","java","javascript","kotlin","php","python","ruby","scala","swift"],"requiredOnlyExamples":false,"disableCodeSampleGeneration":true,"requestExampleType":"codeSamples","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"title":"estimateABTestRequest","type":"object","additionalProperties":false,"properties":{"configuration":{"title":"estimateConfiguration","type":"object","description":"A/B test configuration for estimating the sample size and duration using minimum detectable effect.","properties":{"minimumDetectableEffect":{"type":"object","description":"Configuration for the smallest difference between test variants you want to detect.","properties":{"metric":{"type":"string","description":"Metric for which you want to detect the smallest relative difference.","enum":["addToCartRate","clickThroughRate","conversionRate","purchaseRate"],"isRequired":true,"uniqueKey":"configuration.minimumDetectableEffect.metric","typeLabel":"enum\u003cstring>"},"size":{"type":"number","format":"double","minimum":0,"maximum":1,"description":"Smallest difference in an observable metric between variants.\nFor example, to detect a 10% difference between variants, set this value to 0.1.\n","isRequired":true,"uniqueKey":"configuration.minimumDetectableEffect.size","typeLabel":"number\u003cdouble>"}},"required":["size","metric"],"isRequired":true,"uniqueKey":"configuration.minimumDetectableEffect","typeLabel":"object"},"emptySearch":{"type":"object","description":"Configuration for handling empty searches.","properties":{"exclude":{"type":"boolean","description":"Whether to exclude empty searches when calculating A/B test results.","uniqueKey":"configuration.emptySearch.exclude","typeLabel":"boolean"}},"uniqueKey":"configuration.emptySearch","typeLabel":"object"},"featureFilters":{"type":"object","description":"Configuration of feature-based filters applied to the A/B test population.","properties":{"aiPerso":{"type":"boolean","description":"Whether to apply AI Personalization feature filters.","uniqueKey":"configuration.featureFilters.aiPerso","typeLabel":"boolean"},"dynamicReRanking":{"type":"boolean","description":"Whether to apply Dynamic Re-Ranking feature filters.","uniqueKey":"configuration.featureFilters.dynamicReRanking","typeLabel":"boolean"},"multiSignalRanking":{"type":"boolean","description":"Whether to apply Multi-Signal Re-Ranking feature filters.","uniqueKey":"configuration.featureFilters.multiSignalRanking","typeLabel":"boolean"}},"uniqueKey":"configuration.featureFilters","typeLabel":"object"},"outliers":{"type":"object","description":"Configuration for handling outliers.","properties":{"exclude":{"type":"boolean","description":"Whether to exclude outliers when calculating A/B test results.","default":true,"uniqueKey":"configuration.outliers.exclude","typeLabel":"boolean"}},"uniqueKey":"configuration.outliers","typeLabel":"object"}},"required":["minimumDetectableEffect"],"isRequired":true,"uniqueKey":"configuration","typeLabel":"estimateConfiguration · object"},"variants":{"type":"array","description":"A/B test variants.","minItems":2,"maxItems":2,"items":{"oneOf":[{"type":"object","title":"Variant","required":["index","trafficPercentage"],"properties":{"index":{"type":"string","description":"Index name of the A/B test variant (case-sensitive).","example":"delcourt_production","isRequired":true,"uniqueKey":"variants.items.[INDEX].oneOf.0.index","typeLabel":"string"},"trafficPercentage":{"type":"integer","description":"Percentage of search requests each variant receives.","minimum":0,"maximum":100,"example":60,"isRequired":true,"uniqueKey":"variants.items.[INDEX].oneOf.0.trafficPercentage","typeLabel":"integer"},"description":{"type":"string","description":"Description for this variant.","example":"Current production index","uniqueKey":"variants.items.[INDEX].oneOf.0.description","typeLabel":"string"}},"additionalProperties":false,"uniqueKey":"variants.items.[INDEX].oneOf.0","typeLabel":"Variant · object"},{"type":"object","title":"Variant with search parameters","description":"Search parameters to add to the test variant.\nOnly use this parameter if the two variants use the same index.\n","required":["customSearchParameters","index","trafficPercentage"],"x-discriminator-fields":["customSearchParameters"],"properties":{"index":{"type":"string","description":"Index name of the A/B test variant (case-sensitive).","example":"delcourt_production","isRequired":true,"uniqueKey":"variants.items.[INDEX].oneOf.1.index","typeLabel":"string"},"trafficPercentage":{"type":"integer","description":"Percentage of search requests each variant receives.","minimum":0,"maximum":100,"example":60,"isRequired":true,"uniqueKey":"variants.items.[INDEX].oneOf.1.trafficPercentage","typeLabel":"integer"},"customSearchParameters":{"type":"object","isRequired":true,"uniqueKey":"variants.items.[INDEX].oneOf.1.customSearchParameters","typeLabel":"object"},"description":{"type":"string","description":"Description for this variant.","example":"Current production index","uniqueKey":"variants.items.[INDEX].oneOf.1.description","typeLabel":"string"}},"additionalProperties":false,"uniqueKey":"variants.items.[INDEX].oneOf.1","typeLabel":"Variant with search parameters · object"}],"uniqueKey":"variants.items.[INDEX]","typeLabel":"Variant · object | Variant with search parameters · object"},"isRequired":true,"uniqueKey":"variants","typeLabel":"(Variant · object | Variant with search parameters · object)[]"}},"required":["configuration","variants"],"uniqueKey":"","typeLabel":"estimateABTestRequest · object"},"examples":{"Example":{"title":"Example","value":{"configuration":{"minimumDetectableEffect":{"size":0.5},"emptySearch":{"exclude":true},"featureFilters":{"aiPerso":true,"dynamicReRanking":true,"multiSignalRanking":true},"outliers":{"exclude":true}},"variants":[{"index":"delcourt_production","trafficPercentage":60,"description":"Current production index"}]}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"0df20bac-6ab6-4936-bf27-c6c18bd3b3a0":{"description":"OK","headers":{"x-ratelimit-limit":{"description":"Number of allowed requests per one minute.","example":100,"schema":{"type":"integer"}},"x-ratelimit-remaining":{"description":"Number of remaining requests in the current period.","example":99,"schema":{"type":"integer"}},"x-ratelimit-reset":{"description":"Timestamp when the rate limit will reset, measured in seconds since the Unix epoch.","example":1710682486,"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"durationDays":{"type":"integer","format":"int64","description":"Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.","example":21,"uniqueKey":"durationDays","typeLabel":"integer\u003cint64>"},"sampleSizes":{"type":"array","description":"Sample size estimates for each variant. The first element is the control variant.\nEach element is the estimated number of searches required to achieve the desired statistical significance.\n","items":{"type":"integer","format":"int64","description":"Number of tracked searches needed to be able to detect the configured effect for the control variant.","example":23415,"uniqueKey":"sampleSizes.items.[INDEX]","typeLabel":"integer\u003cint64>"},"uniqueKey":"sampleSizes","typeLabel":"integer\u003cint64>[]"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"durationDays":21,"sampleSizes":[23415]}}},"exampleType":"generated"}},"exampleType":"generated"},"6930b562-3265-4214-ad2f-274eced32fdb":{"description":"Bad request or request arguments.","content":{"application/json":{"schema":{"description":"Error.","type":"object","x-keep-model":true,"additionalProperties":true,"properties":{"message":{"type":"string","example":"Invalid Application-Id or API-Key","uniqueKey":"message","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"message":"Invalid Application-Id or API-Key"}}},"exampleType":"generated"}},"exampleType":"generated"},"222d9d8e-55e0-4b20-b6c3-51e12907ba05":{"description":"This feature is not enabled on your Algolia account.","content":{"application/json":{"schema":{"description":"Error.","type":"object","x-keep-model":true,"additionalProperties":true,"properties":{"message":{"type":"string","example":"Invalid Application-Id or API-Key","uniqueKey":"message","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"message":"Invalid Application-Id or API-Key"}}},"exampleType":"generated"}},"exampleType":"generated"},"7cc0a579-4c51-4c5c-800e-aac4ed9d7845":{"description":"Method not allowed with this API key.","content":{"application/json":{"schema":{"description":"Error.","type":"object","x-keep-model":true,"additionalProperties":true,"properties":{"message":{"type":"string","example":"Invalid Application-Id or API-Key","uniqueKey":"message","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"message":"Invalid Application-Id or API-Key"}}},"exampleType":"generated"}},"exampleType":"generated"},"b3440687-90cd-44c9-a0ad-decd4409ad9d":{"description":"Index not found.","content":{"application/json":{"schema":{"description":"Error.","type":"object","x-keep-model":true,"additionalProperties":true,"properties":{"message":{"type":"string","example":"Invalid Application-Id or API-Key","uniqueKey":"message","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"message":"Invalid Application-Id or API-Key"}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"fa9abb25-248a-41dd-bcf8-5f5f9f2643f1":{"appId":{"type":"apiKey","in":"header","name":"x-algolia-application-id","description":"Your Algolia application ID.","scopes":[]},"apiKey":{"type":"apiKey","in":"header","name":"x-algolia-api-key","description":"Your Algolia API key with the necessary permissions to make the request.\nPermissions are controlled through access control lists (ACL) and access restrictions.\nThe required ACL to make a request is listed in each endpoint's reference.\n","scopes":[]}}},"servers":{"8336822e-1c83-4d94-9622-2332792b5009":{"url":"https://analytics.{region}.algolia.com","variables":{"region":{"description":"The region where your Algolia application is hosted.","enum":["us","de"],"default":"us"}}},"6483a23a-9c9f-4348-be61-ad15b11fc72e":{"url":"https://analytics.algolia.com"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-algolia-application-id","description":"Your Algolia application ID.","scopes":[]},"schema":{"title":"x-algolia-application-id","type":"string","description":"Your Algolia application ID.","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"appId","name":"x-algolia-application-id"},{"scheme":{"type":"apiKey","in":"header","name":"x-algolia-api-key","description":"Your Algolia API key with the necessary permissions to make the request.\nPermissions are controlled through access control lists (ACL) and access restrictions.\nThe required ACL to make a request is listed in each endpoint's reference.\n","scopes":[]},"schema":{"title":"x-algolia-api-key","type":"string","description":"Your Algolia API key with the necessary permissions to make the request.\nPermissions are controlled through access control lists (ACL) and access restrictions.\nThe required ACL to make a request is listed in each endpoint's reference.\n","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"apiKey","name":"x-algolia-api-key"}],"title":"appId \u0026 apiKey"}]},"originalFileLocation":"specs/abtesting.yml"},"subdomain":"algolia","siteName":"Algolia","title":"Estimate the sample size and duration of an A/B test - Algolia","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-09T15:56:15.737Z","gitLastModified":"2026-09-09T15:53:19.000Z","originalFileLocation":"doc/rest-api/abtesting/estimate-ab-test.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"This endpoint is deprecated. Use the A/B Testing API v3 instead.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Algolia\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Estimate the sample size and duration of an A/B test - Algolia\">\u003cmeta data-mint-head property=\"og:description\" content=\"This endpoint is deprecated. Use the A/B Testing API v3 instead.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Algolia\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://algolia.mintlify.site/_mintlify/api/og/v2?division=A%2FB+testing+API+v2+%28deprecated%29\u0026amp;title=Estimate+the+sample+size+and+duration+of+an+A%2FB+test\u0026amp;description=This+endpoint+is+deprecated.+Use+the+A%2FB+Testing+API+v3+instead.\u0026amp;theme=174d56e14f330de525287b70\u0026amp;signature=33ff5d1100b5e5f1cc00ffdc8739ef28ee66bcd9e6c4197486c043c65295ca07\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Estimate the sample size and duration of an A/B test - Algolia\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"This endpoint is deprecated. Use the A/B Testing API v3 instead.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://algolia.mintlify.site/_mintlify/api/og/v2?division=A%2FB+testing+API+v2+%28deprecated%29\u0026amp;title=Estimate+the+sample+size+and+duration+of+an+A%2FB+test\u0026amp;description=This+endpoint+is+deprecated.+Use+the+A%2FB+Testing+API+v3+instead.\u0026amp;theme=174d56e14f330de525287b70\u0026amp;signature=33ff5d1100b5e5f1cc00ffdc8739ef28ee66bcd9e6c4197486c043c65295ca07\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/algolia/pODf0GWwkpqTo2Wx/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Algolia\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#3970ff\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/doc/rest-api/abtesting/estimate-ab-test.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.algolia.com/#organization\",\"name\":\"Algolia\",\"url\":\"https://www.algolia.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/algolia/kiecJp3hu-WXhj-3/logo/light.svg?fit=max\u0026auto=format\u0026n=kiecJp3hu-WXhj-3\u0026q=85\u0026s=bf613e260ca94c0eb23384e6c0d5c77f\"},\"sameAs\":[\"https://www.linkedin.com/company/algolia/\",\"https://github.com/algolia\",\"https://x.com/algolia\",\"https://www.youtube.com/channel/UCTNkiq-SO8hay1PRx-it9Cw\"]},{\"@type\":\"WebSite\",\"@id\":\"https://www.algolia.com#website\",\"name\":\"Algolia\",\"url\":\"https://www.algolia.com\",\"publisher\":{\"@id\":\"https://www.algolia.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test#webpage\",\"url\":\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test\",\"name\":\"Estimate the sample size and duration of an A/B test\",\"description\":\"This endpoint is deprecated. Use the A/B Testing API v3 instead.\",\"dateModified\":\"2026-09-09T15:53:19.000Z\",\"isPartOf\":{\"@id\":\"https://www.algolia.com#website\"},\"breadcrumb\":{\"@id\":\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"A/B testing API v2 (deprecated)\",\"item\":\"https://www.algolia.com/doc/rest-api/abtesting\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Estimate the sample size and duration of an A/B test\",\"item\":\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test#apireference\",\"headline\":\"Estimate the sample size and duration of an A/B test\",\"name\":\"Estimate the sample size and duration of an A/B test\",\"description\":\"This endpoint is deprecated. Use the A/B Testing API v3 instead.\",\"url\":\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test\",\"mainEntityOfPage\":{\"@id\":\"https://www.algolia.com/doc/rest-api/abtesting/estimate-ab-test#webpage\"},\"dateModified\":\"2026-09-09T15:53:19.000Z\",\"publisher\":{\"@id\":\"https://www.algolia.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.algolia.com#website\"}}]}\u003c/script>","siteName":"Algolia","nav":{"global":null,"tabs":[{"tab":"Guides","icon":"book-text","pages":[{"title":"Guides","href":"/doc/guides/get-started"}]},{"tab":"Libraries and tools","icon":"wrench","menu":[{"item":"API clients","versions":[{"version":"current","groups":[{"group":"current","pages":[{"title":"current","href":"/doc/libraries/sdk"}]}]},{"version":"legacy","groups":[{"group":"legacy","pages":[{"title":"legacy","href":"/doc/libraries/sdk/v1/install"}]}]}]},{"item":"Algolia CLI","pages":[{"title":"Algolia CLI","href":"/doc/tools/cli/get-started"}]},{"item":"Algolia Wizard","pages":[{"title":"Algolia Wizard","href":"/doc/tools/algolia-wizard"}]},{"item":"Crawler","pages":[{"title":"Crawler","href":"/doc/tools/crawler/getting-started/overview"}]},{"item":"Django","pages":[{"title":"Django","href":"/doc/framework-integration/django/setup"}]},{"item":"Laravel","pages":[{"title":"Laravel","href":"/doc/framework-integration/laravel/getting-started/introduction-to-scout-extended"}]},{"item":"Ruby on Rails","pages":[{"title":"Ruby on Rails","href":"/doc/framework-integration/rails/getting-started/setup"}]},{"item":"Symfony","pages":[{"title":"Symfony","href":"/doc/framework-integration/symfony/getting-started/algolia-searchbundle"}]},{"item":"All libraries and tools","pages":[{"title":"All libraries and tools","href":"/doc/libraries"}]}],"pages":[{"title":"Libraries and tools","href":"/doc/libraries/sdk"}]},{"tab":"UI libraries","icon":"proportions","menu":[{"item":"InstantSearch.js","pages":[{"title":"InstantSearch.js","href":"/doc/api-reference/widgets/js"}]},{"item":"React InstantSearch","pages":[{"title":"React InstantSearch","href":"/doc/api-reference/widgets/react"}]},{"item":"Vue InstantSearch","pages":[{"title":"Vue InstantSearch","href":"/doc/api-reference/widgets/vue"}]},{"item":"InstantSearch iOS","pages":[{"title":"InstantSearch iOS","href":"/doc/api-reference/widgets/ios"}]},{"item":"InstantSearch Android","pages":[{"title":"InstantSearch Android","href":"/doc/api-reference/widgets/android"}]},{"item":"Algolia for Flutter","pages":[{"title":"Algolia for Flutter","href":"/doc/api-reference/widgets/flutter"}]},{"item":"Autocomplete","pages":[{"title":"Autocomplete","href":"/doc/ui-libraries/autocomplete/introduction/what-is-autocomplete"}]},{"item":"All UI libraries","pages":[{"title":"All UI libraries","href":"/doc/ui-libraries"}]}],"pages":[{"title":"UI libraries","href":"/doc/api-reference/widgets/js"}]},{"tab":"Integrations","icon":"plug","menu":[{"item":"Adobe Commerce/Magento","pages":[{"title":"Adobe Commerce/Magento","href":"/doc/integration/magento-2/getting-started/quick-start"}]},{"item":"BigCommerce","pages":[{"title":"BigCommerce","href":"/doc/integration/bigcommerce/get-started/installation"}]},{"item":"commercetools","pages":[{"title":"commercetools","href":"/doc/integration/commercetools/get-started/installation"}]},{"item":"Make","pages":[{"title":"Make","href":"/doc/integration/make"}]},{"item":"n8n","pages":[{"title":"n8n","href":"/doc/integration/n8n"}]},{"item":"Salesforce B2C Commerce","pages":[{"title":"Salesforce B2C Commerce","href":"/doc/integration/salesforce-commerce-cloud-b2c/getting-started/introduction"}]},{"item":"Shopify","pages":[{"title":"Shopify","href":"/doc/integration/shopify/getting-started/quick-start"}]},{"item":"Stripe Projects","pages":[{"title":"Stripe Projects","href":"/doc/integration/stripe-projects"}]},{"item":"Zapier","pages":[{"title":"Zapier","href":"/doc/integration/zapier"}]},{"item":"Zendesk","pages":[{"title":"Zendesk","href":"/doc/integration/zendesk/get-started"}]},{"item":"Vercel","pages":[{"title":"Vercel","href":"/doc/integration/vercel"}]},{"item":"All integrations","pages":[{"title":"All integrations","href":"/doc/integration"}]}],"pages":[{"title":"Integrations","href":"/doc/integration/magento-2/getting-started/quick-start"}]},{"tab":"API reference","icon":"code","menu":[{"item":"Search","pages":[{"title":"Search","href":"/doc/rest-api/search"}]},{"item":"Agent Studio","pages":[{"title":"Agent Studio","href":"/doc/rest-api/agent-studio"}]},{"item":"A/B testing","groups":[{"group":"A/B testing API v3","icon":"code","pages":[{"title":"A/B Testing API","sidebarTitle":"Overview","href":"/doc/rest-api/abtesting-v3"},{"title":"List all A/B tests","openapi":"specs/abtesting-v3.yml get /3/abtests","href":"/doc/rest-api/abtesting-v3/list-ab-tests"},{"title":"Retrieve A/B test details","openapi":"specs/abtesting-v3.yml get /3/abtests/{id}","href":"/doc/rest-api/abtesting-v3/get-ab-test"},{"title":"Retrieve timeseries of an A/B test","openapi":"specs/abtesting-v3.yml get /3/abtests/{id}/timeseries","href":"/doc/rest-api/abtesting-v3/get-timeseries"},{"title":"Create an A/B test","openapi":"specs/abtesting-v3.yml post /3/abtests","href":"/doc/rest-api/abtesting-v3/add-ab-tests"},{"title":"Estimate the sample size and duration of an A/B test","openapi":"specs/abtesting-v3.yml post /3/abtests/estimate","href":"/doc/rest-api/abtesting-v3/estimate-ab-test"},{"title":"Stop an A/B test","openapi":"specs/abtesting-v3.yml post /3/abtests/{id}/stop","href":"/doc/rest-api/abtesting-v3/stop-ab-test"},{"title":"Delete an A/B test","openapi":"specs/abtesting-v3.yml delete /3/abtests/{id}","href":"/doc/rest-api/abtesting-v3/delete-ab-test"},{"title":"Retrieve captured A/B test settings","openapi":"specs/abtesting-v3.yml get /3/abtests/{id}/settings","href":"/doc/rest-api/abtesting-v3/get-ab-test-settings"},{"title":"Capture a variant's settings and stop the A/B test","openapi":"specs/abtesting-v3.yml post /3/abtests/{id}/settings/{variantId}","href":"/doc/rest-api/abtesting-v3/save-variant-settings"},{"title":"Apply a variant's captured settings to the control index","openapi":"specs/abtesting-v3.yml post /3/abtests/{id}/settings/{variantId}/apply","href":"/doc/rest-api/abtesting-v3/apply-variant-settings"}]},{"group":"A/B testing API v2 (deprecated)","icon":"code","pages":[{"title":"A/B Testing API","sidebarTitle":"Overview","href":"/doc/rest-api/abtesting"},{"title":"List all A/B tests","openapi":"specs/abtesting.yml get /2/abtests","href":"/doc/rest-api/abtesting/list-ab-tests"},{"title":"Retrieve A/B test details","openapi":"specs/abtesting.yml get /2/abtests/{id}","href":"/doc/rest-api/abtesting/get-ab-test"},{"title":"Create an A/B test","description":"This endpoint is deprecated. Use the A/B Testing API v3 instead.","openapi":"specs/abtesting.yml post /2/abtests","href":"/doc/rest-api/abtesting/add-ab-tests"},{"title":"Estimate the sample size and duration of an A/B test","openapi":"specs/abtesting.yml post /2/abtests/estimate","href":"/doc/rest-api/abtesting/estimate-ab-test"},{"title":"Stop an A/B test","description":"This endpoint is deprecated. Use the A/B Testing API v3 instead.","openapi":"specs/abtesting.yml post /2/abtests/{id}/stop","href":"/doc/rest-api/abtesting/stop-ab-test"},{"title":"Delete an A/B test","openapi":"specs/abtesting.yml delete /2/abtests/{id}","href":"/doc/rest-api/abtesting/delete-ab-test"}]}]},{"item":"Advanced Personalization","pages":[{"title":"Advanced Personalization","href":"/doc/rest-api/advanced-personalization"}]},{"item":"Analytics","pages":[{"title":"Analytics","href":"/doc/rest-api/analytics"}]},{"item":"Classic Personalization","pages":[{"title":"Classic Personalization","href":"/doc/rest-api/personalization"}]},{"item":"Composition","pages":[{"title":"Composition","href":"/doc/rest-api/composition"}]},{"item":"Crawler","pages":[{"title":"Crawler","href":"/doc/rest-api/crawler"}]},{"item":"Ingestion","pages":[{"title":"Ingestion","href":"/doc/rest-api/ingestion"}]},{"item":"Insights","pages":[{"title":"Insights","href":"/doc/rest-api/insights"}]},{"item":"Monitoring","pages":[{"title":"Monitoring","href":"/doc/rest-api/monitoring"}]},{"item":"Recommend","pages":[{"title":"Recommend","href":"/doc/rest-api/recommend"}]},{"item":"Query Suggestions","pages":[{"title":"Query Suggestions","href":"/doc/rest-api/query-suggestions"}]},{"item":"Usage","pages":[{"title":"Usage","href":"/doc/rest-api/usage"}]},{"item":"All APIs","pages":[{"title":"All APIs","href":"/doc/rest-api"}]}]}]},"basePath":"","title":"Estimate the sample size and duration of an A/B test - Algolia","buildId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","deploymentId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-i2a3QZ8E.js","utils-ChLwp8m0.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DRktVTDc.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-CA2pEs4T.js","snippetPresets-ClQ6XrKD.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-Ct_Lv36y.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-Cn2PYw9e.js","shallow-rkyymjXQ.js","getApiPlaygroundDisplay-BB9vkXtE.js","CodeSnippet-Bm5RU7m1.js","CodeSnippets-BgU9Deuz.js","Page-BUDYNlhG.js","getPastedJson-BD-6NNum.js","icon-8Z6tud2e.js","MethodPill-Tuzr4g3V.js","DuplicateIcon-0ceWFYhN.js","createIcon-FBXow_ST.js","DynamicMarkdown-CD8713Yy.js","SectionHeading-7zgzQbH-.js","axios-vUo_bRtp.js","Markdown-D7Ofw1oz.js","clsx-eKJ4rcii.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-CwjSCXIK.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-9EK5IAXV.js"]}