Creates a draft campaign. Permission: `campaigns`.

Omitted `content` gets a default template with an unsubscribe link. Omitted `senderId` uses the default sender, then last used, then any available sender.

## Body Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| `subject` | string | **Required.** Email subject line. |
| `name` | string | Campaign name. Default `Untitled`. Max 100. |
| `preview` | string or null | Preview / preheader text. |
| `content` | unknown | TipTap JSON (object or string). Default includes an unsubscribe link. |
| `contentType` | `"MAILY"` \| `"PLATE"` \| `"MARKDOWN"` | Content format. Default `MAILY`. |
| `senderId` | string | Email sender id. Defaults to the org default sender. |
| `replyTo` | string or null | Reply-To address. |

## Response Fields

| Field | Type | Description |
| ----- | ---- | ----------- |
| `id` | string | Campaign id. |
| `name` | string | Campaign name. |
| `subject` | string | Subject line. |
| `preview` | string or null | Preview text. |
| `status` | string | Always `DRAFT` on create. |
| `contentType` | string | `MAILY`, `PLATE`, or `MARKDOWN`. |
| `senderId` | string | Assigned sender id. |
| `replyTo` | string or null | Reply-To address. |
| `createdAt` | string | ISO 8601 created timestamp. |

## Errors

| Status | `name` | When |
| ------ | ------ | ---- |
| 401 | `missing_api_key` | Missing or invalid bearer token |
| 403 | `missing_permission` | Token lacks the `campaigns` permission |
| 422 | `validation_error` | Missing subject or invalid payload |

## Related

- [Get Campaign](/docs/api-reference/v2/campaigns-get)
- [Send Campaign](/docs/api-reference/v2/campaigns-send)
- [SDK: lumail.campaigns.create](/docs/sdk/v2/campaigns-create)


## API Reference
**Method:** POST
**Endpoint:** /api/v2/campaigns

### SDK
```ts
import { Lumail } from "lumail";

const lumail = new Lumail({ apiKey: process.env.LUMAIL_API_KEY });
const { data, error } = await lumail.campaigns.create({
  name: "Launch",
  subject: "Hello",
});
if (error) {
  throw error;
}
console.log(data.id);
```

### cURL
```bash
curl -X POST https://lumail.io/api/v2/campaigns \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Launch","subject":"Hello"}'
```

### JavaScript
```javascript
const response = await fetch("https://lumail.io/api/v2/campaigns", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ name: "Launch", subject: "Hello" }),
});
const data = await response.json();
```

### Success Response
```json
{
  "id": "cmp_abc123",
  "name": "Launch",
  "subject": "Hello",
  "preview": null,
  "status": "DRAFT",
  "contentType": "MAILY",
  "senderId": "snd_abc123",
  "replyTo": null,
  "createdAt": "2026-09-05T10:30:00.000Z"
}
```

### Error Response
```json
{
  "name": "validation_error",
  "message": "Email subject line is required",
  "statusCode": 422
}
```
