Marketing mailings
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 a mailing. A mailing is an HTML mail of one mail type, sent once to one or more segments of relations, right away or at a set moment; an address in several segments gets it once. The usual way: create it, set the HTML (it must contain {{mailing.unsubscribe_url}} unless the mail type is the system type), look at the preview, send a test mail, then send or schedule it.
List mailings
Returns a paginated list of mailings, newest first.
query Parameters
searchOnly return mailings whose name contains this text.
statusesOnly return mailings in these statuses. Accepts a comma-separated list of concept, scheduled, sending, sent.
marketing_segment_idsOnly return mailings sent to these segments. Accepts a comma-separated list of UUIDs.
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 mailings › Responses
Array of MarketingMailingListResource
Create a mailing
Creates a concept. Without html the mail starts empty.
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Create a mailing › Request Body
nameInternal name, the recipients never see it.
marketing_mail_type_idUUID of the mail type, see GET /marketing-mail-types. Recipients who unsubscribed from this type do not get it; the system type is for mail about running the business only, which nobody can unsubscribe from.
UUIDs of the segments it goes to. Can be set later, it needs at least one to be sent.
mail_identity_idUUID of the mail identity it comes from. Defaults to the default mail identity of the organization.
subjectSubject line. Variables such as {{contact.first_name}} are filled in per recipient.
htmlThe complete HTML document. Variables: {{contact.*}}, {{company.*}}, {{organization.*}}, {{image.<file-id>}} for an image in file_ids, {{mailing.unsubscribe_url}}, which is required unless the mail type is the system type, and {{mailing.view_online_url}}, the mail as the recipient got it in a browser.
html_file_idInstead of html: an uploaded HTML file (html or htm, up to 500 KB, see POST /files) whose content becomes the HTML, so a long document does not have to be sent along as text.
UUIDs of uploaded images (jpg, png or gif, see POST /files) the HTML places as {{image.<file-id>}}, so they need no hosting elsewhere. The HTML may only place images in this list.
track_opensMeasure who opens it. Defaults to true.
track_clicksMeasure who clicks which link. Defaults to true.
utm_sourceAdded as utm_source behind every link, also when clicks are not measured. Empty takes utm_defaults when it goes out.
utm_mediumAdded as utm_medium behind every link. Empty takes utm_defaults when it goes out.
utm_campaignAdded as utm_campaign behind every link. Empty takes utm_defaults (the name of the mailing in snake case) when it goes out.
Create a mailing › Responses
MarketingMailingResource
idnamestatusconcept Being written, can still change. |
scheduled Waiting for its moment; can go back to concept until then. |
sending Recipients are recorded and the mails are going out. |
sent Every recipient had its turn. Only the name can change now. |
Who it goes to. A segment cannot be deleted while a mailing uses it.
scheduled_atsent_atrecipient_countWho it goes to: until it goes out, who its segments reach right now for its mail type; afterwards the recipients recorded when it was sent.
open_rateThe share of the recipients that opened it, from 0 to 1. Null before it was sent.
created_atWho the mail comes from. Null once the mail identity was deleted.
subjecthtmlThe complete HTML document. Must contain {{mailing.unsubscribe_url}} before it can be sent,
unless the mail type is the system type.
The images the HTML may place as {{image.<file-id>}}.
track_openstrack_clicksutm_sourceBehind every link, also when clicks are not measured. Null takes utm_defaults when it
goes out; once it went out, what it went out with.
utm_mediumutm_campaignWhat an empty utm parameter becomes when it goes out.
What still stands in the way of sending, keyed by what it is about: subject, html
(the unsubscribe link), mail_identity_id, marketing_segment_ids or status. Empty when
it is ready to go; null once it goes out.
The numbers so far, once it is being sent; null before that.
updated_atGet a mailing
Returns a mailing with its sender, subject and HTML, and its numbers once it is being sent.
The mail as one recipient gets it is GET marketing-mailings/{marketing_mailing}/preview.
path Parameters
marketingMailingThe marketing mailing UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Get a mailing › Responses
MarketingMailingResource
idnamestatusconcept Being written, can still change. |
scheduled Waiting for its moment; can go back to concept until then. |
sending Recipients are recorded and the mails are going out. |
sent Every recipient had its turn. Only the name can change now. |
Who it goes to. A segment cannot be deleted while a mailing uses it.
scheduled_atsent_atrecipient_countWho it goes to: until it goes out, who its segments reach right now for its mail type; afterwards the recipients recorded when it was sent.
open_rateThe share of the recipients that opened it, from 0 to 1. Null before it was sent.
created_atWho the mail comes from. Null once the mail identity was deleted.
subjecthtmlThe complete HTML document. Must contain {{mailing.unsubscribe_url}} before it can be sent,
unless the mail type is the system type.
The images the HTML may place as {{image.<file-id>}}.
track_openstrack_clicksutm_sourceBehind every link, also when clicks are not measured. Null takes utm_defaults when it
goes out; once it went out, what it went out with.
utm_mediumutm_campaignWhat an empty utm parameter becomes when it goes out.
What still stands in the way of sending, keyed by what it is about: subject, html
(the unsubscribe link), mail_identity_id, marketing_segment_ids or status. Empty when
it is ready to go; null once it goes out.
The numbers so far, once it is being sent; null before that.
updated_atUpdate a mailing
Only the fields present in the request change. Once a mailing is scheduled or goes out,
only the name can change; take a scheduled one back first with unschedule.
path Parameters
marketingMailingThe marketing mailing UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Update a mailing › Request Body
nameReplaces the segments it goes to.
marketing_mail_type_idmail_identity_idsubjecthtmlThe complete HTML document, see create.
html_file_idInstead of html: an uploaded HTML file whose content replaces the HTML, see create.
Replaces the images, see create. An image the HTML still places cannot be taken away.
track_openstrack_clicksutm_sourceSee create.
utm_mediumSee create.
utm_campaignSee create.
Update a mailing › Responses
MarketingMailingResource
idnamestatusconcept Being written, can still change. |
scheduled Waiting for its moment; can go back to concept until then. |
sending Recipients are recorded and the mails are going out. |
sent Every recipient had its turn. Only the name can change now. |
Who it goes to. A segment cannot be deleted while a mailing uses it.
scheduled_atsent_atrecipient_countWho it goes to: until it goes out, who its segments reach right now for its mail type; afterwards the recipients recorded when it was sent.
open_rateThe share of the recipients that opened it, from 0 to 1. Null before it was sent.
created_atWho the mail comes from. Null once the mail identity was deleted.
subjecthtmlThe complete HTML document. Must contain {{mailing.unsubscribe_url}} before it can be sent,
unless the mail type is the system type.
The images the HTML may place as {{image.<file-id>}}.
track_openstrack_clicksutm_sourceBehind every link, also when clicks are not measured. Null takes utm_defaults when it
goes out; once it went out, what it went out with.
utm_mediumutm_campaignWhat an empty utm parameter becomes when it goes out.
What still stands in the way of sending, keyed by what it is about: subject, html
(the unsubscribe link), mail_identity_id, marketing_segment_ids or status. Empty when
it is ready to go; null once it goes out.
The numbers so far, once it is being sent; null before that.
updated_atDelete a mailing
Only a concept or a scheduled mailing can be deleted.
path Parameters
marketingMailingThe marketing mailing UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Delete a mailing › Responses
MarketingMailingReferenceResource
idnamestatusconcept Being written, can still change. |
scheduled Waiting for its moment; can go back to concept until then. |
sending Recipients are recorded and the mails are going out. |
sent Every recipient had its turn. Only the name can change now. |
Duplicate a mailing
Creates a concept with the same mail and segments, to build the next mailing on.
path Parameters
marketingMailingThe marketing mailing UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Duplicate a mailing › Responses
MarketingMailingResource
idnamestatusconcept Being written, can still change. |
scheduled Waiting for its moment; can go back to concept until then. |
sending Recipients are recorded and the mails are going out. |
sent Every recipient had its turn. Only the name can change now. |
Who it goes to. A segment cannot be deleted while a mailing uses it.
scheduled_atsent_atrecipient_countWho it goes to: until it goes out, who its segments reach right now for its mail type; afterwards the recipients recorded when it was sent.
open_rateThe share of the recipients that opened it, from 0 to 1. Null before it was sent.
created_atWho the mail comes from. Null once the mail identity was deleted.
subjecthtmlThe complete HTML document. Must contain {{mailing.unsubscribe_url}} before it can be sent,
unless the mail type is the system type.
The images the HTML may place as {{image.<file-id>}}.
track_openstrack_clicksutm_sourceBehind every link, also when clicks are not measured. Null takes utm_defaults when it
goes out; once it went out, what it went out with.
utm_mediumutm_campaignWhat an empty utm parameter becomes when it goes out.
What still stands in the way of sending, keyed by what it is about: subject, html
(the unsubscribe link), mail_identity_id, marketing_segment_ids or status. Empty when
it is ready to go; null once it goes out.
The numbers so far, once it is being sent; null before that.
updated_atPreview a mailing
Returns the subject and HTML as one recipient gets them, with their variables filled in, and
who that is: the recipient asked for, or else the first recipient. Pick one with
preview-recipients (before sending) or recipients (after). The recipient is null when there
is nobody to fill it in for.
path Parameters
marketingMailingThe marketing mailing UUID
query Parameters
recipient_keyThe recipient_key of the recipient to fill the preview in for, from preview-recipients or recipients.
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Preview a mailing › Responses
MarketingMailingPreviewResource
subjecthtmlrecipientWho it is filled in for. Null when there is nobody to fill it in for.
List who a preview can be shown for
Returns the recipients of its segments for its mail type, to pick the contact a preview or test is filled in for.
path Parameters
marketingMailingThe marketing mailing UUID
query Parameters
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 who a preview can be shown for › Responses
Array of MarketingSegmentRecipientResource
Send a test
Sends the saved mailing to one address, filled in as one recipient, without measuring anything. The unsubscribe link in a test goes nowhere.
path Parameters
marketingMailingThe marketing mailing UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Send a test › Request Body
emailWhere the test goes. Defaults to the e-mail address of the employee.
recipient_keyThe recipient_key of the recipient to fill the variables in for, from preview-recipients or recipients. Defaults to the first recipient.
Send a test › Responses
Send or schedule a mailing
Sends the mailing now, or at scheduled_at when that lies ahead. Refused with the reasons
when it is not ready: no segments or nobody in them, no subject, no unsubscribe link in the HTML
(unless the mail type is the system type), or a sender whose domain is not verified. When it goes out, the recipients are recorded; who
joins a segment afterwards does not get it.
path Parameters
marketingMailingThe marketing mailing UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Send or schedule a mailing › Request Body
scheduled_atWhen to send it (Y-m-d H:i, in the time zone of the organization), in the future. Leave it out to send it now.
Send or schedule a mailing › Responses
MarketingMailingResource
idnamestatusconcept Being written, can still change. |
scheduled Waiting for its moment; can go back to concept until then. |
sending Recipients are recorded and the mails are going out. |
sent Every recipient had its turn. Only the name can change now. |
Who it goes to. A segment cannot be deleted while a mailing uses it.
scheduled_atsent_atrecipient_countWho it goes to: until it goes out, who its segments reach right now for its mail type; afterwards the recipients recorded when it was sent.
open_rateThe share of the recipients that opened it, from 0 to 1. Null before it was sent.
created_atWho the mail comes from. Null once the mail identity was deleted.
subjecthtmlThe complete HTML document. Must contain {{mailing.unsubscribe_url}} before it can be sent,
unless the mail type is the system type.
The images the HTML may place as {{image.<file-id>}}.
track_openstrack_clicksutm_sourceBehind every link, also when clicks are not measured. Null takes utm_defaults when it
goes out; once it went out, what it went out with.
utm_mediumutm_campaignWhat an empty utm parameter becomes when it goes out.
What still stands in the way of sending, keyed by what it is about: subject, html
(the unsubscribe link), mail_identity_id, marketing_segment_ids or status. Empty when
it is ready to go; null once it goes out.
The numbers so far, once it is being sent; null before that.
updated_atTake a scheduled mailing back
A scheduled mailing goes back to concept, so it can be changed again.
path Parameters
marketingMailingThe marketing mailing UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Take a scheduled mailing back › Responses
MarketingMailingResource
idnamestatusconcept Being written, can still change. |
scheduled Waiting for its moment; can go back to concept until then. |
sending Recipients are recorded and the mails are going out. |
sent Every recipient had its turn. Only the name can change now. |
Who it goes to. A segment cannot be deleted while a mailing uses it.
scheduled_atsent_atrecipient_countWho it goes to: until it goes out, who its segments reach right now for its mail type; afterwards the recipients recorded when it was sent.
open_rateThe share of the recipients that opened it, from 0 to 1. Null before it was sent.
created_atWho the mail comes from. Null once the mail identity was deleted.
subjecthtmlThe complete HTML document. Must contain {{mailing.unsubscribe_url}} before it can be sent,
unless the mail type is the system type.
The images the HTML may place as {{image.<file-id>}}.
track_openstrack_clicksutm_sourceBehind every link, also when clicks are not measured. Null takes utm_defaults when it
goes out; once it went out, what it went out with.
utm_mediumutm_campaignWhat an empty utm parameter becomes when it goes out.
What still stands in the way of sending, keyed by what it is about: subject, html
(the unsubscribe link), mail_identity_id, marketing_segment_ids or status. Empty when
it is ready to go; null once it goes out.
The numbers so far, once it is being sent; null before that.
updated_atList the recipients of a mailing
Returns who a mailing was sent to, with per recipient whether it arrived, when it was first opened and how often links were clicked. Only filled once the mailing goes out.
path Parameters
marketingMailingThe marketing mailing UUID
query Parameters
searchOnly return recipients whose name or e-mail address contains this text.
statusesOnly return recipients in these statuses. Accepts a comma-separated list of queued, sent, delivered, failed.
openedOnly return recipients who opened it.
clickedOnly return recipients who clicked a link.
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 mailing › Responses
Array of MarketingMailingRecipientListResource
Get one recipient of a mailing
Returns what happened to the mail for one recipient, with every click on a link and when.
path Parameters
marketingMailingThe marketing mailing UUID
marketingMailRecipientThe marketing mail recipient UUID
Headers
X-Organization-IdUUID of the organization (tenant) the request operates on.
Get one recipient of a mailing › Responses
MarketingMailingRecipientResource
idrecipient_keyThe recipient as it got the mail, to pick a preview or test mail with.
nameemailstatusWhere the mail to one recipient stands, for marketing mail and every other mail alike. Opened and clicked are not a status: marketing mail keeps them as moments and counts next to it, because a delivered mail can be opened and clicked many times.
queued Recorded, waiting for its turn. |
sent Handed to the mail provider. |
delivered The receiving server accepted it. |
failed Not delivered, see the failure reason. |
failure_reasonWhy it failed, in the words of the mail provider. Null when it did not fail.
sent_atdelivered_atfirst_opened_atopen_countfirst_clicked_atclick_countunsubscribed_atThe contact with this address now, found by the address. Null when no contact has it.