# Choose A/B Test Winner

POST /api/v2/projects/{projectId}/email-campaigns/{campaignId}/ab-test-winner

Chooses the version of an A/B test that is sent to the rest of the audience, in place of the automatic choice. The automatic choice is the version with the highest abTestConfig.winnerMetric; winnerReason says whether its lead was significant. Allowed once the test group has been sent (abTestConfig.status is AWAITING_WINNER, or ROLLED_OUT with no rollout email sent yet). During the wait, the chosen version is sent when the wait ends. Sets abTestConfig.winnerMessageId and winnerReason MANUAL.

## Request

- projectId: string, path, required — ID of the project that owns the campaign.
- campaignId: string, path, required — ID of the A/B test campaign.
- messageId: string, required — ID of the version to send to the rest of the audience, from messages[].id. null takes a choice back while abTestConfig.status is AWAITING_WINNER, so the automatic choice applies again.

## Response

- 200: Successful response
  - contactsFilterGroups: object[], required
    - filters: object[], required — Attribute conditions, combined with oneDayEventFilters by groupType.
    - groupType: AND | OR | NOT, required — How the conditions in filters and oneDayEventFilters combine: AND all true, OR any true, NOT none true.
    - oneDayEventFilters: object[] — Event conditions over a rolling 24 hour window (not configurable). Each one is a condition in the group alongside filters, so AND, OR, and NOT apply to both. Used the same way by CRM lists, campaign audiences, workflow entry filters, and Audience Filter steps.
    - requireSubscribed: boolean — When true, the group is ANDed with `$subscribed == true`. Set by email sending, not the filter UI.
    - requireUnvalidatedEmail: boolean — When true, the group is ANDed with `$emailValidated != true`. Set by email validation, not the filter UI. The user's AND, OR, and NOT are unchanged.
    - sunsetAfterSends: object — Sunset rules by mailbox provider. A contact at a listed provider who has been sent that many campaign emails since they last opened or clicked is excluded. Set by email sending, not the filter UI.
  - createdAt: string, required
  - id: string, required
  - messages: object[], required
    - bodyHTML: string, required
    - bodyJSON: object, required
    - createdAt: string, required
    - emailCampaignId: string, required
    - fromDomain: string, required
    - fromEmailUsername: string, required
    - fromName: string, required
    - id: string, required
    - label: string, required
    - previewTextHTML: str
…
