Update campaign
PATCH /campaigns/:id — edit a draft campaign.
/campaigns/:idPartially updates a campaign. Only a draft can be edited — any other status (scheduled, queued, paused, recurring, canceled, sent or failed) returns a validation_error. Send only the fields you want to change.
idstringrequiredThe ID of the campaign you want to update.
domainstringoptionalRe-point the campaign at another sending domain’s contacts (draft only). Must be one of your domains. Changing the domain automatically clears segment_id and topic_id unless new values are provided in the same request. Passing audience_id is no longer accepted.
fromstringoptionalSender address on a verified domain.
subjectstringoptionalSubject line.
reply_tostring | string[]optionalReply-To address. For multiple addresses, send an array of strings.
htmlstringoptionalHTML body.
textstringoptionalPlain-text body. If omitted, a plain-text version is generated from the HTML; set it to an empty string to opt out.
namestringoptionalThe friendly name of the campaign. Only used for internal reference.
preview_textstring | nulloptionalInbox preview text shown after the subject line (max 150 characters; supports merge tags). Pass null to clear.
segment_idstring | nulloptionalRe-target a segment. Pass null to remove the segment filter. The segment must belong to the same domain.
topic_idstring | nulloptionalRe-target a topic gate. Pass null to remove it.
schedule_timezonestring | nulloptionalIANA timezone name (e.g. America/New_York) the campaign’s scheduled_at wall-clock time is interpreted in — also the zone daily batches roll over in. A scheduled_at that already carries a UTC offset (e.g. a trailing Z) is used as-is. Pass null to clear (batch rollover then falls back to your account timezone; an offset-less scheduled_at is read as UTC).
daily_batch_sizenumber | nulloptionalSend to at most this many recipients per day — an integer between 1 and 100000. Delivery continues the next day at the same local time until every contact is reached. Pass null to send to everyone at once.
import { Mailblastr } from 'mailblastr';
const mb = new Mailblastr('mb_xxxxxxxxx');
const { data, error } = await mb.campaigns.update('8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90', { "subject": "Updated subject" });
console.log({ data, error });Response
{
"id": "8f5c2a1e-7b3d-4f9a-9c12-2e6d4a7b8c90"
}not_found if the campaign is not yours; validation_error if it is not a draft, domain does not reference one of your domains, or audience_id is passed (no longer accepted).