# Schedule Campaign

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

Schedule or start an email campaign. The campaign must be in draft, cancelled, or paused status.

## 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}/schedule": {
      "post": {
        "summary": "Schedule Campaign",
        "operationId": "scheduleCampaign",
        "description": "Schedule or start an email campaign. The campaign must be in draft, cancelled, or paused status.",
        "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/ScheduleCampaignPublicV2BodyDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleCampaignPublicV2ResponseDto"
                }
              }
            }
          },
          "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 - Campaign is already scheduled or being processed"
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "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": {
      "ScheduleCampaignPublicV2BodyDto": {
        "type": "object",
        "properties": {
          "scheduleType": {
            "type": "string",
            "description": "How to schedule the campaign",
            "enum": [
              "immediate",
              "scheduled",
              "batch",
              "rss",
              "smart_send"
            ],
            "example": "immediate"
          },
          "timeZone": {
            "type": "string",
            "description": "IANA timezone",
            "example": "America/New_York"
          },
          "userId": {
            "type": "string",
            "description": "ID of the user performing this action",
            "example": "507f1f77bcf86cd799439099"
          },
          "userName": {
            "type": "string",
            "description": "Name of the user performing this action",
            "example": "John Doe"
          },
          "emailMeta": {
            "description": "Email subject, sender, and content metadata",
            "example": {
              "subject": "Our February Newsletter",
              "fromName": "John Doe",
              "fromEmail": "john@example.com"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "string",
                    "description": "Email subject line",
                    "example": "Our February Newsletter"
                  },
                  "fromName": {
                    "type": "string",
                    "description": "Sender display name",
                    "example": "John Doe"
                  },
                  "fromEmail": {
                    "type": "string",
                    "description": "Sender email address",
                    "example": "john@example.com"
                  },
                  "replyToAddress": {
                    "type": "string",
                    "description": "Reply-to email address",
                    "example": "reply@example.com"
                  },
                  "previewText": {
                    "type": "string",
                    "description": "Preview text shown in inbox after subject",
                    "example": "Check out our latest news"
                  },
                  "attachments": {
                    "description": "Attachment download URLs",
                    "example": [
                      "https://example.com/file.pdf"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "subject",
                  "fromName",
                  "fromEmail"
                ],
                "title": "ScheduleCampaignEmailMetaPublicV2Dto"
              }
            ]
          },
          "recipients": {
            "description": "Who receives the email. Must provide either contactIds or filter.",
            "example": {
              "type": "contact",
              "contactIds": [
                "contactId1",
                "contactId2"
              ]
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "Recipient selection type",
                    "enum": [
                      "contact",
                      "tag",
                      "segment"
                    ],
                    "example": "contact"
                  },
                  "contactIds": {
                    "description": "Contact IDs to send to. Required when type is contact.",
                    "example": [
                      "contactId1",
                      "contactId2"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tagIds": {
                    "description": "Tag IDs to filter recipients by. Required when type is tag.",
                    "example": [
                      "tagId1",
                      "tagId2"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "segment": {
                    "type": "string",
                    "description": "Segment type for pre-built segments. Required when type is segment.",
                    "enum": [
                      "engaged_last_7_days",
                      "engaged_last_30_days",
                      "engaged_last_60_days",
                      "engaged_last_5_campaigns",
                      "unengaged_last_5_campaigns"
                    ],
                    "example": "engaged_last_7_days"
                  },
                  "freezeList": {
                    "type": "boolean",
                    "description": "Freeze the contact list at schedule time — new matching contacts will not be added later",
                    "example": true,
                    "default": true
                  }
                },
                "required": [
                  "type"
                ],
                "title": "ScheduleCampaignRecipientsPublicV2Dto"
              }
            ]
          },
          "sendDays": {
            "type": "array",
            "description": "Days of the week to allow sending. Used for batch and RSS scheduleTypes.",
            "example": [
              "Mon",
              "Tue",
              "Wed",
              "Thu",
              "Fri",
              "Sat",
              "Sun"
            ],
            "items": {
              "type": "string",
              "enum": [
                "Mon",
                "Tue",
                "Wed",
                "Thu",
                "Fri",
                "Sat",
                "Sun"
              ]
            }
          },
          "scheduleConfig": {
            "description": "Schedule configuration for immediate, scheduled, batch, and smart_send types. Required when scheduleType is not rss.",
            "example": {
              "sendAt": "2026-04-01 09:00 AM"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "sendAt": {
                    "type": "string",
                    "description": "Date/time to send. Required for scheduled, batch, and smart_send. Ignored for immediate.",
                    "example": "2026-04-01 09:00 AM"
                  },
                  "batch": {
                    "description": "Batch/drip configuration. Required when scheduleType is batch. Ignored otherwise.",
                    "example": {
                      "batchSize": 100,
                      "interval": 2,
                      "intervalUnit": "hours"
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "batchSize": {
                            "type": "number",
                            "description": "Number of contacts to process per batch",
                            "example": 100
                          },
                          "interval": {
                            "type": "number",
                            "description": "Delay between batches",
                            "example": 2
                          },
                          "intervalUnit": {
                            "type": "string",
                            "description": "Unit for the interval",
                            "example": "hours",
                            "enum": [
                              "minutes",
                              "hours",
                              "days"
                            ]
                          },
                          "skipDays": {
                            "type": "array",
                            "description": "Days to skip sending",
                            "example": [
                              "Sat",
                              "Sun"
                            ],
                            "items": {
                              "type": "string",
                              "enum": [
                                "Mon",
                                "Tue",
                                "Wed",
                                "Thu",
                                "Fri",
                                "Sat",
                                "Sun"
                              ]
                            }
                          },
                          "windowStart": {
                            "type": "string",
                            "description": "Earliest time to send batches",
                            "example": "09:00 AM"
                          },
                          "windowEnd": {
                            "type": "string",
                            "description": "Latest time to send batches",
                            "example": "05:00 PM"
                          }
                        },
                        "required": [
                          "batchSize",
                          "interval",
                          "intervalUnit"
                        ],
                        "title": "ScheduleCampaignBatchConfigPublicV2Dto"
                      }
                    ]
                  },
                  "tracking": {
                    "description": "Click and UTM tracking options",
                    "example": {
                      "clickTracking": true,
                      "utmTracking": false
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "clickTracking": {
                            "type": "boolean",
                            "description": "Enable click tracking on links",
                            "example": true
                          },
                          "utmTracking": {
                            "type": "boolean",
                            "description": "Enable UTM parameters on links",
                            "example": false
                          }
                        },
                        "title": "ScheduleCampaignTrackingPublicV2Dto"
                      }
                    ]
                  },
                  "resend": {
                    "description": "Auto-resend to contacts who did not open",
                    "example": {
                      "enabled": false
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "description": "Enable resend to contacts who did not open",
                            "example": false
                          },
                          "waitHours": {
                            "type": "number",
                            "description": "Hours to wait before resending. Required when enabled is true.",
                            "example": 12
                          },
                          "subject": {
                            "type": "string",
                            "description": "Override subject line for the resend email",
                            "example": "Did you miss this?"
                          }
                        },
                        "title": "ScheduleCampaignResendPublicV2Dto"
                      }
                    ]
                  },
                  "emailPreferenceId": {
                    "type": "string",
                    "description": "Email preference type ID for categorizing this campaign",
                    "example": "preference-type-id"
                  }
                },
                "title": "ScheduleCampaignScheduleConfigPublicV2Dto"
              }
            ]
          },
          "rssConfig": {
            "description": "RSS feed configuration. Required when scheduleType is rss.",
            "example": {
              "name": "Weekly Digest",
              "rssFeedURL": "https://example.com/rss",
              "repeatAfter": "every_day",
              "repeatAfterTime": "09:00 AM"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "RSS schedule name",
                    "example": "Weekly Digest"
                  },
                  "rssFeedURL": {
                    "type": "string",
                    "description": "RSS feed URL",
                    "example": "https://example.com/rss"
                  },
                  "repeatAfter": {
                    "type": "string",
                    "description": "How often to check the feed",
                    "example": "every_day",
                    "enum": [
                      "every_day",
                      "every_week",
                      "every_month"
                    ]
                  },
                  "repeatAfterTime": {
                    "type": "string",
                    "description": "Time of day to execute",
                    "example": "09:00 AM"
                  },
                  "rssFeedLimit": {
                    "type": "number",
                    "description": "Max number of RSS items per email",
                    "example": 10
                  },
                  "startAtDay": {
                    "type": "string",
                    "description": "Day of week for weekly RSS",
                    "enum": [
                      "Monday",
                      "Tuesday",
                      "Wednesday",
                      "Thursday",
                      "Friday",
                      "Saturday",
                      "Sunday"
                    ],
                    "example": "Monday"
                  },
                  "startAtMonthDay": {
                    "type": "string",
                    "description": "Day of month for monthly RSS",
                    "example": "15"
                  },
                  "firstExecutionDate": {
                    "type": "string",
                    "description": "Override first execution date/time",
                    "example": "2026-04-01 10:00:00"
                  }
                },
                "required": [
                  "name",
                  "rssFeedURL",
                  "repeatAfter",
                  "repeatAfterTime"
                ],
                "title": "ScheduleCampaignRssConfigPublicV2Dto"
              }
            ]
          },
          "abTestConfig": {
            "description": "A/B test configuration. Can be combined with any scheduleType except rss.",
            "example": {
              "testType": "subjectLine",
              "testDuration": 3600,
              "variationCount": 2,
              "testSize": 30,
              "winningCriteria": "openRate",
              "variations": [
                {
                  "subject": "Subject A"
                },
                {
                  "subject": "Subject B"
                }
              ]
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "testType": {
                    "type": "string",
                    "description": "What is being tested",
                    "enum": [
                      "emailContent",
                      "subjectLine"
                    ],
                    "example": "subjectLine"
                  },
                  "testDuration": {
                    "type": "number",
                    "description": "Seconds to run the test before picking a winner",
                    "example": 3600
                  },
                  "variationCount": {
                    "type": "number",
                    "description": "Number of variations",
                    "example": 2
                  },
                  "testSize": {
                    "type": "number",
                    "description": "Percentage of contacts in the test group (0-100)",
                    "example": 30
                  },
                  "winningCriteria": {
                    "type": "string",
                    "description": "How to pick the winner",
                    "enum": [
                      "openRate",
                      "clickRate"
                    ],
                    "example": "openRate"
                  },
                  "variations": {
                    "description": "A/B test variations",
                    "example": [
                      {
                        "subject": "Subject A"
                      },
                      {
                        "subject": "Subject B"
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "subject": {
                          "type": "string",
                          "description": "Subject line for this variation",
                          "example": "Subject A"
                        },
                        "documentId": {
                          "type": "string",
                          "description": "Template/document ID for this variation",
                          "example": "507f1f77bcf86cd799439011"
                        }
                      },
                      "title": "ScheduleCampaignABTestVariationPublicV2Dto"
                    }
                  }
                },
                "required": [
                  "testType",
                  "testDuration",
                  "variationCount",
                  "testSize",
                  "winningCriteria",
                  "variations"
                ],
                "title": "ScheduleCampaignABTestConfigPublicV2Dto"
              }
            ]
          }
        },
        "required": [
          "scheduleType",
          "timeZone",
          "userId",
          "emailMeta",
          "recipients"
        ],
        "title": "ScheduleCampaignPublicV2BodyDto"
      },
      "ScheduleCampaignPublicV2ResponseDto": {
        "type": "object",
        "properties": {
          "campaignId": {
            "type": "string",
            "description": "Campaign ID",
            "example": "67f15c2ae99226d5bcccb8f3"
          },
          "sourceId": {
            "type": "string",
            "description": "Source ID for fetching campaign statistics",
            "example": "B67vyPIAfq3Bnk3FVioE",
            "nullable": true
          },
          "traceId": {
            "type": "string",
            "description": "Trace ID of the request",
            "example": "019e4ef5-a65e-4198-8cf9-8e93dca9bda4"
          }
        },
        "required": [
          "campaignId",
          "sourceId"
        ],
        "title": "ScheduleCampaignPublicV2ResponseDto"
      },
      "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"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>/schedule' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "scheduleType": "immediate",
  "timeZone": "America/New_York",
  "userId": "507f1f77bcf86cd799439099",
  "userName": "John Doe",
  "emailMeta": {
    "subject": "Our February Newsletter",
    "fromName": "John Doe",
    "fromEmail": "john@example.com"
  },
  "recipients": {
    "type": "contact",
    "contactIds": [
      "contactId1",
      "contactId2"
    ]
  },
  "sendDays": [
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
    "Sun"
  ],
  "scheduleConfig": {
    "sendAt": "2026-04-01 09:00 AM"
  },
  "rssConfig": {
    "name": "Weekly Digest",
    "rssFeedURL": "https://example.com/rss",
    "repeatAfter": "every_day",
    "repeatAfterTime": "09:00 AM"
  },
  "abTestConfig": {
    "testType": "subjectLine",
    "testDuration": 3600,
    "variationCount": 2,
    "testSize": 30,
    "winningCriteria": "openRate",
    "variations": [
      {
        "subject": "Subject A"
      },
      {
        "subject": "Subject B"
      }
    ]
  }
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "scheduleType": "immediate",
      "timeZone": "America/New_York",
      "userId": "507f1f77bcf86cd799439099",
      "userName": "John Doe",
      "emailMeta": {
        "subject": "Our February Newsletter",
        "fromName": "John Doe",
        "fromEmail": "john@example.com"
      },
      "recipients": {
        "type": "contact",
        "contactIds": [
          "contactId1",
          "contactId2"
        ]
      },
      "sendDays": [
        "Mon",
        "Tue",
        "Wed",
        "Thu",
        "Fri",
        "Sat",
        "Sun"
      ],
      "scheduleConfig": {
        "sendAt": "2026-04-01 09:00 AM"
      },
      "rssConfig": {
        "name": "Weekly Digest",
        "rssFeedURL": "https://example.com/rss",
        "repeatAfter": "every_day",
        "repeatAfterTime": "09:00 AM"
      },
      "abTestConfig": {
        "testType": "subjectLine",
        "testDuration": 3600,
        "variationCount": 2,
        "testSize": 30,
        "winningCriteria": "openRate",
        "variations": [
          {
            "subject": "Subject A"
          },
          {
            "subject": "Subject B"
          }
        ]
      }
  })
};

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

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

payload = {
    "scheduleType": "immediate",
    "timeZone": "America/New_York",
    "userId": "507f1f77bcf86cd799439099",
    "userName": "John Doe",
    "emailMeta": {
        "subject": "Our February Newsletter",
        "fromName": "John Doe",
        "fromEmail": "john@example.com"
    },
    "recipients": {
        "type": "contact",
        "contactIds": [
            "contactId1",
            "contactId2"
        ]
    },
    "sendDays": [
        "Mon",
        "Tue",
        "Wed",
        "Thu",
        "Fri",
        "Sat",
        "Sun"
    ],
    "scheduleConfig": {
        "sendAt": "2026-04-01 09:00 AM"
    },
    "rssConfig": {
        "name": "Weekly Digest",
        "rssFeedURL": "https://example.com/rss",
        "repeatAfter": "every_day",
        "repeatAfterTime": "09:00 AM"
    },
    "abTestConfig": {
        "testType": "subjectLine",
        "testDuration": 3600,
        "variationCount": 2,
        "testSize": 30,
        "winningCriteria": "openRate",
        "variations": [
            {
                "subject": "Subject A"
            },
            {
                "subject": "Subject B"
            }
        ]
    }
}

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>/schedule',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "scheduleType": "immediate",
  "timeZone": "America/New_York",
  "userId": "507f1f77bcf86cd799439099",
  "userName": "John Doe",
  "emailMeta": {
    "subject": "Our February Newsletter",
    "fromName": "John Doe",
    "fromEmail": "john@example.com"
  },
  "recipients": {
    "type": "contact",
    "contactIds": [
      "contactId1",
      "contactId2"
    ]
  },
  "sendDays": [
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
    "Sun"
  ],
  "scheduleConfig": {
    "sendAt": "2026-04-01 09:00 AM"
  },
  "rssConfig": {
    "name": "Weekly Digest",
    "rssFeedURL": "https://example.com/rss",
    "repeatAfter": "every_day",
    "repeatAfterTime": "09:00 AM"
  },
  "abTestConfig": {
    "testType": "subjectLine",
    "testDuration": 3600,
    "variationCount": 2,
    "testSize": 30,
    "winningCriteria": "openRate",
    "variations": [
      {
        "subject": "Subject A"
      },
      {
        "subject": "Subject B"
      }
    ]
  }
}',
]);

$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>/schedule")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"scheduleType\":\"immediate\",\"timeZone\":\"America/New_York\",\"userId\":\"507f1f77bcf86cd799439099\",\"userName\":\"John Doe\",\"emailMeta\":{\"subject\":\"Our February Newsletter\",\"fromName\":\"John Doe\",\"fromEmail\":\"john@example.com\"},\"recipients\":{\"type\":\"contact\",\"contactIds\":[\"contactId1\",\"contactId2\"]},\"sendDays\":[\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\",\"Sun\"],\"scheduleConfig\":{\"sendAt\":\"2026-04-01 09:00 AM\"},\"rssConfig\":{\"name\":\"Weekly Digest\",\"rssFeedURL\":\"https://example.com/rss\",\"repeatAfter\":\"every_day\",\"repeatAfterTime\":\"09:00 AM\"},\"abTestConfig\":{\"testType\":\"subjectLine\",\"testDuration\":3600,\"variationCount\":2,\"testSize\":30,\"winningCriteria\":\"openRate\",\"variations\":[{\"subject\":\"Subject A\"},{\"subject\":\"Subject B\"}]}}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/emails/locations/<locationId>/campaigns/emails/<campaignId>/schedule"
  payload := strings.NewReader(`{
  "scheduleType": "immediate",
  "timeZone": "America/New_York",
  "userId": "507f1f77bcf86cd799439099",
  "userName": "John Doe",
  "emailMeta": {
    "subject": "Our February Newsletter",
    "fromName": "John Doe",
    "fromEmail": "john@example.com"
  },
  "recipients": {
    "type": "contact",
    "contactIds": [
      "contactId1",
      "contactId2"
    ]
  },
  "sendDays": [
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
    "Sun"
  ],
  "scheduleConfig": {
    "sendAt": "2026-04-01 09:00 AM"
  },
  "rssConfig": {
    "name": "Weekly Digest",
    "rssFeedURL": "https://example.com/rss",
    "repeatAfter": "every_day",
    "repeatAfterTime": "09:00 AM"
  },
  "abTestConfig": {
    "testType": "subjectLine",
    "testDuration": 3600,
    "variationCount": 2,
    "testSize": 30,
    "winningCriteria": "openRate",
    "variations": [
      {
        "subject": "Subject A"
      },
      {
        "subject": "Subject B"
      }
    ]
  }
}`)
  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>/schedule")

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 = '{
  "scheduleType": "immediate",
  "timeZone": "America/New_York",
  "userId": "507f1f77bcf86cd799439099",
  "userName": "John Doe",
  "emailMeta": {
    "subject": "Our February Newsletter",
    "fromName": "John Doe",
    "fromEmail": "john@example.com"
  },
  "recipients": {
    "type": "contact",
    "contactIds": [
      "contactId1",
      "contactId2"
    ]
  },
  "sendDays": [
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
    "Sun"
  ],
  "scheduleConfig": {
    "sendAt": "2026-04-01 09:00 AM"
  },
  "rssConfig": {
    "name": "Weekly Digest",
    "rssFeedURL": "https://example.com/rss",
    "repeatAfter": "every_day",
    "repeatAfterTime": "09:00 AM"
  },
  "abTestConfig": {
    "testType": "subjectLine",
    "testDuration": 3600,
    "variationCount": 2,
    "testSize": 30,
    "winningCriteria": "openRate",
    "variations": [
      {
        "subject": "Subject A"
      },
      {
        "subject": "Subject B"
      }
    ]
  }
}'

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

**PowerShell**

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

$body = '{
  "scheduleType": "immediate",
  "timeZone": "America/New_York",
  "userId": "507f1f77bcf86cd799439099",
  "userName": "John Doe",
  "emailMeta": {
    "subject": "Our February Newsletter",
    "fromName": "John Doe",
    "fromEmail": "john@example.com"
  },
  "recipients": {
    "type": "contact",
    "contactIds": [
      "contactId1",
      "contactId2"
    ]
  },
  "sendDays": [
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
    "Sun"
  ],
  "scheduleConfig": {
    "sendAt": "2026-04-01 09:00 AM"
  },
  "rssConfig": {
    "name": "Weekly Digest",
    "rssFeedURL": "https://example.com/rss",
    "repeatAfter": "every_day",
    "repeatAfterTime": "09:00 AM"
  },
  "abTestConfig": {
    "testType": "subjectLine",
    "testDuration": 3600,
    "variationCount": 2,
    "testSize": 30,
    "winningCriteria": "openRate",
    "variations": [
      {
        "subject": "Subject A"
      },
      {
        "subject": "Subject B"
      }
    ]
  }
}'

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