---
title: "Create a draft campaign"
slug: "create-a-draft-campaign"
abstract: "Describes the request and response details of this Sitecore Send API endpoint to create a draft campaign."
---
# Create a draft campaign

`POST /campaigns/create.{Format}`

Creates a new draft campaign in your account that is ready for sending or testing. You can create either a regular campaign or an A/B split campaign. The campaign content must be specified from a web location or by pasting the complete HTML body of your campaign. If you are creating a regular campaign, you can ignore the A/B split campaign parameters.

## Request

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| Accept | header | string | true | Determines the expected format and data type to retrieve the response data.Value: application/json |
| Format | path | string | true | The supported file format for getting a response.Possible values: json and xml |
| apikey | query | string | true | The API key of your account. |
| Name | body | string | true | The name of the campaign. |
| CampaignType | body | string | false | The campaign type: Regular or Transactional. |
| Subject | body | string | true | The subject line of the campaign. |
| SenderEmail | body | string | true | The email address of the campaign sender. |
| ReplyToEmail | body | string | true | The email address selected to receive replies from the campaign. This must be one of your campaign senders. If not specified, the SenderEmail is assumed. |
| ConfirmationToEmail | body | string | false | The email address used to send a confirmation message when the campaign has been successfully sent. This can be any valid email address. If not specified, the SenderEmail is assumed. |
| HTMLContent | body | string | false | The complete HTML body of the campaign. You can use this parameter instead of using the WebLocation parameter. |
| WebLocation | body | string | false | The URL used to retrieve the HTML content of the campaign. Sitecore Send automatically moves all CSS inline. |
| MailingLists | body | array | false | A list of email lists in your account that is used to send the campaign. |
| SegmentID | body | string | false | The ID of a segment in the selected email list. If not specified, the campaign is sent to all active subscribers of the email list. |
| IsAB | body | Boolean | true | A flag that defines if a campaign is an A/B split campaign. If true, you must fill out A/B split campaign parameters. |
| TrackInGoogleAnalytics | body | Boolean | false | Specifies if tracking is enabled for the campaign. You must have Google Analytics configured on your site to use this feature. |

### A/B split campaign parameters

Use these parameters when creating an A/B split campaign. If you specify any of the parameters below when creating a regular campaign, they are ignored in the request.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| ABCampaignType | body | string | true | Specify the type of test to be performed in the AB split campaign to determine the winning version:Subjectline - test two different versions of the subject line.Content - test two different versions of the campaign content.Sender - test two different versions of the campaign sender. |
| SubjectB | body | string | false | If testing A/B split campaigns with two subject line versions, this is the second subject version of the subject. |
| HTMLContentB | body | string | false | If testing A/B split campaigns with two HTML content versions, this is the complete HTML body of the second version. |
| WebLocationB | body | string | false | If testing A/B split campaigns with two HTML content versions, this is the web location of the second HTML content version. |
| SenderEmailB | body | string | false | If testing A/B split campaigns with two sender versions, this is the email address of the second campaign sender. This must be one of the senders defined in your account. |
| HoursToTest | body | integer | false | Specify how long the test runs, before determining the winning campaign version to be sent to the rest of the recipients.This must be an integer between 1 and 24. |
| ListPercentage | body | integer | false | Specifies a portion of the target recipients to get the test campaign versions. For example, if you specify 10, then 10% of your recipients receive campaign A and another 10% receive the campaign B version.This must be an integer between 5 and 40. |
| ABWinnerSelectionType | body | string | false | Specifies the method to determine the winning version for the test. If not set, OpenRate is assumed.OpenRate - determine the winner based on the version that achieved more opens.TotalUniqueClicks - determine the winner based on the version that achieved more unique link clicks. |

```http
POST https://{hostname}/v3/campaigns/create.{Format}?apikey=

Request body:
{
    "Name": "Create a regular campaign with A/B",
    "CampaignType": "Transactional",
    "Subject": "Create a regular campaign with A/B",
    "SenderEmail": "example@test.com",
    "ReplyToEmail": "example@test.com",
    "ConfirmationToEmail": "",
    "HTMLContent": "Some HTML body",
    "MailingLists": \[
        {
            "MailingListID": "adaf2fe1-55db-42dc-aaf8-xxxxxxxx",
            "SegmentID": "xxxxx"
        },
        {
            "MailingListID": "dce99b7a-2619-4805-aaeb-xxxxxxxxxxx"
        }
    \],
    "IsAB": "true",
    "ABCampaignType": "Content",
    "WebLocationB": "http://www.mysite.gr/newsletter/index",
    "HoursToTest": "2",
    "ListPercentage": "20",
    "ABWinnerSelectionType": "OpenRate"
}
```

```curl
curl --location \\
     --request POST \\
     --header "Content-Type: application/json" \\
     --header "Accept: application/json" \\
     --data-raw '{
    "Name": "Create a regular campaign with A/B",
    "CampaignType": "Transactional",
    "Subject": "Create a regular campaign with A/B",
    "SenderEmail": "example@test.com",
    "ReplyToEmail": "example@test.com",
    "ConfirmationToEmail": "",
    "HTMLContent": "Some HTML body",
    "MailingLists": \[
        {
            "MailingListID": "adaf2fe1-55db-42dc-aaf8-xxxxxxxx",
            "SegmentID": "xxxxx"
        },
        {
            "MailingListID": "dce99b7a-2619-4805-aaeb-xxxxxxxxxxx"
        }
    \],
    "IsAB": "true",
    "ABCampaignType": "Content",
    "WebLocationB": "http://www.mysite.gr/newsletter/index",
    "HoursToTest": "2",
    "ListPercentage": "20",
    "ABWinnerSelectionType": "OpenRate"
}' \\
'https://{hostname}/v3/campaigns/create.{Format}?apikey='
```

## Response

| Status | Description | Headers | Schema |
| --- | --- | --- | --- |
| 200 OK | The request is successful. | Content-Type:application/jsonAccept:application/json | N/A |

```json
{
  "Code": 0,
  "Error": null,
  "Context": "afdc4ef6-999f-4d74-905b-ec234789f9d6"
}
```

-   `Code` - the response code. This is `0` if successful.
    
-   `Error` - the response error message. This is `null` if successful.
    
-   `Context` - the ID of the campaign created.