# Update Email Campaign

PATCH https://services.leadconnectorhq.com/emails/locations/{locationId}/campaigns/emails/{campaignId}

Update the name or content of an email campaign (A/B version A). Edit content while the campaign is `draft`, or after Pause/Cancel Email Campaign. For A/B versions B, C, ... use Upsert A/B Variation.

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

## 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}": {
      "patch": {
        "summary": "Update Email Campaign",
        "operationId": "updateEmailCampaign",
        "description": "Update the name or content of an email campaign (A/B version A). Edit content while the campaign is `draft`, or after Pause/Cancel Email Campaign. For A/B versions B, C, ... use Upsert A/B Variation.",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "description": "Location ID",
            "schema": {
              "example": "ve9EPM428h8vShlRW1KT",
              "type": "string"
            }
          },
          {
            "name": "campaignId",
            "required": true,
            "in": "path",
            "description": "Campaign ID",
            "schema": {
              "example": "67f15c2ae99226d5bcccb8f3",
              "type": "string"
            }
          },
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEmailCampaignPublicV2BodyDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateEmailCampaignPublicV2ResponseDto"
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          },
          "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": {
      "UpdateEmailCampaignPublicV2BodyDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Campaign name",
            "example": "Untitled campaign name"
          },
          "editorContent": {
            "description": "Editor content to update (A/B version A). Required only when updating campaign content, and must be provided together with editorType. An HTML or plain-text string for `html`/`text`, or design-editor JSON for `builder` (fetch the current JSON with Get Email Campaign `includeContent=true`). For versions B, C, ... use Upsert A/B Variation. 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.",
            "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>Hello World</body></html>"
          },
          "editorType": {
            "type": "string",
            "description": "Editor type for campaign content. Required only when updating campaign content, and must be provided together with editorContent. `html` = code editor (raw HTML string), `text` = plain-text email (string), `builder` = design (drag-and-drop) editor (JSON, see BuilderEditorContentPublicV2Dto). 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.",
            "enum": [
              "html",
              "builder",
              "text"
            ],
            "example": "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
          },
          "subject": {
            "type": "string",
            "description": "Email subject saved on the campaign. Get, Preview, Validate and Test Send use it; Schedule Campaign `emailMeta` sets the subject that is sent. Send settings can change only while the campaign is draft, paused or cancelled (409 otherwise).",
            "example": "Your home called. It’s feeling festive."
          },
          "fromName": {
            "type": "string",
            "description": "Sender display name saved on the draft (same rules as `subject`).",
            "example": "Anz Studio"
          },
          "fromEmail": {
            "type": "string",
            "description": "Sender email address saved on the draft (same rules as `subject`). Use an address on a location sending domain (see List Sending Domains).",
            "example": "hello@anzstudio.com"
          },
          "previewText": {
            "type": "string",
            "description": "Preview text (inbox snippet) saved on the draft (same rules as `subject`).",
            "example": "A little something for the holidays"
          },
          "userId": {
            "type": "string",
            "description": "ID of the user performing this action",
            "example": "507f1f77bcf86cd799439011"
          }
        },
        "title": "UpdateEmailCampaignPublicV2BodyDto"
      },
      "UpdateEmailCampaignPublicV2ResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Campaign ID",
            "example": "67f15c2ae99226d5bcccb8f3"
          },
          "source": {
            "type": "string",
            "description": "Source of the campaign",
            "example": "email-campaign"
          },
          "sourceId": {
            "type": "string",
            "description": "Source ID of the campaign",
            "example": "bulkRequest_abc123"
          },
          "name": {
            "type": "string",
            "description": "Campaign name",
            "example": "February Newsletter"
          },
          "status": {
            "type": "string",
            "description": "Campaign status. Status lifecycle: `draft` (created, editable) → Schedule Campaign → `scheduled` (waiting for `sendAt` or the next batch) → `processing` (sending) → `sent`. RSS campaigns have no `scheduled` state: while active, including between feed checks, they report `processing` or the status of their latest send. `failed` = sending errored. Pause Email Campaign: `scheduled`/`processing` → `paused`; Resume Email Campaign: `paused` → `processing`. Cancel Email Campaign: `scheduled`/`processing`/`paused` → `cancelled`. `draft`, `paused` and `cancelled` campaigns can be (re)scheduled with Schedule Campaign. `archived` = archived campaign (any underlying status).",
            "example": "sent",
            "enum": [
              "all",
              "sent",
              "failed",
              "archived",
              "draft",
              "processing",
              "scheduled",
              "cancelled",
              "paused"
            ]
          },
          "campaignType": {
            "type": "string",
            "description": "Campaign type",
            "example": "bulk-email"
          },
          "campaignCategory": {
            "type": "string",
            "description": "Campaign category",
            "example": "email-campaign"
          },
          "variations": {
            "description": "AB test variation identifiers (available only for AB test campaigns)",
            "example": [
              {
                "sourceId": "9MhVcU7dTdLI7XOU1Vdt",
                "isWinner": true
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sourceId": {
                  "type": "string",
                  "description": "Variation source ID for stats lookup",
                  "example": "9MhVcU7dTdLI7XOU1Vdt"
                },
                "isWinner": {
                  "type": "boolean",
                  "description": "Whether this is the winning variation",
                  "example": true
                }
              },
              "required": [
                "sourceId",
                "isWinner"
              ],
              "title": "EmailCampaignVariationPublicV2Dto"
            }
          },
          "deleted": {
            "type": "boolean",
            "description": "Whether the campaign is deleted",
            "example": false
          },
          "createdAt": {
            "type": "string",
            "description": "Created at timestamp",
            "example": "2025-07-24T11:55:43.598Z"
          },
          "updatedAt": {
            "type": "string",
            "description": "Last updated timestamp",
            "example": "2026-02-09T04:49:12.322Z"
          },
          "editorContentUrl": {
            "type": "string",
            "description": "URL of the rendered campaign 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"
          },
          "traceId": {
            "type": "string",
            "description": "Trace ID of request",
            "example": "019e4ef5-a65e-4198-8cf9-8e93dca9bda4"
          }
        },
        "required": [
          "id",
          "deleted",
          "createdAt",
          "updatedAt"
        ],
        "title": "UpdateEmailCampaignPublicV2ResponseDto"
      },
      "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"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      },
      "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 PATCH 'https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "Untitled campaign name",
  "editorContent": "<html><body>Hello World</body></html>",
  "editorType": "html",
  "allowEditorTypeChange": false,
  "subject": "Your home called. It’s feeling festive.",
  "fromName": "Anz Studio",
  "fromEmail": "hello@anzstudio.com",
  "previewText": "A little something for the holidays",
  "userId": "507f1f77bcf86cd799439011"
}'
```

**Node.js**

```javascript
const options = {
  method: 'PATCH',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "name": "Untitled campaign name",
      "editorContent": "<html><body>Hello World</body></html>",
      "editorType": "html",
      "allowEditorTypeChange": false,
      "subject": "Your home called. It’s feeling festive.",
      "fromName": "Anz Studio",
      "fromEmail": "hello@anzstudio.com",
      "previewText": "A little something for the holidays",
      "userId": "507f1f77bcf86cd799439011"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>', 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}"

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

payload = {
    "name": "Untitled campaign name",
    "editorContent": "<html><body>Hello World</body></html>",
    "editorType": "html",
    "allowEditorTypeChange": false,
    "subject": "Your home called. It’s feeling festive.",
    "fromName": "Anz Studio",
    "fromEmail": "hello@anzstudio.com",
    "previewText": "A little something for the holidays",
    "userId": "507f1f77bcf86cd799439011"
}

response = requests.patch(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>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PATCH',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "name": "Untitled campaign name",
  "editorContent": "<html><body>Hello World</body></html>",
  "editorType": "html",
  "allowEditorTypeChange": false,
  "subject": "Your home called. It’s feeling festive.",
  "fromName": "Anz Studio",
  "fromEmail": "hello@anzstudio.com",
  "previewText": "A little something for the holidays",
  "userId": "507f1f77bcf86cd799439011"
}',
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .patch("https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"name\":\"Untitled campaign name\",\"editorContent\":\"<html><body>Hello World</body></html>\",\"editorType\":\"html\",\"allowEditorTypeChange\":false,\"subject\":\"Your home called. It’s feeling festive.\",\"fromName\":\"Anz Studio\",\"fromEmail\":\"hello@anzstudio.com\",\"previewText\":\"A little something for the holidays\",\"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>"
  payload := strings.NewReader(`{
  "name": "Untitled campaign name",
  "editorContent": "<html><body>Hello World</body></html>",
  "editorType": "html",
  "allowEditorTypeChange": false,
  "subject": "Your home called. It’s feeling festive.",
  "fromName": "Anz Studio",
  "fromEmail": "hello@anzstudio.com",
  "previewText": "A little something for the holidays",
  "userId": "507f1f77bcf86cd799439011"
}`)
  req, _ := http.NewRequest("PATCH", 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>")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "name": "Untitled campaign name",
  "editorContent": "<html><body>Hello World</body></html>",
  "editorType": "html",
  "allowEditorTypeChange": false,
  "subject": "Your home called. It’s feeling festive.",
  "fromName": "Anz Studio",
  "fromEmail": "hello@anzstudio.com",
  "previewText": "A little something for the holidays",
  "userId": "507f1f77bcf86cd799439011"
}'

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

**PowerShell**

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

$body = '{
  "name": "Untitled campaign name",
  "editorContent": "<html><body>Hello World</body></html>",
  "editorType": "html",
  "allowEditorTypeChange": false,
  "subject": "Your home called. It’s feeling festive.",
  "fromName": "Anz Studio",
  "fromEmail": "hello@anzstudio.com",
  "previewText": "A little something for the holidays",
  "userId": "507f1f77bcf86cd799439011"
}'

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