# Create Newsletter Draft

Creates an email newsletter draft with a subject and optional preheader. The subject is the line every recipient sees; correcting it through update-newsletter-draft invalidates the content revisions read before. Audience defaults to all_contacts, reaching every active contact when sent. splitTest is irreversible, needs a premium account (conversions/revenue also the conversion pixel) and starts with one variant; add more with add-newsletter-split-test-variant. emailEditor defaults to drag-and-drop and is fixed at creation. Next steps: body with the block tools, audience with update-newsletter-draft, sender with configure-newsletter-delivery. Nothing is sent.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Name of the newsletter, unique within the account",
      "minLength": 1,
      "maxLength": 250
    },
    "subject": {
      "type": "string",
      "description": "Subject line, without HTML. It is the line every recipient sees, and no part of it is derived from anything else in this call. Correcting it later is update-newsletter-draft, which invalidates the content revisions read before",
      "minLength": 1,
      "maxLength": 998
    },
    "notes": {
      "type": [
        "null",
        "string"
      ],
      "description": "Internal note about the purpose of this newsletter, never part of the email",
      "default": null,
      "maxLength": 1000
    },
    "preheader": {
      "type": [
        "null",
        "string"
      ],
      "description": "Inbox preview line, at most 120 characters, without HTML; omit to leave it empty. Not part of the content document: an HTML import cannot set it",
      "default": null,
      "maxLength": 120
    },
    "splitTest": {
      "type": [
        "object",
        "null"
      ],
      "description": "Makes the newsletter a split test, irreversibly: \"testSizePercent\" (2-98), \"testDurationHours\" (1-27777), \"winnerBy\" (\"opens\", \"clicks\", \"conversions\", \"revenue\"; the last two need the conversion pixel). All three are required and KlickTipp has no default for any of them, so any value here is a choice somebody made; together they settle what share of real recipients gets a test version and for how long. Needs a premium account; omit for a normal newsletter",
      "default": null,
      "properties": {
        "testSizePercent": {
          "type": "integer",
          "minimum": 2,
          "maximum": 98
        },
        "testDurationHours": {
          "type": "integer",
          "minimum": 1,
          "maximum": 27777
        },
        "winnerBy": {
          "type": "string",
          "enum": [
            "opens",
            "clicks",
            "conversions",
            "revenue"
          ]
        }
      },
      "required": [
        "testSizePercent",
        "testDurationHours",
        "winnerBy"
      ],
      "additionalProperties": false
    },
    "emailEditor": {
      "type": [
        "null",
        "string"
      ],
      "description": "Editor the email is created for. Omit it, which means \"drag-and-drop\": that is the editor KlickTipp builds on and the one every content and design tool works with. Pass \"rich-text\" only when the account authors in the previous HTML editor and asked for it. The choice cannot be changed afterwards",
      "default": null,
      "enum": [
        "drag-and-drop",
        "rich-text"
      ]
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account the access token works in",
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "name",
    "subject"
  ],
  "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"
    }
  }
}
```

