LianaMailer REST API

List imports

Server

Add many contacts to a mailing list at once in CSV or JSON format, and follow the progress of the import. To choose between the v1 and v2 imports, see Importing contacts.


Import CSV to mailing list

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

Imports contacts from CSV data. The import runs in the background and the call returns before it is done. Imports of one account are processed one at a time, and the call fails if too many imports are already waiting. For large imports, split the data into batches, for example of 10,000 contacts, and import them one at a time. Use getImportStatus to follow the progress of the import. Property name restrictions apply here.

Import CSV to mailing list › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60
properties_client
​Deprecated · required

Deprecated. Set to null.

Example: null
csv
​ListImportCSV · required

CSV data, raw or Base64-encoded, with property names in the header row. Use:

  • Field separator ;
  • Encapsulation "
  • Encoding UTF-8
  • Unix-style line endings \n
receipt
​Deprecated

Deprecated. Set to null.

Example: null
base64encoded
​ListImportB64Encoded

csv is Base64-encoded. Defaults to false.

Example: false
truncate
​ListImportTruncate

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

Example: false
disable_cem_events
​ListImportDisableAutomationEvents

Do not send LianaAutomation events for the import. Defaults to false.

Example: false
use_list_props
​ListImportUseListProps

Import properties as list-specific values instead of contact default values. Defaults to false.

Example: false
use_duplicates
​ListImportUseDuplicates

When the email and SMS of a row match two different contacts, add both to the list instead of rejecting the row. Defaults to false.

Example: false
fork
​Deprecated

Deprecated. Set to null.

Example: null
user_id
​ListImportUserId

ID of the user to associate with the import. Must be the ID of the authenticated user.

Example: 123
import_id
​ListImportId

ID of an existing import to use. Applies only with user_id, and the import must belong to that user.

Example: 1234
consent_id
​ConsentId

Consent ID.

Example: 4
consent_lang
​ConsentLang

Consent language code, e.g. EN.

Example: EN

Import CSV to mailing list › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​string | null

Returns null.

Example: null

Import JSON to mailing list

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

Imports contacts from JSON data. The data is converted to CSV and imported in the background like importCSVToMailingList with default options, so true means the import was started. For large imports, split the data into batches, for example of 10,000 contacts, and import them one at a time. Use getImportStatus to follow the progress of the import. Property name restrictions apply here.

Import JSON to mailing list › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60
emails
​string · required

JSON array of email addresses, or of objects with email, sms and property values keyed by property name. Property names are case-insensitive.

Import JSON to mailing list › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​boolean

Returns true on success.

Example: true

Check CSV before import

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

Checks CSV data before an import without importing anything. Email addresses are checked against the blocklist of addresses and domains that cannot be imported. Returns true if all rows are allowed, the blocked addresses as CSV otherwise, or false if the data has no email or SMS column.

Check CSV before import › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60
properties_client
​Deprecated · required

Deprecated. Set to null.

Example: null
csv
​ListImportCSV · required

CSV data, raw or Base64-encoded, with property names in the header row. Use:

  • Field separator ;
  • Encapsulation "
  • Encoding UTF-8
  • Unix-style line endings \n
receipt
​Deprecated

Deprecated. Set to null.

Example: null
base64encoded
​ListImportB64Encoded

csv is Base64-encoded. Defaults to false.

Example: false
truncate
​ListImportTruncate

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

Example: false

Check CSV before import › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​string

Boolean true if all rows are allowed, false if the data has no email or SMS column, otherwise the blocked addresses in CSV format.

Example: email recipient@bad.domain

Get import status

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

Returns the progress of the import of a list started with importCSVToMailingList or importJSONToMailingList. The result is -1 when the import is finished, and also when the list has no import. Poll this until it returns -1, then use getImportLog to see the results.

Get import status › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60

Get import status › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​ImportStatus

Current status: -1 if the list is fully imported, or [0, lines] if still importing.

Example: -1

Get import log

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

Returns the log of the latest import of the list, with counts of new, updated and rejected records and any errors. The log is removed when a new import of the list starts. Returns an empty string if the list has no import log.

Get import log › Request Body

list_id
​ListId · required

Mailing list ID.

Example: 60
base64encoded
​Base64Result

Return the content Base64-encoded. Defaults to false.

Example: false

Get import log › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​ImportLog

Log data of list import.

Example: Import summary: 1 records imported to listname Details: Source CSV file had 2 lines New records: 1 Updated records: 0 Duplicates: 0 Empty email or SMS: 0 Rejected: 0 Unsubscribed: 0 Deleted: 0 Domain rejected: 0 Member limit exceeded: 0 Target list: lista Import took 0 s Cancelled subscriptions: None Deleted subscribers: None Domain rejected records: All OK Member limit exceeded records: None Rejected records: All OK Errors: No errors