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

Create a List Segment

Create a new list segment using custom field conditions, campaign behavior filters, or both. Ideal for targeting subscribers with highly specific criteria for campaigns or automation workflows.

➕ Create a List Segment

Create a new segment for a subscriber list based on field conditions, campaign behavior, or a combination of both.

🔹 HTTP Request

POST API-URL/lists/LIST-UNIQUE-ID/segments

🔸 URL Segments

Segment
Required
Description

LIST-UNIQUE-ID

Yes

Unique identifier of the list.

🔐 Authorization Header

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

📝 POST 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

// create a new list segment
$response = $endpoint->create('LIST-UNIQUE-ID', [
    // required
    'name'           => 'API Test List segment', // required
    'operator_match' => 'any', // required (any/all)

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

    'campaign_conditions' => [
        [
            'action'                   => 'click', // required (click/open)
            'campaign_id'              => '11',   // required
            'time_comparison_operator' => 'lte',   // required (lte/lt/gte/gt/eq)
            'time_value'               => '3',     // required
            'time_unit'                => 'day'    // required (day/month/year)
        ],
        [
            'action'                   => 'open',
            'campaign_id'              => '12',
            'time_comparison_operator' => 'gte',
            'time_value'               => '2',
            'time_unit'                => 'day'
        ]
    ],
]);

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

📦 Sample JSON Response

jsonCopyEdit// JSON RESPONSE
{
  "status": "success",
  "data": {
    "record": {
      "segment_uid": "mj54284tyo084",
      "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": []
    }
  }
}

PreviousGet All SubscribersNextUpdate a List Segment

Last updated 1 month ago