# Update Newsletter Draft

Updates an email newsletter draft’s name, note, subject, preheader, audience or UTM campaign name. Omitted fields stay; the supplied audience replaces the old one. Subject or preheader changes invalidate earlier content revisions. On split tests subject and preheader are refused; set them per variant with update-newsletter-split-test-variant. Sends nothing and sets no send date.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "newsletterId": {
      "type": "integer",
      "description": "ID of the newsletter to write, as returned by create-newsletter-draft",
      "minimum": 1
    },
    "name": {
      "type": [
        "null",
        "string"
      ],
      "description": "New name, unique within the account, at most 250 characters, without HTML; omit to keep",
      "default": null,
      "maxLength": 250
    },
    "note": {
      "type": [
        "null",
        "string"
      ],
      "description": "Internal note, at most 1000 characters, without HTML; omit to keep",
      "default": null,
      "maxLength": 1000
    },
    "subject": {
      "type": [
        "null",
        "string"
      ],
      "description": "New subject line, without HTML. Invalidates every contentRevision read before",
      "default": null,
      "maxLength": 998
    },
    "audience": {
      "type": "object",
      "description": "Replaces the audience: \"mode\" is \"all_contacts\", \"saved_audience\" (with \"audienceId\") or \"tag_conditions\" (with the tag fields, at most 50 tags together); omit to keep",
      "default": null,
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "all_contacts",
            "saved_audience",
            "tag_conditions"
          ],
          "description": "\"all_contacts\" (every active contact, no further field), \"saved_audience\" or \"tag_conditions\"."
        },
        "audienceId": {
          "type": "integer",
          "minimum": 1,
          "description": "ID of the saved audience, for mode \"saved_audience\" only."
        },
        "includeTagIds": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "maxItems": 50,
          "description": "Tags a contact must carry, for \"tag_conditions\"; include and exclude together at most 50."
        },
        "includeTagsMatch": {
          "type": "string",
          "enum": [
            "any",
            "all"
          ],
          "description": "Whether \"any\" required tag is enough or \"all\" are needed."
        },
        "excludeTagIds": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "maxItems": 50,
          "description": "Tags that keep a contact out, for \"tag_conditions\"; include and exclude together at most 50."
        },
        "excludeTagsMatch": {
          "type": "string",
          "enum": [
            "any",
            "all"
          ],
          "description": "Whether \"any\" excluded tag already excludes or only \"all\" together do."
        }
      },
      "required": [
        "mode"
      ],
      "additionalProperties": false
    },
    "preheader": {
      "type": [
        "null",
        "string"
      ],
      "description": "New inbox preview line, at most 120 characters, without HTML; empty string removes it, omit keeps it. Invalidates every contentRevision read before",
      "default": null,
      "maxLength": 120
    },
    "utmCampaignName": {
      "type": [
        "null",
        "string"
      ],
      "description": "Campaign name appended to tracked links as utm_campaign, at most 120 characters, without HTML; empty string restores the account default, omit keeps it",
      "default": null,
      "maxLength": 120
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account the access token works in",
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "newsletterId"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "accountId",
    "newsletterId",
    "emailId",
    "name",
    "newsletterStatus",
    "emailEditor",
    "subject",
    "preheader",
    "contentRevisionInvalidated",
    "notes",
    "hasContent",
    "contentPublished",
    "audience",
    "sender",
    "editUrl",
    "contentUrl"
  ],
  "properties": {
    "accountId": {
      "type": "integer"
    },
    "newsletterId": {
      "type": "integer"
    },
    "emailId": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "newsletterStatus": {
      "type": "string"
    },
    "emailEditor": {
      "type": "string"
    },
    "subject": {
      "type": "string"
    },
    "preheader": {
      "type": "string"
    },
    "contentRevisionInvalidated": {
      "type": "boolean"
    },
    "notes": {
      "type": "string"
    },
    "hasContent": {
      "type": "boolean"
    },
    "contentPublished": {
      "type": "boolean"
    },
    "audience": {
      "type": "object",
      "required": [
        "mode"
      ],
      "properties": {
        "includeTags": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "name"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "includeTagsMatch": {
          "type": "string"
        },
        "excludeTags": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "name"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "excludeTagsMatch": {
          "type": "string"
        },
        "savedAudience": {
          "type": [
            "object",
            "null"
          ],
          "required": [
            "id",
            "name"
          ],
          "properties": {
            "id": {
              "type": "integer"
            },
            "name": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "mode": {
          "type": "string"
        }
      }
    },
    "sender": {
      "type": "object",
      "required": [
        "senderNameMode",
        "senderName",
        "senderEmailMode",
        "senderEmail",
        "replyToEmailMode",
        "replyToEmail",
        "senderDomainMode",
        "senderDomain",
        "signature"
      ],
      "properties": {
        "senderNameMode": {
          "type": "string"
        },
        "senderName": {
          "type": [
            "string",
            "null"
          ]
        },
        "senderEmailMode": {
          "type": "string"
        },
        "senderEmail": {
          "type": [
            "string",
            "null"
          ]
        },
        "replyToEmailMode": {
          "type": "string"
        },
        "replyToEmail": {
          "type": [
            "string",
            "null"
          ]
        },
        "senderDomainMode": {
          "type": "string"
        },
        "senderDomain": {
          "type": [
            "string",
            "null"
          ]
        },
        "signature": {
          "type": "object",
          "required": [
            "mode",
            "id",
            "name"
          ],
          "properties": {
            "mode": {
              "type": "string"
            },
            "id": {
              "type": "integer"
            },
            "name": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        }
      }
    },
    "editUrl": {
      "type": "string"
    },
    "contentUrl": {
      "type": "string"
    }
  }
}
```

