Segments

Segments are basically the division of email contacts based on set criteria.

  • They are used as a personalization tactic to deliver more relevant email marketing to subscribers.
  • It is based on factors such as their geographic location, interests.
  • They are targeted groups of contacts that meet specified criteria.

Creating

In this section, you can create segment groups for subscribers information with an attribute such as Email address contains "example.com". However, if you use a segment to feature the first time, you can learn field type and operations below.

All segment rules operator

Field type Operator label Operator value
text256 - contains
- does not contain
- begins with
- ends with
- is equal to
- contains
- does not contain
- begins with
- ends with
- is
integer and float - is equals to
- is greater than
- is less than
- is equals to
- is greater than
- is smaller than
enum and boolean - is - is
date - is before
- is after
- contain yesterday’s date
- contain today's date and month
- exactly match to
- is before
- is after
- is yesterday
- is anniversary
- is exactly
time and datetime - is before
- is after
- is equals to
- is before
- is after
- is
  • This API endpoint allows creating a segment to specify contact.
  • You can send POST request and segment object to list/{list_id}/segment API.
  • If successfully created, Taximail API will return the new segment_id.

POST https://api.taximail.com/v2/list/{list_id}/segment

Parameter Type Description Required
segment_name string The segment's name. Yes
segment_operator enum {and, or} The operator should match all or any rules. Yes
segment_rules array The array of segment's rules.

When you want to create a segment, you can post array of rules object with pattern below.

Ex. [{ "field":"EmailAddress" , "operator":"contains" , "field_value":"gmail.com" }]
Yes
segment_rules.field string The field's name of rules.
segment_rules.operator string The value of operator.
segment_rules.field_value string The value of rules.

Example Request

POST v2/list/314/segment HTTP/1.1
Host: api.taximail.com
Authorization: "Bearer YOUR_SESSION_ID"

segment_name=Customer+Gmail+or+Hotmail&segment_operator=or&segment_rules%5B0%5D%5Bfield%5D=EmailAddress&segment_rules%5B0%5D%5Boperator%5D=contains&segment_rules%5B0%5D%5Bfield_value%5D=%40gmail.com&segment_rules%5B1%5D%5Bfield%5D=EmailAddress&segment_rules%5B1%5D%5Boperator%5D=contains&segment_rules%5B1%5D%5Bfield_value%5D=%40hotmail.com

Example Result

{
  "status": "success",
  "code": 201,
  "data": {
              "segment_id": 161
       }
}

Fields

Name Type Description
status enum {success, error} Returns the status of the result.
code integer Returns the response code of the result.
err_msg string When error occur, returns the error's detail of the result.
data.segment_id integer The segment_id of the new segment.

Response Code

Code Result Description
201 success The new resource was created successfully.
400 error The request is malformed or missing some required parameters.
401 error Unauthorized or the session_id expired.
404 error The list not found.

Showing

  • This API endpoint allows you to segment all the list.
  • You can send GET request to list/{list_id}/segment API.
  • Taximail API will return an array of segment list and segment_count.

GET https://api.taximail.com/v2/list/{list_id}/segment

Parameter Type Description Required
order_by enum {segment_id,  
segment_name}
Specify the column which is used to sort the result-set.

Defaults to segment_id.
order_type enum {asc, desc} To sort the records in ascending or descending order.

Defaults to desc.

Example Request

GET v2/list/314/segment?order_by=list_name&order_type=desc HTTP/1.1
Host: api.taximail.com
Authorization: "Bearer YOUR_SESSION_ID"

Example Result

{
  "status": "success",
  "code": 200,
  "data": {
            "list_segment": [
                    {
                        "segment_id": 151,
                        "segment_name": "Customer Gmail or Hotmail",
                    },
                    {
                        "segment_id": 153,
                        "segment_name": "Age more than 25",
                    }
            ],
            "segment_count": 2
      }
}

Fields

Name Type Description
status enum {success, error} Returns the status of the result.
code integer Returns the response code of the result.
err_msg string When error occur, returns the error's detail of the result.
data.list_segment array Return array of segment each list.
data.segment_count integer Return summary segment in list.

Response Code

Code Result Description
200 success Response to a successful request.
400 error The request is malformed or missing some required parameters.
401 error Unauthorized or the session_id expired.
404 error The list not found.

Updating

  • This API endpoint allows you to update or edit each segment.
  • You can send GET request to list/{list_id}/segment API.
  • Taximail API will return an array of segment list and segment_count.
  • You can send PUT request and segment attribute to list/{list_id}/segment API.

PUT https://api.taximail.com/v2/list/{list_id}/segment/{segment_id}

Parameter Type Description Required
segment_name string The segment's name. Yes
segment_operator enum {and, ,or} Matched all or any rules. Yes
segment_rules array The array of segment's rules.

When you want to update segment, you can post array of rules object with pattern below.

Ex. [{ "field":"EmailAddress" , "operator":"contains" , "field_value":"gmail.com" }]
Yes
segment_rules.field string The field's names of rules.
segment_rules.operator string The order of operations.
segment_rules.field_value string The value of rules.

Example Request

PUT v2/list/314/segment/151 HTTP/1.1
Host: api.taximail.com
Authorization: "Bearer YOUR_SESSION_ID"

segment_name=Customer+Gmail+or+Hotmail+or+Yahoo&segment_operator=or&segment_rules%5B0%5D%5Bfield%5D=EmailAddress&segment_rules%5B0%5D%5Boperator%5D=contains&segment_rules%5B0%5D%5Bfield_value%5D=%40gmail.com&segment_rules%5B1%5D%5Bfield%5D=EmailAddress&segment_rules%5B1%5D%5Boperator%5D=contains&segment_rules%5B1%5D%5Bfield_value%5D=%40hotmail.com&segment_rules%5B2%5D%5Bfield%5D=EmailAddress&segment_rules%5B2%5D%5Boperator%5D=contains&segment_rules%5B2%5D%5Bfield_value%5D=%40yahoo.com

Example Result

{
  "status": "success",
  "code": 200
}

Fields

Name Type Description
status enum {success, error} Returns the status of the result.
code integer Returns the response code of the result.
err_msg string When error occur, returns the error's detail of the result.

Response Code

Code Result Description
200 success Response to a successful request.
400 error The request is malformed or missing some required parameters.
401 error Unauthorized or the session_id expired.
404 error The list not found.
The segment not found.

Deleting

  • This API endpoint allows you to delete a segment.
  • You can send DELETE request to list/{list_id}/segment/{segment_id} API.
  • Here, the deletion happens one by one.

DELETE https://api.taximail.com/v2/list/{list_id}/segment/{segment_id}

Example Request

DELETE v2/list/314/segment/151 HTTP/1.1
Host: api.taximail.com
Authorization: "Bearer YOUR_SESSION_ID"

Example Result

{
    "status": "success",
    "code": 200
}

Fields

Name Type Description
status enum {success, error} Returns the status of the result.
code integer Returns the response code of the result.
err_msg string When error occur, returns the error's detail of the result.

Response Code

Code Result Description
200 success Response to a successful request.
400 error The request is malformed or missing some required parameters.
401 error Unauthorized or the session_id expired.
404 error The list not found.
The segment not found.
Title
Title SEO [Optional]
Description SEO [Optional]
Friendly URL [Optional]
IFRAME Content [Optional]
Priority
Markdown
We use cookies
This website uses cookies to enhance your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from. You can manage your preferences by clicking Change Preferences. Learn more about this on Cookie policy
Change Preferences
Accept All