Segments
The Segments resource has RUD functionality. It allows you to Retrieve, Update, and Delete Segments. The following actions can be performed on this resource...
Retrieve All Segments
Retrieves all segments associated with a specific brand.
You can include additional parameters in the request as described in the Query Parameters section. For instance, the request below will return only segments that have the name "New Contacts".
Example Response:
{
"data": [
{
"segment_id": 2222,
"_brand_id": 123456789,
"name": "New Contacts",
"description": "Segment of all contacts in last 30 days",
"created": "2024-01-01 14:11:07",
"last_updated": "2024-01-02 08:00:07"
}
],
"pagingData": {
"prevPage": null,
"currentPage": null,
"nextPage": null,
"currentPageString": null,
"hasMore": true
}
}
Retrieve a Specific Segment
Retrieves a segment with the segment ID equal to {id}. The segment ID can be found using the retrieve all segments endpoint.
Example Response:
{
"segment_id": 2222,
"_brand_id": 123456789,
"name": "New Contacts",
"description": “Segment of all contacts in last 30 days”,
"created": "2024-01-01 14:11:07",
"last_updated": "2024-01-02 08:00:07"
}
Edit a Specific Segment
Allows you to edit existing segments. You can target an existing segment by passing the segment ID in your PUT request. The segment ID can be found using the retrieve all segments endpoint. At least one of the arguments below is required.
Arguments
PARAMETER | DESCRIPTION |
---|---|
name | Name of the segment. |
description | Description of the segment. |
Example Request Body:
{
"name": "New Contacts",
"description": "Segment of all contacts in last 30 days"
}
Example Response:
{
"segment_id": 2222,
"_brand_id": 123456789,
"name": "New Contacts",
"description": “Segment of all contacts in last 30 days”,
"created": "2024-01-01 14:11:07",
"last_updated": "2024-01-02 08:00:07"
}
Delete a Specific Segment
Deletes an existing segment with the segment ID equal to {id}. The segment ID can be found using the retrieve all segments endpoint. Using this action, the segment is simply removed completely from the brand. Contacts that are currently in the segment when the segment is deleted will not be deleted. They will remain tied to your brand and any other segment the contacts may be associated with.
Example Response:
[]
Retrieve Count of Contacts in Specific Segment
Returns the number of contacts in the segment with the segment ID equal to {id}. The segment ID can be found using the retrieve all segments endpoint. This number is the total count of contacts. It will include any contacts that are unsubscribed, not subscribed, blocked, or subscribed unless you specifically filtered them out of your segment.
Example Response:
1200
Retrieve Contacts from a Specific Segment
Returns all contacts in the segment with the segment ID equal to {id}. The segment ID can be found using the retrieve all segments endpoint.
Example Response:
{
"data": [
{
"contact_id": 7778,
"_brand_id": 123456789,
"first_name": "Marty",
"last_name": "McFly",
"mobile_number": "+16155553338",
"mobile_number_carrier": null,
"email": "marty@slicktext.com",
"birthdate": "1968-06-12",
"address": "9303 Lyon Drive",
"city": "Hill Valley",
"state": "CA",
"zip": 95420,
"country": "US",
"source": "api",
"_source_id": null,
"sub_source": null,
"_sub_source_id": null,
"custom_fields": {
"member": 1,
"member_number": 12345,
"membership_date": "1985-10-26"
},
"timezone": "America/Los_Angeles",
"language": "en",
"opt_in_status": "subscribed",
"last_opt_in_status_change": null,
"created": "1955-11-12 06:38:00",
"last_updated": "2015-10-15 07:28:00"
}
],
"pagingData": {
"prevPage": null,
"currentPage": null,
"nextPage": null,
"currentPageString": null,
"hasMore": true
}
}