> ## 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 Variant

> Update a draft A/B test variant

Update a draft A/B test variant's subject, preview text, or body content. You can use raw HTML or Sequenzy block JSON for the body.

## Request

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

<ParamField path="variantId" type="string" required>
  Variant ID.
</ParamField>

<ParamField body="subject" type="string">
  Updated subject line.
</ParamField>

<ParamField body="previewText" type="string">
  Updated preview text. Send `null` to clear it.
</ParamField>

<ParamField body="html" type="string">
  Replacement HTML body. Use this or `blocks`, not both.
</ParamField>

<ParamField body="blocks" type="array">
  Replacement Sequenzy email blocks. Use this or `html`, not both. Put block
  styling under `styles`; top-level style keys like `backgroundColor`,
  `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are
  normalized into `styles`.
</ParamField>

```bash theme={null}
curl -X PATCH "https://api.sequenzy.com/api/v1/ab-tests/ab_abc123/variants/var_b" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject": "A better subject"}'
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "variant": {
      "id": "var_b",
      "label": "B",
      "emailId": "email_def456",
      "subject": "A better subject",
      "previewText": null,
      "blocks": [],
      "localizations": []
    }
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Cannot update variants after test has started"
  }
  ```

  ```json 401 theme={null}
  {
    "success": false,
    "error": "Unauthorized"
  }
  ```

  ```json 404 theme={null}
  {
    "success": false,
    "error": "Variant not found"
  }
  ```

  ```json 500 theme={null}
  {
    "success": false,
    "error": "Failed to update variant"
  }
  ```
</ResponseExample>
