segments

Update Segment

Update the name, the definition, or both of an advanced segment. You cannot update a read-only segment. The account's plan must include advanced segmentation. If it does not, the API returns a 403 error. You cannot change list_id or read_only. If a request includes one of them, the API returns a 400 error.

patch/3.0/segments/{segment_id}

Request

Path parameters

segment_idstring required

The unique id for the segment.

Request body

namestring

The name of the segment.

Example request

{
  "definition": {
    "schema_version": 2,
    "contacts": {
      "email": {
        "marketing": [
          {
            "sendable": true
          }
        ]
      }
    },
    "match": "all",
    "conditions": [
      {
        "field": "merge0",
        "op": "contains",
        "value": [
          "yahoo.com"
        ]
      }
    ]
  },
  "name": "Example Segment"
}

Response

created_atstring date-time

The date and time when Mailchimp created the segment, in ISO 8601 format.

definitionobject

The segment definition. Read-only segments do not have a definition, so the response does not include this property for them. It contains the match and conditions that you sent, the current schema_version, and the contacts object. In the contacts object, each entry selects exactly one subscription status. The request body of Add Segment shows all properties of a definition.

idstring uuid

The unique ID of the segment. Do not parse or change this value. Use it exactly as you received it.

list_idstring

The unique ID of the list that contains the segment.

read_onlyboolean

If true, you can read, count, and snapshot the segment, but you cannot update or delete it. Segments that other Mailchimp tools made, for example Google Analytics segments, are read-only. A read-only segment does not have a definition.

namestring

The name of the segment.

Example response

{
  "created_at": "2025-01-15T10:30:00+00:00",
  "id": "0dbaba26-0003-8000-8000-000000000919",
  "list_id": "a1b2c3d4e5",
  "name": "Example Segment"
}

Changes

No recorded changes to this operation across all 1 revision of this API.