> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Create email campaign

> Create email campaign through the Brevo API.

`brevo.createEmailCampaign` create email campaign through the Brevo API.

## Example

```ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { brevo } from "automate.ax/brevo"

export default automation("Create email campaign", () => {
  onDashboardRun({ title: "Create email campaign" })

  brevo.createEmailCampaign({
    name: "Launch",
    sender: { id: 7 },
    subject: "We launched",
    htmlContent: "<p>See what is new.</p>",
  })
})
```

## Inputs and output

Inputs:

```ts theme={null}
{
  name: string
  sender: { id: number; name?: string } | { email: string; name?: string }
  subject?: string
  htmlContent?: string
  htmlUrl?: string
  templateId?: number
  recipients?: {
    listIds?: number[]
    segmentIds?: number[]
    exclusionListIds?: number[]
    exclusionSegmentIds?: number[]
  }
  scheduledAt?: string
  abTesting?: boolean
  subjectA?: string
  subjectB?: string
  splitRule?: number
  winnerCriteria?: "open" | "click"
  winnerDelay?: number
  sendAtBestTime?: boolean
  ipWarmupEnable?: boolean
  initialQuota?: number
  increaseRate?: number
  emailExpirationDate?: { duration: number; unit: "days" | "weeks" | "months" }
  attachmentUrl?: string
  footer?: string
  header?: string
  inlineImageActivation?: boolean
  mirrorActive?: boolean
  params?: Record<string, unknown>
  previewText?: string
  replyTo?: string
  tag?: string
  toField?: string
  unsubscriptionPageId?: string
  updateFormId?: string
  utmCampaign?: string
  utmContent?: string
  utmTerm?: string
}
```

IDs are positive integers; `scheduledAt` is an ISO 8601 timestamp with an offset; email and URL fields must be valid. `splitRule` is 1–50, `winnerDelay` is 1–168 hours, `initialQuota` is at least 2, and `increaseRate` is 0–100. Expiration is limited to 3,600 days, 480 weeks, or 120 months. Optional fields have no implicit default.

Returns `{ id }` for the draft campaign. `name`, `sender`, and one of `htmlContent`, `htmlUrl`, or `templateId` are required. Standard campaigns require `subject`. A/B campaigns require different `subjectA` and `subjectB` values; campaigns with recipients also require `splitRule`, and rules below 50 require `winnerCriteria` and `winnerDelay`. Scheduled campaigns require recipient list or segment IDs. IP warmup requires `initialQuota` of at least 2 and `increaseRate`. Pass `{ account }` as the second argument to select a named Brevo account binding.
