Lists
Get all lists from your account
GET https://api.mailerlite.com/api/v1/lists/
Returns all lists you have in your account. Also basic summary for each list including the ID.
Parameters
Required | Parameter | Description |
---|---|---|
Yes | apiKey | |
No | limit | sets the limit of results in one page (default 1000) |
No | page | you can navigate trough records by increasing page number |
PHP code example
To get all lists in your account.
$ML_Lists = new MailerLite\Lists( API_KEY ); $lists = $ML_Lists->getAll( );
Response example
{ "Results": [ { "id": "11" "name": "My list", "date": "2013-05-05 07:22:54", "updated": "2013-06-18 15:57:35", "total": "212", "unsubscribed": "27", "bounced": "40" }, { "id": "12" "name": "My second list", "date": "2013-05-08 01:21:15", "updated": "2013-06-19 12:55:34", "total": "789", "unsubscribed": "35", "bounced": "48" } ], "Page": "1", "Limit": "1000", "RecordsOnPage": "2" }
List details
GET https://api.mailerlite.com/api/v1/lists/{id}/
Retrieve stats about sent messages.
Parameters
Required | Parameter | Description |
---|---|---|
Yes | apiKey | |
Yes | id | The ID of the list you want the stats for |
PHP code example
$ML_Lists = new MailerLite\Lists( API_KEY ); $list = $ML_Lists->setId( 11 )->get( );
Response example
{ "id": "11" "name": "My list", "date": "2013-05-05 07:22:54", "updated": "2013-06-18 15:57:35", "total": "212", "unsubscribed": "27", "bounced": "40" }
Add list
POST https://api.mailerlite.com/api/v1/lists/
Create new list.
Parameters
Required | Parameter | Description |
---|---|---|
Yes | apiKey | |
Yes | name | The name of the new list you want to create |
PHP code example
Creates a new list into which subscribers can be added or imported.
$ML_Lists = new MailerLite\Lists( API_KEY ); $result = $ML_Lists->add( array( 'name' => 'My new list' ) );
Response example
{ "id": "11" "name": "My new list", }
Updating a list
POST https://api.mailerlite.com/api/v1/lists/{id}/
Update existing list.
Parameters
Required | Parameter | Description |
---|---|---|
Yes | apiKey | |
Yes | id | The ID of the list you want to change |
Yes | name | The name of the new list you want to create |
PHP code example
Changes a name of the list.
$ML_Lists = new MailerLite\Lists( API_KEY ); $result = $ML_Lists->setId( 11 )->add( array( 'name' => 'My another list' ) );
Response example
{ "id": "11", "name": "My another list" }
Removing a list
DELETE https://api.mailerlite.com/api/v1/lists/{id}/
Delete the list.
Parameters
Required | Parameter | Description |
---|---|---|
Yes | apiKey | |
Yes | id | The ID of the list you want to remove |
PHP code example
Removes a list from your account.
$ML_Lists = new MailerLite\Lists( API_KEY ); $result = $ML_Lists->setId( 11 )->remove( );
Response example
{ }
Active subscribers
GET https://api.mailerlite.com/api/v1/lists/{id}/active/
GET https://api.mailerlite.com/api/v1/lists/{id}/active[{.json|.xml}]/
Returns all active subscribers in given list.
Parameters
Required | Parameter | Description |
---|---|---|
Yes | apiKey | |
Yes | id | The ID of the list you want the stats for |
No | limit | sets the limit of results in one page (default 1000) |
No | page | you can navigate trough records by increasing page number |
PHP code example
$ML_Lists = new MailerLite\Lists( API_KEY ); $active_subscribers = $ML_Lists->setId( 11 )->getActive( ); $active_subscribers = $ML_Lists->setId( 11 )->getActive( ['limit' => 100, 'page' => 2] );
Response example
{ "Results": [ { "email": "first@example.com" "name": "First", "date": "2009-07-09", "sent": "28", "opened": "24", "clicked": "7", "CustomFields": [ { "name": "City", "value": "Vilnius" }, { "name": "Gender", "value": "male" } ] }, { "email": "second@example.com" "name": "Second", "date": "2010-07-02", "sent": "18", "opened": "14", "clicked": "5" "CustomFields": [ { "name": "City", "value": "Paris" }, { "name": "Gender", "value": "female" } ] } ], "Page": "1", "Limit": "1000", "RecordsOnPage": "2" }
Unsubscribed subscribers
GET https://api.mailerlite.com/api/v1/lists/{id}/unsubscribed/
GET https://api.mailerlite.com/api/v1/lists/{id}/unsubscribed[{.json|.xml}]/
Returns all unsubscribed subscribers in given list.
Parameters
Required | Parameter | Description |
---|---|---|
Yes | apiKey | |
Yes | id | The ID of the list you want the stats for |
No | limit | sets the limit of results in one page (default 1000) |
No | page | you can navigate trough records by increasing page number |
PHP code example
$ML_Lists = new MailerLite\Lists( API_KEY ); $unsubscribed = $ML_Lists->setId( 11 )->getUnsubscribed( ); $unsubscribed = $ML_Lists->setId( 11 )->getUnsubscribed( ['page' => 2, 'limit' => 100] );
Response example
{ "Results": [ { "email": "adam@example.com" "name": "First", "date": "2009-07-09", "sent": "28", "opened": "24", "clicked": "7", "CustomFields": [ { "name": "City", "value": "Vilnius" }, { "name": "Gender", "value": "male" } ] }, { "email": "jane@example.com" "name": "Second", "date": "2010-07-02", "sent": "18", "opened": "14", "clicked": "5" "CustomFields": [ { "name": "City", "value": "Paris" }, { "name": "Gender", "value": "female" } ] } ], "Page": "1", "Limit": "1000", "RecordsOnPage": "2" }
Bounced subscribers
GET https://api.mailerlite.com/api/v1/lists/{id}/bounced/
Returns all bounced subscribers in given list.
Parameters
Required | Parameter | Description |
---|---|---|
Yes | apiKey | |
Yes | id | The ID of the list you want the stats for |
No | limit | sets the limit of results in one page (default 1000) |
No | page | you can navigate trough records by increasing page number |
PHP code example
$ML_Lists = new MailerLite\Lists( API_KEY ); $bounced = $ML_Lists->setId( 11 )->getBounced( ); $bounced = $ML_Lists->setId( 11 )->getBounced( ['limit' => 100, 'page' => 2] );
Response example
{ "Results": [ { "email": "one@example.com" "name": "First", "date": "2009-07-09", "sent": "28", "opened": "24", "clicked": "7", "CustomFields": [ { "name": "City", "value": "Vilnius" }, { "name": "Gender", "value": "male" } ] }, { "email": "two@example.com" "name": "Second", "date": "2010-07-02", "sent": "18", "opened": "14", "clicked": "5" "CustomFields": [ { "name": "City", "value": "Paris" }, { "name": "Gender", "value": "female" } ] } ], "Page": "1", "Limit": "1000", "RecordsOnPage": "2" }