Marketing segments
BETA. Part of the E-mailmarketing module, which only works for organizations that were given access to the beta and switched the module on. Do not use these endpoints on your own initiative; only when the user explicitly asks for mailings or segments. A segment holds conditions on relations, never a list: who falls in it is worked out again on every request and when a mailing is sent.
List segments
Returns all segments with who they reach right now.
query Parameters
searchOnly return segments whose name contains this text.
pagePage number of the paginated result set.
per_pageNumber of items per page. Defaults to the endpoint's own page size; capped at 500.
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
List segments › Responses
Array of MarketingSegmentListResource
Create a segment
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Create a segment › Request Body
nameThe conditions, see GET marketing-segments/fields. Every condition must hold.
Create a segment › Responses
MarketingSegmentResource
idnamecondition_countrecipient_countWho the segment reaches right now.
marketing_mailing_countThe number of mailings that use this segment.
created_atEvery condition must hold. See GET marketing-segments/fields for the fields, their operators and values. records names the records a condition on records picks; null for other conditions.
updated_atThe condition fields
Lists what a segment condition can look at, with the operators each field allows, the kind of value it takes, and the options or the endpoint to pick records from.
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
The condition fields › Responses
Array of MarketingSegmentFieldResource
fieldlabelapplies_to_contactWhether the condition looks at the contact rather than at its company.
value_typeWhat a condition compares against, so the front-end knows which field to show and the back-end which value to accept.
options One or more values from a fixed list of options. |
records One or more records, fetched from the endpoint the field names. |
number |
none The operator says it all, such as "has a customer portal account". |
The values to choose from, for a field with options.
records_endpointWhere to pick the records from, for a field on records. Null for other fields.
Preview a segment
Who unsaved conditions would reach, to show while a segment is being built, or with
marketing_segment_ids who saved segments reach together, as a mailing to them does: an
address in several gets it once. Paginated, so meta.total is how many there are. Send page
in the query string.
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Preview a segment › Request Body
The conditions, see GET marketing-segments/fields. Every condition must hold. Required without marketing_segment_ids.
UUIDs of saved segments to preview together, instead of conditions.
marketing_mail_type_idWork it out for a mail of this type: who unsubscribed from it is left out.
Preview a segment › Responses
Array of MarketingSegmentRecipientResource
recipient_keyWho the mail is filled in for, to pick a preview or test mail with.
namecompany_namefunctionemailGet a segment
Returns a segment with its conditions, who it reaches right now, who it leaves out and which mailings use it.
path Parameters
marketingSegmentThe marketing segment UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Get a segment › Responses
MarketingSegmentResource
idnamecondition_countrecipient_countWho the segment reaches right now.
marketing_mailing_countThe number of mailings that use this segment.
created_atEvery condition must hold. See GET marketing-segments/fields for the fields, their operators and values. records names the records a condition on records picks; null for other conditions.
updated_atUpdate a segment
Only the fields present in the request change. conditions replaces all conditions.
path Parameters
marketingSegmentThe marketing segment UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Update a segment › Request Body
nameReplaces all conditions, see GET marketing-segments/fields.
Update a segment › Responses
MarketingSegmentResource
idnamecondition_countrecipient_countWho the segment reaches right now.
marketing_mailing_countThe number of mailings that use this segment.
created_atEvery condition must hold. See GET marketing-segments/fields for the fields, their operators and values. records names the records a condition on records picks; null for other conditions.
updated_atDelete a segment
Refused once a mailing uses it, also one that went out: the mailing keeps showing which segments it was sent to.
path Parameters
marketingSegmentThe marketing segment UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Delete a segment › Responses
MarketingSegmentReferenceResource
idnameList the recipients of a segment
Returns who the segment reaches right now. With a mail type, who unsubscribed from that type is left out too, as a mailing of that type does.
path Parameters
marketingSegmentThe marketing segment UUID
query Parameters
marketing_mail_type_idWork it out for a mail of this type, see GET /marketing-mail-types.
searchOnly return contacts whose name, company or e-mail address contains this text.
pagePage number of the paginated result set.
per_pageNumber of items per page. Defaults to the endpoint's own page size; capped at 500.
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
List the recipients of a segment › Responses
Array of MarketingSegmentRecipientResource