# Write Split Test Variant

Updates one email newsletter split-test variant's internal name, subject or preheader by emailId. This is where a variant's subject is set; its body uses the email editor. Omitted values stay unchanged. Changing subject or preheader invalidates earlier contentRevision values. Refused after the test starts; sends nothing.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "campaignId": {
      "type": "integer",
      "description": "ID of the split test campaign the variant belongs to",
      "minimum": 1
    },
    "emailId": {
      "type": "integer",
      "description": "Email ID of the variant to write, as get-newsletter returns it in splitTestVariants",
      "minimum": 1
    },
    "name": {
      "type": [
        "null",
        "string"
      ],
      "description": "New internal name of this variant, never sent to a recipient; omit to keep the current one",
      "default": null,
      "maxLength": 250
    },
    "subject": {
      "type": [
        "null",
        "string"
      ],
      "description": "New subject line of this variant, without HTML; ask the user, never invent one. Invalidates the variant's contentRevision",
      "default": null,
      "maxLength": 998
    },
    "preheader": {
      "type": [
        "null",
        "string"
      ],
      "description": "New inbox preview line of this variant, at most 120 characters, without HTML; empty string removes it, omit keeps it",
      "default": null,
      "maxLength": 120
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account the access token works in",
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "campaignId",
    "emailId"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "accountId",
    "newsletterId",
    "variants",
    "variantCount",
    "needsMoreVariants",
    "sharePerVariantPercent",
    "testSizePercent",
    "testDurationHours",
    "winnerBy",
    "hasStarted"
  ],
  "properties": {
    "accountId": {
      "type": "integer"
    },
    "newsletterId": {
      "type": "integer"
    },
    "variants": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "emailId",
          "label",
          "name",
          "subject",
          "editorUrl",
          "contentRevision"
        ],
        "properties": {
          "emailId": {
            "type": "integer"
          },
          "label": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "editorUrl": {
            "type": "string"
          },
          "contentRevision": {
            "type": "string"
          }
        }
      }
    },
    "variantCount": {
      "type": "integer"
    },
    "needsMoreVariants": {
      "type": "boolean"
    },
    "sharePerVariantPercent": {
      "type": "integer"
    },
    "testSizePercent": {
      "type": "integer"
    },
    "testDurationHours": {
      "type": "integer"
    },
    "winnerBy": {
      "type": [
        "string",
        "null"
      ]
    },
    "hasStarted": {
      "type": "boolean"
    }
  }
}
```

