# E-mail distribution lists

The functionality is subject to module activation [Mass
e-mailing](https://doplnky.shoptet.cz/hromadne-rozesilani-emailu) within
the e-shop. The addon using this endpoint must therefore have this module
defined as dependency.

## Listing of e-mail distribution lists

 - [GET /api/mailing-lists](https://api.docs.shoptet.com/shoptet-api/openapi/e-mail-distribution-lists/getlistingofemaildistributionlists.md): The e-mail distribution list named "newsletters" is the system one and is always available 
(if the e-shop has the module installed). This e-mail distribution list includes the e-mails 
of all customers who agreed to receiving e-mails.

## Insertion of e-mail distribution list

 - [POST /api/mailing-lists](https://api.docs.shoptet.com/shoptet-api/openapi/e-mail-distribution-lists/createemaildistributionlist.md)

## Detail of e-mail distribution list

 - [GET /api/mailing-lists/{code}](https://api.docs.shoptet.com/shoptet-api/openapi/e-mail-distribution-lists/getdetailofemaildistributionlist.md): This endpoint returns a list of e-mail addresses of the distribution list.


Upon initial call, it returns up to 500 e-mail addresses; using the ?itemsPerPage=20 parameter, you can 
requests any number of records per page, up to 500 items limit.


Endpoint supports Paging.

## Distribution list e-mails insertion

 - [POST /api/mailing-lists/{code}](https://api.docs.shoptet.com/shoptet-api/openapi/e-mail-distribution-lists/createemailsdistributionlist.md): This endpoint allows you to add new e-mail addresses to the distribution
list identified by its code. In the response you will receive
structured info about the result of the insertion. In the
emailsInserted

key there will be a list of e-mails successfully inserted, in the
emailsExisting key, there will be a list of skipped e-mails, because
there were already in the list. In the

emailsInvalid key, there will be a list of invalid e-mails (wrong
format or non-existing MX domain record) and finally in the
errorMessages key, there will be a list of error messages

generated for invalid e-mails.

## Last changes in distribution list

 - [GET /api/mailing-lists/{code}/changes](https://api.docs.shoptet.com/shoptet-api/openapi/e-mail-distribution-lists/getlastchangesindistributionlist.md): Endpoint is intended to determine the changes after you load the complete e-mail list and you need to know 
if any of these e-mails were added or removed. Guaranteed history is 30 days, the older data are deleted 
progressively.


Each e-mail on single e-mail list is only mentioned with its last change, within the log. For example, 
if the e-mail is deleted and then added again, the log will only show information about its addition. 
The e-mail lists are not dependant on each other (removing an e-mail from one list does not cause any 
change in another list, unless the e-mail was originally included in both).

Can be filtered by changeType = edit/delete parameter.

For "created" action, we use edit change type.


Endpoint supports Paging.

