---
title: "Create or prepare a campaign (frozen draft)"
method: POST
path: "/campaigns"
tags: ["campaigns"]
---

# Create or prepare a campaign (frozen draft)

`POST /campaigns`

## Request

- Base URL: `https://api.mailly.site` (the document declares no server; this is the origin it was published from)
- URL: `https://api.mailly.site/campaigns`
- Auth: HTTP bearer

Idempotent by campaignKey: an existing campaign must have identical content (otherwise 409). Marketing campaigns need the marketing footer configured first. Providing `audience` freezes an audience snapshot.

## Request body

- object
  - `campaignKey` string
  - `name` string
  - `emailType` 'transactional' | 'lifecycle' | 'marketing': Default marketing
  - `senderEmail` string
  - `fromName` string
  - `replyTo` string
  - `topic` string
  - `subject` string
  - `html` string
  - `text` string
  - `frequencyCapDays` number
  - `frequencyCapMax` number
  - `topicExclusionDays` number
  - `recipientReason` string
  - `templateKey` string
  - `templateVersion` number
  - `audienceDefinition` unknown
  - `audience` object: Frozen audience selection
  - `sourceApp` string
  - `utm` object
  - `businessGoal` string

## Response `201`

Created

- object
  - `success` boolean, required
  - `campaign` object, required
  - `audienceSnapshot` object, nullable, required

## Other responses

- `400`: Invalid parameters
- `401`: Missing or invalid API key
- `402`: Insufficient balance
- `404`: Campaign not found
- `409`: campaignKey conflict

---

[API](https://skmtc.dev/mailly/apis/mailly-api.md) · [All operations](https://skmtc.dev/mailly/apis/mailly-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mailly/apis/mailly-api/revisions/1ceb29637301?raw)
