# How to End A/B Tests via API

**URL:** <https://forum.mautic.org/t/how-to-end-a-b-tests-via-api/27516>\
**Category:** Product Support\
**Created:** [March 27, 2023, 2:34pm UTC](https://forum.mautic.org/t/how-to-end-a-b-tests-via-api/27516 "2023-03-27T14:34:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexhammer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexhammer/32/14525_2.png) [@alexhammer](https://forum.mautic.org/u/alexhammer)\
**Post date:** [March 27, 2023, 2:34pm UTC](https://forum.mautic.org/t/how-to-end-a-b-tests-via-api/27516/1 "2023-03-27T14:34:46Z")

</div>

Hello all,  
does somebody know how to end a split test via the api?  
I couldn’t find something in the documentation and it is not that obvious to me to only edit the email via patch. But I guess it is actually possible to end the Split testing and simply overwrite some data.

Who knows what? Would be a big help. I will make a video how to use that afterwards…

The general idea is to send an email to a specified number of leads picked randomly and perform a split test for 2 hours. Then pick the winner and send the email to the rest of the segment.

Cheers,  
Alex

---

<div class="post-metadata">

**Author:** ![alexhammer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexhammer/32/14525_2.png) [@alexhammer](https://forum.mautic.org/u/alexhammer)\
**Post date:** [April 4, 2023, 5:16pm UTC](https://forum.mautic.org/t/how-to-end-a-b-tests-via-api/27516/2 "2023-04-04T17:16:05Z")

</div>

anyone an idea?

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [April 5, 2023, 6:19am UTC](https://forum.mautic.org/t/how-to-end-a-b-tests-via-api/27516/3 "2023-04-05T06:19:15Z")

</div>

Hello Alex!  
Very useful topic.  
I just quickly looked at the reference, and saw A/B testing related info there:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/1/1323e30442da947d9835f550f98fc2819e9eee4f.png)

Have you looked into that? Are you asking the actual API calls, or if it’s possible at all?

Joey

---

<div class="post-metadata">

**Author:** ![alexhammer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexhammer/32/14525_2.png) [@alexhammer](https://forum.mautic.org/u/alexhammer)\
**Post date:** [April 20, 2023, 8:36am UTC](https://forum.mautic.org/t/how-to-end-a-b-tests-via-api/27516/4 "2023-04-20T08:36:51Z")

</div>

Hi Joey,  
late but solved. I made a really creepy Frankenstein 🙂

two hours after sending the email to my test-segment i send a webhook to n8n with the email\_id.  
With n8n I change the percentage for the variants and delivery directly in the variantSettings in the database.  
It works. Only pitty is: I need to start the campaign with two segments: One for the splittest and one which gets the mail after the test is “over”.

For now it is ok. Maybe I’ll give it another go.
