> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update A/B Test

> Update campaign or sequence A/B test settings

Update an A/B test's effective settings. Campaign and sequence tests use
different selection models:

* Campaign tests use `testPercentage`, `testDurationMinutes`, and
  `winnerCriteria`.
* Sequence tests use `testType`, `winnerThreshold`, and `winnerCriteria`.

Sequence settings that affect an active test or a test with recorded activity
require `confirmLiveChange: true`.

## Request

<ParamField path="abTestId" type="string" required>
  A/B test ID.
</ParamField>

<ParamField body="name" type="string">
  Updated test name.
</ParamField>

<ParamField body="testPercentage" type="number">
  Campaign-only share of the audience used for testing, from 5 to 50.
</ParamField>

<ParamField body="testDurationMinutes" type="number">
  Campaign-only duration before winner selection, from 15 to 1440 minutes.
</ParamField>

<ParamField body="winnerCriteria" type="string">
  Winner metric for either test kind: `open_rate` or `click_rate`.
</ParamField>

<ParamField body="testType" type="string">
  Sequence-only variant strategy: `subject` or `content`. When `winnerCriteria`
  is omitted, subject defaults to `open_rate` and content defaults to
  `click_rate`.
</ParamField>

<ParamField body="winnerThreshold" type="number">
  Sequence-only number of recipients before selecting a winner, from 10 to 1000.
</ParamField>

<ParamField body="confirmLiveChange" type="boolean">
  Required as `true` when changing selection settings for an active sequence
  test or one with recorded activity.
</ParamField>

```bash theme={null}
curl -X PATCH "https://api.sequenzy.com/api/v1/ab-tests/ab_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "testType": "content",
    "winnerCriteria": "open_rate",
    "winnerThreshold": 150,
    "confirmLiveChange": true
  }'
```

## Response

The response includes `kind` and an effective `settings` object. Use
`settings` when copying a test. The legacy `testPercentage: 100` and
`testDurationMinutes: 0` fields on sequence tests are retained for backwards
compatibility and are not sequence runtime settings.

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "abTest": {
      "id": "ab_abc123",
      "kind": "sequence",
      "automationNodeId": "node_abc123",
      "winnerCriteria": "open_rate",
      "testType": "content",
      "winnerThreshold": 150,
      "settings": {
        "testType": "content",
        "winnerThreshold": 150,
        "winnerCriteria": "open_rate"
      }
    }
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Sequence A/B tests use testType and winnerThreshold; testPercentage and testDurationMinutes apply only to campaign A/B tests"
  }
  ```

  ```json 404 theme={null}
  {
    "success": false,
    "error": "A/B test not found"
  }
  ```
</ResponseExample>
