Update segment
PATCH /segments/:id — edit a segment’s name or filter.
/segments/:idnamestringoptionalNew name.
filter.statusstringoptionalNew status filter: all, subscribed, unsubscribed, or members_only (matches nobody by filter — the segment resolves to its explicitly added contacts only).
filter.email_containsstring | nulloptionalNew email substring (pass null to clear).
filter.property_filtersarray | nulloptionalReplace the property-filter list (pass null or [] to clear). Each entry: { key, operator, value? }. Keys must be registered via POST /contact-properties.
filter.engagementobject | nulloptionalObject or null. An engagement predicate: { event, campaign_id }, where event is one of clicked, not_clicked, opened, not_opened and campaign_id is required whenever engagement is set. Pass null to clear it.
domain (or audience_id) here returns 422 validation_error.import { Mailblastr } from 'mailblastr';
const mb = new Mailblastr('mb_xxxxxxxxx');
const { data, error } = await mb.segments.update('4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93', { "filter": { "status": "all" } });
console.log({ data, error });Response
Returns the full updated segment object — the same shape as Create segment.
{
"object": "segment",
"id": "4c1f8b2e-9a2f-4d71-8f0c-2b5d7e6a1c93",
"audience_id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
"name": "Gmail subscribers",
"filter": { "status": "all", "email_contains": "@gmail.com", "property_filters": [], "engagement": null },
"created_at": "2026-06-23T10:00:00.000Z",
"updated_at": "2026-06-24T08:15:02.000Z"
}An unknown segment id (or one you do not own) returns 404 not_found. A filter.status outside all, subscribed, unsubscribed, members_only, an unknown property_filters key, or a malformed filter.engagement returns 422 validation_error. See Errors.