Skip to main content
POST
/
api
/
v1
/
ab-tests
Create A/B Test
curl --request POST \
  --url https://api.sequenzy.com/api/v1/ab-tests \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "campaignId": "<string>",
  "name": "<string>",
  "testPercentage": 123,
  "testDurationMinutes": 123,
  "winnerCriteria": "<string>",
  "variants": [
    {}
  ]
}
'
{
  "success": true,
  "abTest": {
    "id": "ab_abc123",
    "campaignId": "camp_abc123",
    "name": "A/B Test for April Launch",
    "status": "draft",
    "testPercentage": 20,
    "testDurationMinutes": 240,
    "winnerCriteria": "open_rate",
    "variants": [
      { "id": "var_a", "label": "A", "subject": "A quick update" },
      { "id": "var_b", "label": "B", "subject": "Alternative subject line" }
    ]
  }
}
Create a draft A/B test for a campaign in draft or rejected status. Variant A (the control) is copied from the campaign’s email, and you can provide extra variants up front. A campaign can have only one A/B test.

Request

campaignId
string
required
Campaign to attach the test to. Must be in draft or rejected status.
name
string
Test name. Defaults to A/B Test for <campaign name>.
testPercentage
number
Share of the audience that receives test sends. Must be from 5 to 50. Defaults to 20.
testDurationMinutes
number
How long the test phase runs before a winner is selected. Must be from 15 to 1440. Defaults to 240.
winnerCriteria
string
Metric used to pick the winner: open_rate or click_rate. Defaults to open_rate.
variants
array
Extra variants beyond the control. Each item takes subject (required), previewText, and blocks. Total variants cannot exceed 5. Variants without blocks reuse the campaign email body.
curl -X POST "https://api.sequenzy.com/api/v1/ab-tests" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": "camp_abc123",
    "testPercentage": 20,
    "winnerCriteria": "open_rate",
    "variants": [{ "subject": "Alternative subject line" }]
  }'

Responses

{
  "success": true,
  "abTest": {
    "id": "ab_abc123",
    "campaignId": "camp_abc123",
    "name": "A/B Test for April Launch",
    "status": "draft",
    "testPercentage": 20,
    "testDurationMinutes": 240,
    "winnerCriteria": "open_rate",
    "variants": [
      { "id": "var_a", "label": "A", "subject": "A quick update" },
      { "id": "var_b", "label": "B", "subject": "Alternative subject line" }
    ]
  }
}