# Update Email Campaign

PUT /api/v2/projects/{projectId}/email-campaigns/{campaignId}

Updates a campaign's settings. Despite the PUT, only the fields present in `changes` are written. Anything omitted keeps its current value. Editing a campaign that has already sent changes future behaviour only; it does not alter or resend emails already delivered.

## Request

- projectId: string, path, required — ID of the project that owns the campaign.
- campaignId: string, path, required — ID of the campaign to update.
- changes: object, required — Fields to change. Anything omitted is left as-is.
  - abTestConfig: object
    - variable: SUBJECT | FROM_NAME | CONTENT | SEND_TIME, required — What differs across variants: subject, from name, content, or send time.
    - samplePaginationEnd: integer — Send cursor at the end of the sample phase. Set by the runtime.
    - samplePercent: number, default 20 — Percent of the audience that receives the sample variants.
    - sendTimeDelayHours: number, default 2 — Delay between sample sends when variable is SEND_TIME.
    - sendTimeDelayUnit: HOURS | MINUTES, default HOURS — Unit for sendTimeDelayHours.
    - status: AWAITING_SAMPLE | AWAITING_WINNER | ROLLED_OUT, default AWAITING_SAMPLE — A/B test phase. Omit on create; the runtime advances this.
    - winnerMessageId: string — Winning message id. Set by the runtime after the test resolves.
    - winnerMetric: OPEN_RATE | CLICK_RATE, default OPEN_RATE — Metric used to pick the winning variant.
    - winnerRolloutAt: string — ISO timestamp when the winner was rolled out to the rest of the list.
    - winnerSelectedAt: string — ISO timestamp when the winner was selected.
    - winnerWaitHours: number, default 4 — How long to wait after the sample before picking a winner.
    - winnerWaitStartedAt: string — ISO timestamp when the winner-wait countdown started.
    - winnerWaitUnit: HOURS | MINUTES, default HOURS — Unit for winnerWaitHours.
  - bcc: stri
…

## Response

- 200: Successful response
  - contactsFilterGroups: object[], required
    - filters: object[], required — Attribute filters combined with groupType.
    - groupType: AND | OR | NOT, required — How filters in this group are combined.
    - oneDayEventFilters: object[] — Event filters evaluated over the last 24 hours only.
    - requireSubscribed: boolean — When true, the group is ANDed with `$subscribed == true`. Set by email sending, not the filter UI.
  - createdAt: string, required
  - id: string, required
  - messages: object[], required
    - bodyHTML: string, required
    - bodyJSON: object, required
    - createdAt: string, required
    - emailCampaignId: string, required
    - fromDomain: string, required
    - fromEmailUsername: string, required
    - fromName: string, required
    - id: string, required
    - label: string, required
    - previewTextHTML: string, required
    - previewTextJSON: object, required
    - projectId: string, required
    - sendCount: integer, required, default 0
    - subjectHTML: string, required
    - subjectJSON: object, required
    - text: string, required
    - theme: object, required
    - updatedAt: string, required
    - bcc: string
    - cc: string
    - lastSuccessContactCreatedAt: string
    - lastSuccessContactId: string
    - replyTo: string
    - scheduledAt: string
    - …
  - name: string, required
  - projectId: string, required
  - sendCount: integer, required, default 0
  - sendPaginationCount: integer, required, default 0
  - status: DRAFT | SCHEDULED | SENDING | SENT | PAUSED | CANCELLED, required
  - type: STANDA
…
