SenderWiz API
HomepagePricingContact UsLoginSignup
  • Introduction
  • API URL and Key
  • Customer
    • Contact List
      • Get All Lists
      • Get One List
      • Create a List
      • Update a List
      • Copy a List
      • Delete a List
    • Fields
      • Get All List Fields
      • Get One List Field
      • Create a List Field
      • Update a List Field
      • Delete a List Field
      • Get All List Field Types
    • Segments
      • Get All List Segments
      • Get One List Segment
      • Get All Subscribers
      • Create a List Segment
      • Update a List Segment
      • Delete a List Segment
      • Get All List Segment Condition Operators
    • Subscribers
      • Get All Subscribers
      • Get One Subscriber
      • Search Subscriber by Email
      • Search by Email in All Lists
      • Search by Custom Fields in a List
      • Search Subscribers by Status
      • Get Blacklisted Subscribers
      • Get Confirmed Subscribers
      • Get Unconfirmed Subscribers
      • Get Unsubscribed Subscribers
      • Create a Subscriber
      • Create Subscribers in Bulk
      • Update a Subscriber
      • Update a Subscriber by Email
      • Create or Update a Subscriber
      • Unsubscribe a Subscriber
      • Unsubscribe a Subscriber by Email
      • Unsubscribe Subscriber from All Lists
      • Delete One Subscriber
      • Delete Subscriber by Email
    • Campaigns
      • Get All Campaigns
      • Get One Campaign
      • Create a Campaign
      • Update a Campaign
      • Copy a Campaign
      • Pause/Unpause a Campaig
      • Mark a Campaign as SENT
      • Delete a Campaign
      • Get Stats of a Campaign
    • Reports
      • Track Subscriber Click for Campaign
      • Track Subscriber Open
      • Track Subscriber Unsubscribe
    • Bounces
      • Get All Bounces
      • Create a Campaign Bounce
    • Countries
      • Get All Countries
      • Get All Zones of a Country
    • Templates
      • Get All Templates
      • Get One Template
      • Search Templates
      • Create a Template
      • Update a Template
      • Delete a Template
    • Subaccounts
      • Get All Subaccounts
      • Create a Subaccount
      • Update a Subaccount
      • Delete a Subaccount
      • Get Subaccount Permissions
      • Update Subaccount Permissions
    • Transactional Emails
      • Get All Transactional Emails
      • Get One Transactional Email
      • Create a Transactional Email
      • Delete a Transactional Email
  • Admin
    • Customer
      • Get All Customers
      • Get One Customer
      • Create a Customer
      • Update a Customer
      • Delete a Customer
      • Get All Customer Groups
      • Get All Timezones
    • Customer Login via Token
    • Customer Task via Admin API
Powered by GitBook
On this page
  1. Customer
  2. Segments

Update a List Segment

Update an existing list segment using new field or campaign conditions. Only the submitted conditions will be retained; any existing ones not included will be removed.

✏️ Update a List Segment

Modify an existing segment of a subscriber list by replacing its conditions, campaign filters, and other attributes.

🔹 HTTP Request

PUT API-URL/lists/LIST-UNIQUE-ID/segments/SEGMENT-UNIQUE-ID

🔸 URL Segments

Segment
Type
Required
Description

LIST-UNIQUE-ID

string

Yes

Unique identifier of the list.

SEGMENT-UNIQUE-ID

string

Yes

Unique identifier of the segment.

🔐 Authorization Header

X-API-KEY: your-api-key-here

🕝 PUT Parameters

Parameter
Type
Required
Description

data

array

Yes

List segment details including name, operator_match, conditions, and campaign_conditions.

📦 General Block (Required)

Parameter
Type
Required
Description

name

string

Yes

Name of the list segment.

operator_match

string

Yes

Match operator: any or all.

📦 Conditions Block (Optional)

Parameter
Type
Required
Description

field_id

string

Yes

ID of the custom field (use Get List Fields API).

operator_id

string

Yes

Condition operator ID (use condition operators API).

value

string

Yes

Value to compare against.

📦 Campaign Conditions Block (Optional)

Parameter
Type
Required
Description

action

string

Yes

Action to filter by: click or open.

campaign_id

integer

Yes

Campaign ID to check behavior against.

time_comparison_operator

string

Yes

Time operator: lte, lt, gte, gt, eq.

time_value

integer

Yes

Time value for comparison.

time_unit

string

Yes

Time unit: day, month, or year.

💻 PHP Example

// update list segment
// Only the conditions present here will be kept. All other existing conditions will be removed
$response = $endpoint->update('LIST-UNIQUE-ID', 'SEGMENT-UNIQUE-ID', [
    // required
    'name'           => 'My list segment created from the API updated', // required
    'operator_match' => 'any', // required (any/all)

    // optional
    'conditions' => [
        [
            'field_id'    => '96', // required
            'operator_id' => '3',  // required (see condition operators endpoint)
            'value'       => 'domain.com', // required
        ],
        [
            'field_id'    => '95',
            'operator_id' => '4',
            'value'       => 'keyword',
        ]
    ],

    'campaign_conditions' => [
        [
            'action'                   => 'click',
            'campaign_id'              => '100',
            'time_comparison_operator' => 'lte',
            'time_value'               => '3',
            'time_unit'                => 'day'
        ],
        [
            'action'                   => 'open',
            'campaign_id'              => '99',
            'time_comparison_operator' => 'gte',
            'time_value'               => '3',
            'time_unit'                => 'month'
        ]
    ],
]);

// and get the response
echo '<pre>';
print_r($response->body);
echo '</pre>';

📦 Sample JSON Response

{
  "status": "success",
  "data": {
    "record": {
      "segment_uid": "sx795qzttl9bb",
      "segment_id": "11",
      "name": "my segment with cond updated",
      "operator_match": "any",
      "date_added": "10/23/23, 2:36 PM",
      "subscribers_count": 0,
      "conditions": [
        {
          "field_id": "96",
          "operator_id": "3",
          "value": "keyword"
        }
      ],
      "campaign_conditions": []
    }
  }
}
PreviousCreate a List SegmentNextDelete a List Segment

Last updated 1 month ago