# Upsert A/B Variation

POST https://services.leadconnectorhq.com/emails/locations/{locationId}/campaigns/emails/{campaignId}/variations/{index}

Get or create the campaign-owned document for A/B variation `index` (1 = version B, 2 = version C, ...) and optionally write its content. A missing variation is cloned from the campaign's current content. Version A (index 0) is the campaign itself: edit it with Update Email Campaign.

Use for an email-content A/B test (`abTestConfig.testType=emailContent`): call this once per variation index ≥ 1, then pass each returned `documentId` as `abTestConfig.variations[index].documentId` in Schedule Campaign. Never pass a template ID there.

Create versions in order (1, then 2, ...): an index whose previous version does not exist yet returns 400. Calls for the same campaign must be sequential; a call made while another is still running returns 409, so retry it. Allowed only while the campaign is `draft`, `paused` or `cancelled`; returns 409 otherwise. A `paused` campaign can only edit versions it already has: adding a new version returns 409 (cancel the campaign first). Returns 400 when index is outside 1-9 or editorContent is empty.

How an A/B test works (follow these steps in order): 
1. Version A is the campaign itself. Create it with Create Email Campaign and edit it with Update Email Campaign. 
2. Versions B, C, ... are stored inside the same campaign, not as separate campaigns or templates. Create or edit each one with Upsert A/B Variation (`index` 1 = B, 2 = C, ...; create them in order). Never create another campaign or template to make a version. Versions do not show in the campaign list, and the builder only shows them once the test is scheduled. 
3. Check the versions before sending: Get Email Campaign lists them in `abVersions` (with each `documentId`); Validate Email Campaign checks every version (issues carry `variationIndex`); Preview Email Campaign and Test Send Email Campaign take `variationIndex` to show or test-send one version. Use these to read a version; Upsert A/B Variation creates the version when it is missing. 
4. Start the test with Schedule Campaign `abTestConfig`: `testType=emailContent` with `variations[index].documentId` from `abVersions` (index 0 = version A, no documentId needed), or `testType=subjectLine` with one `subject` per version. Without `abTestConfig` the campaign sends version A only, and versions B, C, ... are never sent. The test group must give every version at least 10 contacts (see `abTestConfig.testSize`); otherwise Schedule Campaign returns 400.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `emails/campaigns.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location ID |
| `campaignId` | string | Yes | Campaign ID returned by Create Email Campaign |
| `index` | integer | Yes | A/B variation index. `1` is version B, `2` is version C, and so on. Index `0` (version A) is the campaign itself: edit it with Update Email Campaign. |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `includeContent` | boolean | No | Set to `true` to include the variation’s current `editorContent` in the response. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/emails/locations/{locationId}/campaigns/emails/{campaignId}/variations/{index}": {
      "post": {
        "summary": "Upsert A/B Variation",
        "operationId": "upsertAbVariation",
        "description": "Get or create the campaign-owned document for A/B variation `index` (1 = version B, 2 = version C, ...) and optionally write its content. A missing variation is cloned from the campaign's current content. Version A (index 0) is the campaign itself: edit it with Update Email Campaign.\n\nUse for an email-content A/B test (`abTestConfig.testType=emailContent`): call this once per variation index ≥ 1, then pass each returned `documentId` as `abTestConfig.variations[index].documentId` in Schedule Campaign. Never pass a template ID there.\n\nCreate versions in order (1, then 2, ...): an index whose previous version does not exist yet returns 400. Calls for the same campaign must be sequential; a call made while another is still running returns 409, so retry it. Allowed only while the campaign is `draft`, `paused` or `cancelled`; returns 409 otherwise. A `paused` campaign can only edit versions it already has: adding a new version returns 409 (cancel the campaign first). Returns 400 when index is outside 1-9 or editorContent is empty.\n\nHow an A/B test works (follow these steps in order): \n1. Version A is the campaign itself. Create it with Create Email Campaign and edit it with Update Email Campaign. \n2. Versions B, C, ... are stored inside the same campaign, not as separate campaigns or templates. Create or edit each one with Upsert A/B Variation (`index` 1 = B, 2 = C, ...; create them in order). Never create another campaign or template to make a version. Versions do not show in the campaign list, and the builder only shows them once the test is scheduled. \n3. Check the versions before sending: Get Email Campaign lists them in `abVersions` (with each `documentId`); Validate Email Campaign checks every version (issues carry `variationIndex`); Preview Email Campaign and Test Send Email Campaign take `variationIndex` to show or test-send one version. Use these to read a version; Upsert A/B Variation creates the version when it is missing. \n4. Start the test with Schedule Campaign `abTestConfig`: `testType=emailContent` with `variations[index].documentId` from `abVersions` (index 0 = version A, no documentId needed), or `testType=subjectLine` with one `subject` per version. Without `abTestConfig` the campaign sends version A only, and versions B, C, ... are never sent. The test group must give every version at least 10 contacts (see `abTestConfig.testSize`); otherwise Schedule Campaign returns 400.",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "description": "Location ID",
            "schema": {
              "example": "ve9EPM428h8vShlRW1KT",
              "type": "string"
            }
          },
          {
            "name": "campaignId",
            "required": true,
            "in": "path",
            "description": "Campaign ID returned by Create Email Campaign",
            "schema": {
              "example": "67f15c2ae99226d5bcccb8f3",
              "type": "string"
            }
          },
          {
            "name": "index",
            "required": true,
            "in": "path",
            "description": "A/B variation index. `1` is version B, `2` is version C, and so on. Index `0` (version A) is the campaign itself: edit it with Update Email Campaign.",
            "schema": {
              "minimum": 1,
              "maximum": 9,
              "example": 1,
              "type": "integer"
            }
          },
          {
            "name": "includeContent",
            "required": false,
            "in": "query",
            "description": "Set to `true` to include the variation’s current `editorContent` in the response.",
            "schema": {
              "default": false,
              "example": false,
              "type": "boolean"
            }
          },
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertEmailCampaignVariationPublicV3BodyDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpsertEmailCampaignVariationPublicV3ResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "403": {
            "description": "The token does not have access to this location",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidLocationDTO"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundDTO"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - the campaign is sending or sent; pause or cancel it first"
          },
          "429": {
            "description": "Too Many Requests - rate limit exceeded; retry after a short delay"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": [
              "emails/campaigns.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "UpsertEmailCampaignVariationPublicV3BodyDto": {
        "type": "object",
        "properties": {
          "editorType": {
            "type": "string",
            "description": "Editor of the variation content. Send together with `editorContent` to write content; omit both to only create (or fetch) the variation document. Use the same editorType as the campaign.",
            "enum": [
              "html",
              "builder",
              "text"
            ],
            "example": "html"
          },
          "editorContent": {
            "description": "Variation content. A string (HTML or plain text) when editorType is `html` or `text`; the design-editor JSON (`elements`, `attrs`, `templateSettings`) when editorType is `builder`.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "elements": {
                    "description": "Layout tree: `mj-section` > `mj-column` > leaf elements. Design-editor (`builder`) JSON. `elements` is the layout tree: `mj-section` > `mj-column` > leaf elements. Every node has a unique `id` and a `tagName`. `attrs` is a flat map keyed by node `id` (one entry for every node in the tree, sections and columns included): `{ tagName, content, attributes: [{ name, default, unit? }] }`. `content` holds the text/HTML of leaf elements such as `mj-text` and `mj-button`. Each attribute is `{ name, default, unit? }`: `default` is the value, and sizes are a number plus `unit` (`px` or `%`), e.g. `{ name: \"font-size\", default: 16, unit: \"px\" }`. Padding is split into `padding-top`, `padding-right`, `padding-bottom` and `padding-left` with `enable-padding` set to `true`; the `padding` shorthand and inline `style` are not read by the editor. Send the full attribute set below for every element, changing only the values you need. When an element is selected in the editor, every listed attribute missing from the JSON is written in with the default shown here, so a partial list changes the design (background, padding, font) on first click. Text and image backgrounds use `container-background-color`; section and button backgrounds use `background-color`. Element attributes and the editor defaults: `mj-section`: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, background-color=#ffffff, background-url=\"\", background-size=auto, background-repeat=repeat, full-width=false, text-align=center, border-radius=0px, border-width=0px, border-color=\"\". `mj-column`: enable-padding=true, padding-top=0px, padding-right=0px, padding-bottom=0px, padding-left=0px, is-unstacked=false. `mj-text`: enable-padding=true, padding-top=12px, padding-right=24px, padding-bottom=12px, padding-left=24px, font-family=arial, helvetica, sans-serif, font-size=14px, line-height=1.5, container-background-color=\"\". `mj-image`: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, src=https://..., alt=\"\", href=\"\", width=null, height=null, align=center, border-radius=0px, container-background-color=\"\". `mj-button`: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, background-color=#00a4bd, color=#ffffff, font-family=Ubuntu, Helvetica, Arial, sans-serif, font-size=14px, align=center, border-radius=6px, border-width=0px, border-color=#00a4bd, redirectAction=url, url=\"\". `mj-divider`: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, border-width=2px, border-color=#99acc2, border-style=solid, width=100%, align=center. `mj-spacer`: height=20px, container-background-color=\"\". Buttons are `mj-button` elements (text in `content`, colors and link in `attributes`). `mj-text` content is edited as rich text and keeps only paragraphs, headings `<h1>`-`<h6>`, `text-align`, `<span style>` font/size/color, `<strong>`, `<em>`, `<u>`, `<s>`, links `<a href>`, lists and `<br>`; other markup (a link styled as a button with background or padding, tables, `<div>`, block styles) renders in the email but the editor drops it on edit, so the canvas shows something different from what is sent. Images: `mj-image` needs `src` set to a public https URL of the image (upload a file first with the Medias API and use its URL); without `src` the editor shows a placeholder. Set `alt` for accessibility and `href` to make the image a link. Leave `width` and `height` as `null` for the natural size (capped to the column) or set a number with `unit: \"px\"`; never omit them or send `\"\"`. `templateSettings` holds template-wide theme settings as lists of `{ name, default, unit? }` grouped by `body` (width, background-color, body-color, border, background image), `button`, `divider`, `text` (fonts, line-height, link styles) and `header` (`customCss`). To keep the current theme, send back the `templateSettings` that Get returned. Text fonts: inside `mj-text` content set `font-family`, `font-size` and `color` on a `<span style=\"...\">` around the text (e.g. `<h1><span style=\"font-family: georgia, palatino, serif; font-size: 32px\">Title</span></h1>`); the editor toolbar reads fonts only from these spans, so styles on `<h1>`/`<p>` themselves show as the default font and size. Use one of these exact `font-family` values: `arial, helvetica, sans-serif`, `helvetica, arial, sans-serif`, `verdana, geneva, sans-serif`, `georgia, palatino, serif`, `'times new roman', times, serif`, `'trebuchet ms', geneva, sans-serif`, `'arial black', sans-serif`, `'andale mono', monospace`, `Ubuntu, Helvetica, Arial, sans-serif`. Google fonts: use `'Font Name', <fallback from the list above>` (quotes only when the name has a space) and list every Google font used in `templateSettings.text` as `{ name: \"custom-fonts\", default: \"Font One;Font Two\" }`; fonts not listed there are not loaded and fall back. Brand-board fonts: use `'Brand Font Name', <fallback>` and list their brand font ids in `{ name: \"brand-custom-fonts\", default: \"id1;id2\" }`. Keep both entries when sending back `templateSettings`. Supported leaf tags: `mj-text`, `mj-image`, `mj-logo`, `mj-button`, `mj-divider`, `mj-spacer`, `mj-social`, `mj-video`, `mj-raw`, `mj-footer`, `mj-accordion`, `mj-carousel`, `mj-countdown-timer`, `mj-form`, `mj-product`, `mj-shopping-cart`, `mj-review-link`, `mj-rss-header`, `mj-rss-item`, `mj-preview-url`. For tags not listed above, copy an existing element of that tag from a Get response. Buttons link through `redirectAction` (`url`, `mail`, `telephone`, `sms`, `skype`, `other`, `file`) plus the attribute it names, e.g. `{ name: \"redirectAction\", default: \"url\" }` with `{ name: \"url\", default: \"https://...\" }`; `href` alone renders no link. Nodes without an `attrs` entry are skipped when rendering. Merge fields are Handlebars: `{{contact.first_name}}`, a fallback is `{{default contact.first_name \"there\"}}`, a condition is `{{#if contact.city}}...{{/if}}`. Liquid filters such as `{{contact.first_name | default: \"there\"}}` are not supported and block the send.",
                    "example": [
                      {
                        "id": "mj-section-1",
                        "tagName": "mj-section",
                        "children": [
                          {
                            "id": "mj-column-1",
                            "tagName": "mj-column",
                            "children": [
                              {
                                "id": "mj-image-1",
                                "tagName": "mj-image"
                              },
                              {
                                "id": "mj-text-1",
                                "tagName": "mj-text"
                              },
                              {
                                "id": "mj-button-1",
                                "tagName": "mj-button"
                              }
                            ]
                          }
                        ]
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Element ID",
                          "example": "mj-text-123"
                        },
                        "tagName": {
                          "type": "string",
                          "description": "Tag name",
                          "example": "mj-text"
                        },
                        "children": {
                          "type": "array",
                          "description": "Child elements, each with the same shape: `{ id, tagName, children? }`",
                          "items": {
                            "type": "object"
                          },
                          "example": [
                            {
                              "id": "mj-column-1",
                              "tagName": "mj-column"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "tagName"
                      ],
                      "title": "BuilderElementNodePublicV2Dto"
                    }
                  },
                  "attrs": {
                    "type": "object",
                    "description": "Attributes map keyed by element ID. Every node in `elements` needs an entry.",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "tagName": {
                          "type": "string",
                          "description": "Tag name: `mj-section`, `mj-column` or a leaf tag (mj-text, mj-image, mj-logo, mj-button, mj-divider, mj-spacer, mj-social, mj-video, mj-raw, mj-footer, mj-accordion, mj-carousel, mj-countdown-timer, mj-form, mj-product, mj-shopping-cart, mj-review-link, mj-rss-header, mj-rss-item, mj-preview-url)",
                          "example": "mj-text"
                        },
                        "attributes": {
                          "description": "Element attributes",
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "Attribute name",
                                "example": "padding"
                              },
                              "default": {
                                "type": "object",
                                "description": "Attribute default value",
                                "example": "10px"
                              },
                              "unit": {
                                "type": "string",
                                "description": "Attribute unit",
                                "example": "px"
                              }
                            },
                            "required": [
                              "name"
                            ],
                            "title": "BuilderAttributePublicV2Dto"
                          }
                        },
                        "content": {
                          "type": "string",
                          "description": "Element content",
                          "example": "Hello world"
                        },
                        "customFlags": {
                          "description": "Custom flags",
                          "allOf": [
                            {
                              "type": "object",
                              "properties": {
                                "layoutId": {
                                  "type": "object",
                                  "description": "Layout ID",
                                  "example": "hero-layout"
                                },
                                "theme": {
                                  "type": "string",
                                  "description": "Theme name",
                                  "example": "clean"
                                },
                                "socialElementType": {
                                  "type": "string",
                                  "enum": [
                                    "icon",
                                    "icon-text",
                                    "text"
                                  ],
                                  "description": "Social element rendering type"
                                }
                              },
                              "title": "BuilderCustomFlagsPublicV2Dto"
                            }
                          ]
                        }
                      },
                      "required": [
                        "tagName",
                        "attributes"
                      ],
                      "title": "BuilderNodeAttrsPublicV2Dto"
                    },
                    "example": {
                      "mj-section-1": {
                        "tagName": "mj-section",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "background-color",
                            "default": "#fdf6ec"
                          },
                          {
                            "name": "background-url",
                            "default": ""
                          },
                          {
                            "name": "background-size",
                            "default": "auto"
                          },
                          {
                            "name": "background-repeat",
                            "default": "repeat"
                          },
                          {
                            "name": "full-width",
                            "default": false
                          },
                          {
                            "name": "text-align",
                            "default": "center"
                          },
                          {
                            "name": "border-radius",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "border-width",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "border-color",
                            "default": ""
                          }
                        ]
                      },
                      "mj-column-1": {
                        "tagName": "mj-column",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "is-unstacked",
                            "default": false
                          }
                        ]
                      },
                      "mj-image-1": {
                        "tagName": "mj-image",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 10,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 10,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "src",
                            "default": "https://example.com/banner.png"
                          },
                          {
                            "name": "alt",
                            "default": "Holiday sale banner"
                          },
                          {
                            "name": "href",
                            "default": ""
                          },
                          {
                            "name": "width",
                            "default": null,
                            "unit": "px"
                          },
                          {
                            "name": "height",
                            "default": null,
                            "unit": "px"
                          },
                          {
                            "name": "align",
                            "default": "center"
                          },
                          {
                            "name": "border-radius",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "container-background-color",
                            "default": ""
                          }
                        ]
                      },
                      "mj-text-1": {
                        "tagName": "mj-text",
                        "content": "<h1><span style=\"font-family: 'Playfair Display', georgia, palatino, serif; font-size: 32px\">Welcome</span></h1><p>Hello {{contact.first_name}}, thanks for subscribing!</p>",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 12,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 24,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 12,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 24,
                            "unit": "px"
                          },
                          {
                            "name": "font-family",
                            "default": "arial, helvetica, sans-serif"
                          },
                          {
                            "name": "font-size",
                            "default": 16,
                            "unit": "px"
                          },
                          {
                            "name": "line-height",
                            "default": 1.5
                          },
                          {
                            "name": "container-background-color",
                            "default": ""
                          }
                        ]
                      },
                      "mj-button-1": {
                        "tagName": "mj-button",
                        "content": "Shop now",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 10,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 10,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "background-color",
                            "default": "#188bf6"
                          },
                          {
                            "name": "color",
                            "default": "#ffffff"
                          },
                          {
                            "name": "font-family",
                            "default": "Ubuntu, Helvetica, Arial, sans-serif"
                          },
                          {
                            "name": "font-size",
                            "default": 14,
                            "unit": "px"
                          },
                          {
                            "name": "align",
                            "default": "center"
                          },
                          {
                            "name": "border-radius",
                            "default": 6,
                            "unit": "px"
                          },
                          {
                            "name": "border-width",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "border-color",
                            "default": "#188bf6"
                          },
                          {
                            "name": "redirectAction",
                            "default": "url"
                          },
                          {
                            "name": "url",
                            "default": "https://example.com"
                          },
                          {
                            "name": "href",
                            "default": "https://example.com"
                          }
                        ]
                      }
                    }
                  },
                  "templateSettings": {
                    "type": "object",
                    "description": "Template-wide theme settings keyed by group: `body`, `button`, `divider`, `text`, `header`. Each group is a list of `{ name, default, unit? }`.",
                    "additionalProperties": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Attribute name",
                            "example": "padding"
                          },
                          "default": {
                            "type": "object",
                            "description": "Attribute default value",
                            "example": "10px"
                          },
                          "unit": {
                            "type": "string",
                            "description": "Attribute unit",
                            "example": "px"
                          }
                        },
                        "required": [
                          "name"
                        ],
                        "title": "BuilderAttributePublicV2Dto"
                      }
                    },
                    "example": {
                      "body": [
                        {
                          "name": "width",
                          "default": 600,
                          "unit": "px"
                        },
                        {
                          "name": "background-color",
                          "default": "#EAF0F6"
                        },
                        {
                          "name": "body-color",
                          "default": "#ffffff"
                        }
                      ],
                      "button": [
                        {
                          "name": "background-color",
                          "default": "#2196F3"
                        },
                        {
                          "name": "border-radius",
                          "default": "10",
                          "unit": "px"
                        },
                        {
                          "name": "font-family",
                          "default": "arial, helvetica, sans-serif"
                        },
                        {
                          "name": "font-size",
                          "default": 16,
                          "unit": "px"
                        },
                        {
                          "name": "color",
                          "default": "#ffffff"
                        }
                      ],
                      "divider": [
                        {
                          "name": "border-width",
                          "default": 2,
                          "unit": "px"
                        },
                        {
                          "name": "border-color",
                          "default": "#FED7E2"
                        },
                        {
                          "name": "border-style",
                          "default": "solid"
                        }
                      ],
                      "text": [
                        {
                          "name": "font-family-paragraph",
                          "default": "arial, helvetica, sans-serif"
                        },
                        {
                          "name": "line-height",
                          "default": 1.25
                        },
                        {
                          "name": "text-link-color",
                          "default": "#00a4bd"
                        },
                        {
                          "name": "custom-fonts",
                          "default": "Playfair Display"
                        },
                        {
                          "name": "brand-custom-fonts",
                          "default": ""
                        }
                      ],
                      "header": [
                        {
                          "name": "customCss",
                          "default": "<style> /* custom styles */ </style>"
                        }
                      ]
                    }
                  }
                },
                "title": "BuilderEditorContentPublicV2Dto"
              }
            ],
            "example": "<html><body>Version B</body></html>"
          },
          "allowEditorTypeChange": {
            "type": "boolean",
            "description": "Content writes must keep the email’s editor: sending `html`/`text` for a design-editor (`builder`) email, or `builder` for an HTML/text email, is refused with 409 (code 6017) so the design is not replaced by accident. Set `true` only to convert the email to the other editor on purpose. Switching between `html` and `text` is always allowed. Design JSON over an email last saved in Design Editor 2.0 is always refused (409, code 6018); edit it in the app, or convert it with `html` and `allowEditorTypeChange: true`.",
            "example": false,
            "default": false
          },
          "userId": {
            "type": "string",
            "description": "ID of the user performing this action",
            "example": "507f1f77bcf86cd799439011"
          }
        },
        "title": "UpsertEmailCampaignVariationPublicV3BodyDto"
      },
      "UpsertEmailCampaignVariationPublicV3ResponseDto": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "description": "Campaign ID",
            "example": "67f15c2ae99226d5bcccb8f3"
          },
          "variationIndex": {
            "type": "number",
            "description": "A/B variation index",
            "example": 1
          },
          "documentId": {
            "type": "string",
            "description": "Campaign-owned document holding this variation’s content. Pass it as `abTestConfig.variations[variationIndex].documentId` in Schedule Campaign.",
            "example": "67f15c2ae99226d5bcccb8f9"
          },
          "editorContentUrl": {
            "type": "string",
            "description": "URL of the rendered variation HTML after this write. Issue a GET against it to see the result; a new URL is issued on every content save.",
            "example": "https://firebasestorage.googleapis.com/v0/b/bucket/o/index.html?alt=media&token=abc"
          },
          "editorContent": {
            "description": "Current variation content, returned only when `includeContent=true`.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "elements": {
                    "description": "Layout tree: `mj-section` > `mj-column` > leaf elements. Design-editor (`builder`) JSON. `elements` is the layout tree: `mj-section` > `mj-column` > leaf elements. Every node has a unique `id` and a `tagName`. `attrs` is a flat map keyed by node `id` (one entry for every node in the tree, sections and columns included): `{ tagName, content, attributes: [{ name, default, unit? }] }`. `content` holds the text/HTML of leaf elements such as `mj-text` and `mj-button`. Each attribute is `{ name, default, unit? }`: `default` is the value, and sizes are a number plus `unit` (`px` or `%`), e.g. `{ name: \"font-size\", default: 16, unit: \"px\" }`. Padding is split into `padding-top`, `padding-right`, `padding-bottom` and `padding-left` with `enable-padding` set to `true`; the `padding` shorthand and inline `style` are not read by the editor. Send the full attribute set below for every element, changing only the values you need. When an element is selected in the editor, every listed attribute missing from the JSON is written in with the default shown here, so a partial list changes the design (background, padding, font) on first click. Text and image backgrounds use `container-background-color`; section and button backgrounds use `background-color`. Element attributes and the editor defaults: `mj-section`: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, background-color=#ffffff, background-url=\"\", background-size=auto, background-repeat=repeat, full-width=false, text-align=center, border-radius=0px, border-width=0px, border-color=\"\". `mj-column`: enable-padding=true, padding-top=0px, padding-right=0px, padding-bottom=0px, padding-left=0px, is-unstacked=false. `mj-text`: enable-padding=true, padding-top=12px, padding-right=24px, padding-bottom=12px, padding-left=24px, font-family=arial, helvetica, sans-serif, font-size=14px, line-height=1.5, container-background-color=\"\". `mj-image`: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, src=https://..., alt=\"\", href=\"\", width=null, height=null, align=center, border-radius=0px, container-background-color=\"\". `mj-button`: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, background-color=#00a4bd, color=#ffffff, font-family=Ubuntu, Helvetica, Arial, sans-serif, font-size=14px, align=center, border-radius=6px, border-width=0px, border-color=#00a4bd, redirectAction=url, url=\"\". `mj-divider`: enable-padding=true, padding-top=10px, padding-right=20px, padding-bottom=10px, padding-left=20px, border-width=2px, border-color=#99acc2, border-style=solid, width=100%, align=center. `mj-spacer`: height=20px, container-background-color=\"\". Buttons are `mj-button` elements (text in `content`, colors and link in `attributes`). `mj-text` content is edited as rich text and keeps only paragraphs, headings `<h1>`-`<h6>`, `text-align`, `<span style>` font/size/color, `<strong>`, `<em>`, `<u>`, `<s>`, links `<a href>`, lists and `<br>`; other markup (a link styled as a button with background or padding, tables, `<div>`, block styles) renders in the email but the editor drops it on edit, so the canvas shows something different from what is sent. Images: `mj-image` needs `src` set to a public https URL of the image (upload a file first with the Medias API and use its URL); without `src` the editor shows a placeholder. Set `alt` for accessibility and `href` to make the image a link. Leave `width` and `height` as `null` for the natural size (capped to the column) or set a number with `unit: \"px\"`; never omit them or send `\"\"`. `templateSettings` holds template-wide theme settings as lists of `{ name, default, unit? }` grouped by `body` (width, background-color, body-color, border, background image), `button`, `divider`, `text` (fonts, line-height, link styles) and `header` (`customCss`). To keep the current theme, send back the `templateSettings` that Get returned. Text fonts: inside `mj-text` content set `font-family`, `font-size` and `color` on a `<span style=\"...\">` around the text (e.g. `<h1><span style=\"font-family: georgia, palatino, serif; font-size: 32px\">Title</span></h1>`); the editor toolbar reads fonts only from these spans, so styles on `<h1>`/`<p>` themselves show as the default font and size. Use one of these exact `font-family` values: `arial, helvetica, sans-serif`, `helvetica, arial, sans-serif`, `verdana, geneva, sans-serif`, `georgia, palatino, serif`, `'times new roman', times, serif`, `'trebuchet ms', geneva, sans-serif`, `'arial black', sans-serif`, `'andale mono', monospace`, `Ubuntu, Helvetica, Arial, sans-serif`. Google fonts: use `'Font Name', <fallback from the list above>` (quotes only when the name has a space) and list every Google font used in `templateSettings.text` as `{ name: \"custom-fonts\", default: \"Font One;Font Two\" }`; fonts not listed there are not loaded and fall back. Brand-board fonts: use `'Brand Font Name', <fallback>` and list their brand font ids in `{ name: \"brand-custom-fonts\", default: \"id1;id2\" }`. Keep both entries when sending back `templateSettings`. Supported leaf tags: `mj-text`, `mj-image`, `mj-logo`, `mj-button`, `mj-divider`, `mj-spacer`, `mj-social`, `mj-video`, `mj-raw`, `mj-footer`, `mj-accordion`, `mj-carousel`, `mj-countdown-timer`, `mj-form`, `mj-product`, `mj-shopping-cart`, `mj-review-link`, `mj-rss-header`, `mj-rss-item`, `mj-preview-url`. For tags not listed above, copy an existing element of that tag from a Get response. Buttons link through `redirectAction` (`url`, `mail`, `telephone`, `sms`, `skype`, `other`, `file`) plus the attribute it names, e.g. `{ name: \"redirectAction\", default: \"url\" }` with `{ name: \"url\", default: \"https://...\" }`; `href` alone renders no link. Nodes without an `attrs` entry are skipped when rendering. Merge fields are Handlebars: `{{contact.first_name}}`, a fallback is `{{default contact.first_name \"there\"}}`, a condition is `{{#if contact.city}}...{{/if}}`. Liquid filters such as `{{contact.first_name | default: \"there\"}}` are not supported and block the send.",
                    "example": [
                      {
                        "id": "mj-section-1",
                        "tagName": "mj-section",
                        "children": [
                          {
                            "id": "mj-column-1",
                            "tagName": "mj-column",
                            "children": [
                              {
                                "id": "mj-image-1",
                                "tagName": "mj-image"
                              },
                              {
                                "id": "mj-text-1",
                                "tagName": "mj-text"
                              },
                              {
                                "id": "mj-button-1",
                                "tagName": "mj-button"
                              }
                            ]
                          }
                        ]
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Element ID",
                          "example": "mj-text-123"
                        },
                        "tagName": {
                          "type": "string",
                          "description": "Tag name",
                          "example": "mj-text"
                        },
                        "children": {
                          "type": "array",
                          "description": "Child elements, each with the same shape: `{ id, tagName, children? }`",
                          "items": {
                            "type": "object"
                          },
                          "example": [
                            {
                              "id": "mj-column-1",
                              "tagName": "mj-column"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "tagName"
                      ],
                      "title": "BuilderElementNodePublicV2Dto"
                    }
                  },
                  "attrs": {
                    "type": "object",
                    "description": "Attributes map keyed by element ID. Every node in `elements` needs an entry.",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "tagName": {
                          "type": "string",
                          "description": "Tag name: `mj-section`, `mj-column` or a leaf tag (mj-text, mj-image, mj-logo, mj-button, mj-divider, mj-spacer, mj-social, mj-video, mj-raw, mj-footer, mj-accordion, mj-carousel, mj-countdown-timer, mj-form, mj-product, mj-shopping-cart, mj-review-link, mj-rss-header, mj-rss-item, mj-preview-url)",
                          "example": "mj-text"
                        },
                        "attributes": {
                          "description": "Element attributes",
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "Attribute name",
                                "example": "padding"
                              },
                              "default": {
                                "type": "object",
                                "description": "Attribute default value",
                                "example": "10px"
                              },
                              "unit": {
                                "type": "string",
                                "description": "Attribute unit",
                                "example": "px"
                              }
                            },
                            "required": [
                              "name"
                            ],
                            "title": "BuilderAttributePublicV2Dto"
                          }
                        },
                        "content": {
                          "type": "string",
                          "description": "Element content",
                          "example": "Hello world"
                        },
                        "customFlags": {
                          "description": "Custom flags",
                          "allOf": [
                            {
                              "type": "object",
                              "properties": {
                                "layoutId": {
                                  "type": "object",
                                  "description": "Layout ID",
                                  "example": "hero-layout"
                                },
                                "theme": {
                                  "type": "string",
                                  "description": "Theme name",
                                  "example": "clean"
                                },
                                "socialElementType": {
                                  "type": "string",
                                  "enum": [
                                    "icon",
                                    "icon-text",
                                    "text"
                                  ],
                                  "description": "Social element rendering type"
                                }
                              },
                              "title": "BuilderCustomFlagsPublicV2Dto"
                            }
                          ]
                        }
                      },
                      "required": [
                        "tagName",
                        "attributes"
                      ],
                      "title": "BuilderNodeAttrsPublicV2Dto"
                    },
                    "example": {
                      "mj-section-1": {
                        "tagName": "mj-section",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "background-color",
                            "default": "#fdf6ec"
                          },
                          {
                            "name": "background-url",
                            "default": ""
                          },
                          {
                            "name": "background-size",
                            "default": "auto"
                          },
                          {
                            "name": "background-repeat",
                            "default": "repeat"
                          },
                          {
                            "name": "full-width",
                            "default": false
                          },
                          {
                            "name": "text-align",
                            "default": "center"
                          },
                          {
                            "name": "border-radius",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "border-width",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "border-color",
                            "default": ""
                          }
                        ]
                      },
                      "mj-column-1": {
                        "tagName": "mj-column",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "is-unstacked",
                            "default": false
                          }
                        ]
                      },
                      "mj-image-1": {
                        "tagName": "mj-image",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 10,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 10,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "src",
                            "default": "https://example.com/banner.png"
                          },
                          {
                            "name": "alt",
                            "default": "Holiday sale banner"
                          },
                          {
                            "name": "href",
                            "default": ""
                          },
                          {
                            "name": "width",
                            "default": null,
                            "unit": "px"
                          },
                          {
                            "name": "height",
                            "default": null,
                            "unit": "px"
                          },
                          {
                            "name": "align",
                            "default": "center"
                          },
                          {
                            "name": "border-radius",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "container-background-color",
                            "default": ""
                          }
                        ]
                      },
                      "mj-text-1": {
                        "tagName": "mj-text",
                        "content": "<h1><span style=\"font-family: 'Playfair Display', georgia, palatino, serif; font-size: 32px\">Welcome</span></h1><p>Hello {{contact.first_name}}, thanks for subscribing!</p>",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 12,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 24,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 12,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 24,
                            "unit": "px"
                          },
                          {
                            "name": "font-family",
                            "default": "arial, helvetica, sans-serif"
                          },
                          {
                            "name": "font-size",
                            "default": 16,
                            "unit": "px"
                          },
                          {
                            "name": "line-height",
                            "default": 1.5
                          },
                          {
                            "name": "container-background-color",
                            "default": ""
                          }
                        ]
                      },
                      "mj-button-1": {
                        "tagName": "mj-button",
                        "content": "Shop now",
                        "attributes": [
                          {
                            "name": "enable-padding",
                            "default": true
                          },
                          {
                            "name": "padding-top",
                            "default": 10,
                            "unit": "px"
                          },
                          {
                            "name": "padding-right",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "padding-bottom",
                            "default": 10,
                            "unit": "px"
                          },
                          {
                            "name": "padding-left",
                            "default": 20,
                            "unit": "px"
                          },
                          {
                            "name": "background-color",
                            "default": "#188bf6"
                          },
                          {
                            "name": "color",
                            "default": "#ffffff"
                          },
                          {
                            "name": "font-family",
                            "default": "Ubuntu, Helvetica, Arial, sans-serif"
                          },
                          {
                            "name": "font-size",
                            "default": 14,
                            "unit": "px"
                          },
                          {
                            "name": "align",
                            "default": "center"
                          },
                          {
                            "name": "border-radius",
                            "default": 6,
                            "unit": "px"
                          },
                          {
                            "name": "border-width",
                            "default": 0,
                            "unit": "px"
                          },
                          {
                            "name": "border-color",
                            "default": "#188bf6"
                          },
                          {
                            "name": "redirectAction",
                            "default": "url"
                          },
                          {
                            "name": "url",
                            "default": "https://example.com"
                          },
                          {
                            "name": "href",
                            "default": "https://example.com"
                          }
                        ]
                      }
                    }
                  },
                  "templateSettings": {
                    "type": "object",
                    "description": "Template-wide theme settings keyed by group: `body`, `button`, `divider`, `text`, `header`. Each group is a list of `{ name, default, unit? }`.",
                    "additionalProperties": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Attribute name",
                            "example": "padding"
                          },
                          "default": {
                            "type": "object",
                            "description": "Attribute default value",
                            "example": "10px"
                          },
                          "unit": {
                            "type": "string",
                            "description": "Attribute unit",
                            "example": "px"
                          }
                        },
                        "required": [
                          "name"
                        ],
                        "title": "BuilderAttributePublicV2Dto"
                      }
                    },
                    "example": {
                      "body": [
                        {
                          "name": "width",
                          "default": 600,
                          "unit": "px"
                        },
                        {
                          "name": "background-color",
                          "default": "#EAF0F6"
                        },
                        {
                          "name": "body-color",
                          "default": "#ffffff"
                        }
                      ],
                      "button": [
                        {
                          "name": "background-color",
                          "default": "#2196F3"
                        },
                        {
                          "name": "border-radius",
                          "default": "10",
                          "unit": "px"
                        },
                        {
                          "name": "font-family",
                          "default": "arial, helvetica, sans-serif"
                        },
                        {
                          "name": "font-size",
                          "default": 16,
                          "unit": "px"
                        },
                        {
                          "name": "color",
                          "default": "#ffffff"
                        }
                      ],
                      "divider": [
                        {
                          "name": "border-width",
                          "default": 2,
                          "unit": "px"
                        },
                        {
                          "name": "border-color",
                          "default": "#FED7E2"
                        },
                        {
                          "name": "border-style",
                          "default": "solid"
                        }
                      ],
                      "text": [
                        {
                          "name": "font-family-paragraph",
                          "default": "arial, helvetica, sans-serif"
                        },
                        {
                          "name": "line-height",
                          "default": 1.25
                        },
                        {
                          "name": "text-link-color",
                          "default": "#00a4bd"
                        },
                        {
                          "name": "custom-fonts",
                          "default": "Playfair Display"
                        },
                        {
                          "name": "brand-custom-fonts",
                          "default": ""
                        }
                      ],
                      "header": [
                        {
                          "name": "customCss",
                          "default": "<style> /* custom styles */ </style>"
                        }
                      ]
                    }
                  }
                },
                "title": "BuilderEditorContentPublicV2Dto"
              }
            ]
          },
          "designEditorV2": {
            "type": "boolean",
            "description": "Returned as `true` with `includeContent=true` when the variation was last saved in the new design editor (DnD 2.0, block format). `editorContent` is then omitted: this API reads and writes only the classic design-editor JSON, and the stored classic version is older.",
            "example": true
          },
          "traceId": {
            "type": "string",
            "description": "Trace ID of the request",
            "example": "019e4ef5-a65e-4198-8cf9-8e93dca9bda4"
          }
        },
        "required": [
          "campaignId",
          "variationIndex",
          "documentId"
        ],
        "title": "UpsertEmailCampaignVariationPublicV3ResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "InvalidLocationDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code for invalid location access",
            "example": 403
          },
          "message": {
            "type": "string",
            "description": "Error message describing the location access failure",
            "example": "The token does not have access to this location"
          }
        },
        "title": "InvalidLocationDTO"
      },
      "NotFoundDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code for not found",
            "example": 404
          },
          "message": {
            "type": "string",
            "description": "Error message describing the not found failure",
            "example": "Not Found"
          },
          "error": {
            "type": "string",
            "description": "Error type identifier",
            "example": "The requested resource was not found"
          }
        },
        "title": "NotFoundDTO"
      },
      "InternalServerErrorDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code for an unexpected server error",
            "example": 500
          },
          "message": {
            "type": "string",
            "description": "Error message describing the server failure",
            "example": "Internal Server Error"
          }
        },
        "title": "InternalServerErrorDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>/variations/<index>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "editorType": "html",
  "editorContent": "<html><body>Version B</body></html>",
  "allowEditorTypeChange": false,
  "userId": "507f1f77bcf86cd799439011"
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "editorType": "html",
      "editorContent": "<html><body>Version B</body></html>",
      "allowEditorTypeChange": false,
      "userId": "507f1f77bcf86cd799439011"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>/variations/<index>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/emails/locations/{locationId}/campaigns/emails/{campaignId}/variations/{index}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "editorType": "html",
    "editorContent": "<html><body>Version B</body></html>",
    "allowEditorTypeChange": false,
    "userId": "507f1f77bcf86cd799439011"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>/variations/<index>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "editorType": "html",
  "editorContent": "<html><body>Version B</body></html>",
  "allowEditorTypeChange": false,
  "userId": "507f1f77bcf86cd799439011"
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>/variations/<index>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"editorType\":\"html\",\"editorContent\":\"<html><body>Version B</body></html>\",\"allowEditorTypeChange\":false,\"userId\":\"507f1f77bcf86cd799439011\"}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>/variations/<index>"
  payload := strings.NewReader(`{
  "editorType": "html",
  "editorContent": "<html><body>Version B</body></html>",
  "allowEditorTypeChange": false,
  "userId": "507f1f77bcf86cd799439011"
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>/variations/<index>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "editorType": "html",
  "editorContent": "<html><body>Version B</body></html>",
  "allowEditorTypeChange": false,
  "userId": "507f1f77bcf86cd799439011"
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "editorType": "html",
  "editorContent": "<html><body>Version B</body></html>",
  "allowEditorTypeChange": false,
  "userId": "507f1f77bcf86cd799439011"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>/variations/<index>' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
