Manage Campaigns
Create, read, update, and manage email campaigns using the API. Browse available email templates to use as starting points.Goal
By the end of this guide you will be able to list campaigns, retrieve campaign details, create new campaigns, update campaign settings, duplicate campaigns, delete campaigns, and browse email templates.Prerequisites
- An API key with
campaigns:writescope (for full CRUD) orcampaigns:readscope (for read-only access) - Your API base URL (found on the Settings > API Keys page)
- At least one contact list and a verified sending domain (for creating campaigns)
Steps
1. List campaigns
Retrieve campaigns with optional filtering by status, pagination, and sorting.200 OK):
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number (1-indexed) |
size | integer | Results per page |
statuses | string | Filter by status: draft, scheduled, sent, sending, paused, failed, cancelled |
sort | string | Sort field and direction, e.g. name:asc, createdAt:desc, updatedAt:desc, scheduledAt:desc |
criteria | string | Search filter text to match campaign names |
2. Get a campaign by ID
200 OK):
3. Create a campaign
Create a new draft campaign. At minimum, provide a name. Other fields like subject, from address, and body can be set during creation or added later via update.200 OK):
| Field | Type | Description |
|---|---|---|
name | string | Campaign name (for internal reference) |
from | string | Sender email address (must be from a verified domain) |
fromName | string | Sender display name (max 100 characters) |
subject | string | Email subject line |
previewText | string | Preview text shown in inbox (max 100 characters) |
body | string | HTML email body |
plainTextBody | string | Plain text version of the email |
replyToAddresses | array | Reply-to email addresses |
contactStructureId | string | Contact structure for recipient selection |
lists | array | List IDs to send to |
allowDuplicates | boolean | Allow creating a campaign with a duplicate name (default: false) |
4. Update a campaign
Update an existing draft campaign. Include the__v version field for optimistic concurrency control.
200 OK):
5. Duplicate a campaign
Create a copy of an existing campaign. Useful for creating variations or reusing a previous campaign as a template.200 OK):
draft status regardless of the original campaign’s status.
6. Delete a campaign
204 No Content): Empty body.
7. Browse email templates
List available email templates to use as starting points for your campaigns. Templates are read-only via API key.200 OK):
Common Errors
| Status | Error | Cause | Fix |
|---|---|---|---|
401 | UnauthorizedError | Invalid or inactive API key | Verify your key in Settings > API Keys |
403 | ForbiddenError — missing scope | Key lacks campaigns:write or campaigns:read scope | Create or upgrade your key with the required scope |
403 | ForbiddenError — send blocked | Attempted to schedule, cancel, or test-send via API key | These operations are not available via API key. Use the web application |
400 | ValidationError | Invalid campaign data (e.g., unverified from address) | Check the request body. The from address must belong to a verified domain |
404 | RecordNotFound | Campaign ID does not exist | Verify the campaign ID |
400 | DuplicateFieldError | Duplicate campaign name | Set allowDuplicates: true in the request body, or use a unique name |
429 | TooManyRequestsError | Rate limit exceeded | Wait for the Retry-After period. See Rate Limits |
Next Steps
- View Reports — check performance metrics for sent campaigns
- Manage Lists — create and manage the lists your campaigns send to
- Manage Contacts — manage the contacts on those lists
- Migration from Legacy — set up your complete email program via API