LianaMailer REST API

List members

Server

Add contacts to mailing lists and remove them, list and count the members of a list, and follow subscriptions and unsubscriptions.


Add contacts to list

POST
https://rest.lianamailer.com/api
/v1/joinMailingList

Adds existing contacts, by ID, to a mailing list. Lists that have a condition (dynamic lists) cannot be joined.

Unless noauto is set, unconfirmed contacts are confirmed when they are added. To create a contact and add it to lists in one call, use createAndJoinRecipient.

Add contacts to list › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60
recipient_list
​integer[] · required

IDs of the contacts to add.

Example: [1000,1001,1002]
noauto
​ListJoinNoauto

Do not confirm unconfirmed contacts automatically. Defaults to false.

Example: true
reason
​Reason

Free-text reason for the action.

Example: Example reason.
admin
​Admin

Action initiated by an admin (true) or by the contact (false). Defaults to true.

Example: false
truncate
​ListImportTruncate

Remove current list members who are not in the new data. Defaults to false.

Example: false
origin
​Origin

Origin of the action, e.g. a subscription page URL or api.

Example: api
rejoin
​ListRejoin

Record a new list join even for contacts already on the list, which allows repeated welcome messages. Defaults to false.

Example: true
ignore_errors
​ListJoinIgnoreErrors

Skip contacts that cannot be added, such as missing contacts, instead of failing. Defaults to false.

Example: true

Add contacts to list › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​string | null

Returns null.

Example: null

Remove contact from list

POST
https://rest.lianamailer.com/api
/v1/removeRecipientFromMailingList

Removes the contact member from the mailing list list_id. If list_id is 0, the contact is removed from all lists where it is active. Works for both static and dynamic list members.

The contact itself is not deleted. Use deleteRecipient for that.

Remove contact from list › Request Body

member
​RecipientId · required

Contact ID.

Example: 20000
list_id
​ListId · required

Mailing list ID.

Example: 60
reason
​Reason

Free-text reason for the action.

Example: Example reason.

Remove contact from list › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​boolean

Returns true on success.

Example: true

Get list member IDs

POST
https://rest.lianamailer.com/api
/v1/getMailingListMembers

Returns the IDs of active, confirmed list members. Unsubscribed and unconfirmed members are not included. Use getRecipientList to get contact data for the IDs, or getMailingListMembersConditional to get members with their data as CSV.

Get list member IDs › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60
from
​Offset

Number of results to skip.

Example: 100

Maximum number of members to return. 0 or omitted returns all.

Example: 0
order
​OrderBy

Field to order results by: id, email, sms or a property name. Unordered when omitted.

Example: email
sort
​Sort

Sort direction, asc or desc. Defaults to asc.

Example: desc

Case-insensitive search text matched against email, SMS (in international format) or property values. Use * as a wildcard. Special values:

  • has_email returns members who have an email address
  • has_sms returns members who have an SMS number
Example: property-value

Get list member IDs › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​integer[]

Array of contact IDs.

Example: [402,512,493]

Get list members as CSV

POST
https://rest.lianamailer.com/api
/v1/getMailingListMembersConditional

Returns list members with their email, SMS and property values as CSV data, with a header row. Use condition to get, for example, members who bounced or unsubscribed in a time range. To get only member IDs, use getMailingListMembers.

Get list members as CSV › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60
from
​integer

Start time as a Unix timestamp. Defaults to 0. Ignored when condition is new or omitted.

to
​integer

End time as a Unix timestamp. Defaults to now. Ignored when condition is new or omitted.

condition
​ListMemberCondition · enum

Member group to return. Omitted or other values return all members.

  • bounced members with bounces
  • unsubscribed members who have been on the list but unsubscribed
  • left members who opted out of the list
  • joined members who opted in to the list
  • new all list members
Enum values:
bounced
unsubscribed
left
joined
new
Example: bounced
cols
​string[]

Columns to include: property names and optionally joined, quit, unsubscribed or member_id. Empty returns all properties.

Example: ["propertyname"]

Get list members as CSV › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​ListCsv

List contents in CSV format.

Example: "email";"sms";"property"

Get mailing list member count

POST
https://rest.lianamailer.com/api
/v1/getMailingListMembersCount

Returns the number of active, confirmed members on the list. This is the same count as members in the list data.

Get mailing list member count › Request Body

list
​ListId · required

Mailing list ID.

Example: 60

Get mailing list member count › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​ListMemberCount

List member count.

Example: 4012

Get list-specific property values

POST
https://rest.lianamailer.com/api
/v1/getRecipientsMailingListProps

Returns the list-specific property values of a mailing list's contacts, or of one contact if recipient_id is given.

Returns an error if list-specific properties are not enabled for your account.

Get list-specific property values › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60
recipient_id
​RecipientId

Contact ID.

Example: 20000

Get list-specific property values › Responses

OK

succeed
​boolean

Response status.

Example: true
​RecipientListProp

Arrays of list properties keyed by contact ID.


Get subscriptions

POST
https://rest.lianamailer.com/api
/v1/getSubscriptionData

Returns the contacts' own subscriptions to your mailing lists: list joins that were not made by an admin (see the admin parameter of joinMailingList). There is one row per contact and list, with the latest join time. Deleted and hidden lists are skipped. With from, a date and time, only joins after that second are returned. A from of eight characters or fewer is ignored.

Get subscriptions › Request Body

from
​FromDate

Start date and time as YYYY-MM-DD HH:MM:SS. getUnsubscriptions accepts only YYYY-MM-DD.

Example: 2019-12-20 14:00:00

Get subscriptions › Responses

OK

succeed
​boolean

Response status.

Example: true
​SubscriptionData[]

Array of subscription data.


Get unsubscriptions

POST
https://rest.lianamailer.com/api
/v1/getUnsubscriptions

Returns unsubscriptions from mailing lists since the from date, or all of them if from is omitted.

There is one row per contact and list, with the latest time the contact left the list. Rows are also added when a contact is deleted or forgotten, and are kept when the contact joins the list again. A contact who has left one list can still be active on other lists.

Get unsubscriptions › Request Body

from
​FromDate

Start date and time as YYYY-MM-DD HH:MM:SS. getUnsubscriptions accepts only YYYY-MM-DD.

Example: 2019-12-20 14:00:00

Get unsubscriptions › Responses

OK

succeed
​boolean

Response status.

Example: true

Array of unsubscriptions.


deprecated

Leave mailing list

POST
https://rest.lianamailer.com/api
/v1/quitMailingList

Deprecated. Removes a contact from a mailing list, but works only for static members.

Use removeRecipientFromMailingList instead: it works for both dynamic and static members.

Leave mailing list › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60
recipient_id
​RecipientId · required

Contact ID.

Example: 20000
reason
​Reason

Free-text reason for the action.

Example: Example reason.
admin
​Admin

Action initiated by an admin (true) or by the contact (false). Defaults to true.

Example: false
origin
​Origin

Origin of the action, e.g. a subscription page URL or api.

Example: api

Leave mailing list › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​string | null

Returns null.

Example: null