MailerLite API

Welcome! You'll find comprehensive guides and documentation to help you start working with MailerLite API as quickly as possible, as well as support if you get stuck.

Let's jump right in!

Get Started    Support
Suggest Edits

/campaigns/:status

Returns all campaigns you have in your account by :status which is required. Also basic summary for each campaign including the ID.

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/campaigns/status
curl -v http://api.mailerlite.com/api/v2/campaigns \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9" \
<?php
$campaignsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->campaigns();

$sentCampaigns = $campaignsApi->get(); // returns array of sent campaigns

$sentCampaigns = $campaignsApi->get('sent'); // same as previous

$outboxCampaigns = $campaignsApi->get('outbox'); // returns array of scheduled campaigns

$draftCampaigns = $campaignsApi->get('draft'); // returns array of draft campaigns
A binary file was returned
[
  {
    "id": 2825239,
    "total_recipients": 5,
    "type": "regular",
    "date_created": "2016-02-17 15:22:40",
    "date_sent": "2016-02-17 17:28:48",
    "name": "imported template",
    "status": "sent",
    "opened": {
      "count": 2,
      "rate": 40
    },
    "clicked": {
      "count": 1,
      "rate": 20
    }
  },
  {    
    "id": 2292669,
    "total_recipients": 6,
    "type": "regular",
    "date_created": "2016-02-16 12:15:01",
    "date_sent": "2016-02-16 12:49:53",
    "name": "Happy birthday to me! 🎁",
    "status": "sent",
    "opened": {
      "count": 6,
      "rate": 100
    },
    "clicked": {
      "count": 6,
      "rate": 100
    }
  },
  {
    "id": 2825239,
    "total_recipients": 10,
    "type": "regular",
    "date_created": "2016-01-01 01:05:36",
    "date_sent": "2016-01-01 01:20:56",
    "name": "Happy new year!",
    "status": "sent",
    "opened": {
      "count": 6,
      "rate": 60
    },
    "clicked": {
      "count": 5,
      "rate": 50
    }
  }
]

Path Params

status
string
required

available values: sent, draft, outbox

Query Params

limit
int32
offset
int32
order
string

ASC or DESC

 

Request

There are three possible values of :status parameter:

  • sent - campaigns which are sent already
  • draft - campaigns which aren't completed or sent to subscribers
  • outbox - campaigns which are being sent right now or scheduled campaigns

If you do not specify :status parameter, it defaults to sent.

There are some optional parameters which are described above.

Response Body Parameters

Parameter
Type
Description

id

Integer

ID of a campaign

total_recipients

Integer

Total count of receivers in campaign

type

String

Possible values:

  • regular
  • ab
  • followup
  • rss

date_created

String

When the campaign was created

date_sent

String

When the email was sent. If campaign type is outbox, this parameter will show the scheduled date.

name

String

Campaign name, which is inherited from email subject.

status

String

Possible values:

  • sent
  • draft
  • outbox

opened

Object

opened.count

Integer

Total opens of campaign.

Available only for sent campaigns.

Default value: 0

opened.rate

Float

Open rate of campaign.

Available only for sent campaigns.

Default value: 0

clicked

Object

clicked.count

Integer

Total clicks of campaign.

Available only for sent campaigns.

Default value: 0

clicked.rate

Float

Click rate of campaign.

Available only for sent campaigns.

Default value: 0

/campaigns/:status/count

You can retrieve only the number of campaigns by type. If you do not specify :status, it defaults to sent.

Response example

{
  "count": 3
}
Suggest Edits

/campaigns

Create campaign where you will use your custom HTML template

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.mailerlite.com/api/v2/campaigns
curl -X POST "http://api.mailerlite.com/api/v2/campaigns" \
-d '{
    "groups": [2984475, 3237221],
    "type": "ab",
    "ab_settings": {
        "send_type": "subject",
        "values": ["Email subject A", "Email subject B"],
        "ab_win_type": "opens",
        "winner_after": 1,
        "winner_after_type": "h",
        "split_part": "10"
    }}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9" \
curl -X POST "http://api.mailerlite.com/api/v2/campaigns" \
-d '{
		"subject": "Regular campaign subject",
    "groups": [2984475, 3237221],
    "type": "regular"
}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9" \
<?php
$campaignsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->campaigns();

$campaignData = [
  'subject' => 'Regular Campaign Subject',
  'type' => 'regular',
  'groups' => [2984475, 3237221]
];

$campaign = $campaignsApi->create($campaignData); // returns created $campaign object
A binary file was returned
{
  "campaign_type":"regular",
  "date":"2016-05-18 13:03:47",
  "account_id":441087,
  "id":3043021,
  "mail_id":3529037,
  "options": {
    "current_step":"step3",
    "send_type":"regular",
    "campaign_type":"regular",
    "date":"2016-05-18 13:03:47"
  }
}
{
  "error":{
    "code":123,
    "message":"Array[ab_settings]: This field is missing. (code 2fa2158c-2a7f-484b-98aa-975522539ff8)"
  }
}

Body Params

type
string
required

Type of campaign. Available values: regular, ab.

subject
string

Mail subject. Required if campaign type is regular.

from
string

Email of sender

from_name
string

Name of sender

language
string

Available languages and its code's: https://developers.mailerlite.com/reference#language

groups
array of integers
required

IDs of groups

ab_settings
object

Required if campaign type is ab. More details are below.

 
 

Email type of created campaign

Campaigns that are created using this endpoint require your own custom HTML templates to be added via API using /campaigns/:id/content endpoint or directly in MailerLiter application.

Here is more details about ab_settings object.

All fields are required!

Parameter
Type
Description

values

array

Must contain two values. It depends on send_type.

For example, if send_type equals to sender these values are used as sender names for AB test.

If send_type equals to subject these values are used as subjects for AB test.

send_type

string

Available values:

  • sender
  • subject

ab_win_type

string

It defines how winner will be selected.

Available values:

  • opens
  • clicks

winner_after

integer

It defines how long AB test is active.

Pay attention that this is only a number and type is defined as winner_after_type

winner_after_type

string

Available values:

  • d - days
  • h - hours

split_part

integer

It defines size of every test group in percents equally.

Available range: 5-25

Suggest Edits

/campaigns/:id

Remove a campaign.

 

Header Auth

 Authentication is required for this endpoint.
deletehttps://api.mailerlite.com/api/v2/campaigns/id
curl -v -X DELETE https://api.mailerlite.com/api/v2/campaigns/123456 \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$campaignsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->campaigns();

$id = 123;

$campaignsApi->delete($id);
A binary file was returned
{
  "success": true
}
{
  "error": {
    "code": 123,
    "message": "Campaign not found"
  }
}
{
  "error": {
    "code": 400,
    "message": "Cannot delete scheduled campaign - cancel it first"
  }
}

Path Params

id
int32
required

campaign ID

 

Be aware that deleting a scheduled campaign is not possible - you would have to cancel it first.

Suggest Edits

/campaigns/:id/content

Upload your HTML template to created campaign

 

Header Auth

 Authentication is required for this endpoint.
puthttps://api.mailerlite.com/api/v2/campaigns/id/content
curl -X PUT "http://api.mailerlite.com/api/v2/campaigns/3043022/content" \
-d '{
    "html": "<h1>Title</h1><p>Content</p><p><small><a href=\"{$unsubscribe}\">Unsubscribe</a></small></p>",
    "plain": "Your email client does not support HTML emails. Open newsletter here: {$url}. If you do not want to receive emails from us, click here: {$unsubscribe}"
}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$campaignsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->campaigns();

$contentData = [
  'html' => '<h1>Title</h1><p>Content</p><p><small><a href="{$unsubscribe}">Unsubscribe</a></small></p>',
  'plain' => 'Your email client does not support HTML emails. Open newsletter here: {$url}. If you do not want to receive emails from us, click here: {$unsubscribe}'
];

$campaignId = 123;
$response = $campaignsApi->addContent($campaignId, $campaignData);
A binary file was returned
{
	"success": true
}
{
  "error": {
    "code": 123,
    "message": "Unsubscribe link is missing in HTML template"
  }
}

Path Params

id
int32
required

ID of campaign

Body Params

html
string
required

HTML template source

plain
string
required

Plain text of email

auto_inline
boolean

Defines if it is needed to convert available CSS to inline CSS (excluding media queries)

 

You can use your custom HTML template and associate it with created campaign using this endpoint.

HTML template

HTML template must contain a link for unsubscribe. It may look like this:

<a href="{$unsubscribe}">Unsubscribe</a>

Plain text mail

Some email clients do not support HTML emails so you need to set plain text email and it must contain these variables:

  • {$unsubscribe} - unsubscribe link
  • {$url} - URL to your HTML newsletter
Suggest Edits

/campaigns/:id/actions/:action

Send, schedule or cancel campaign

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.mailerlite.com/api/v2/campaigns/id/actions/action
curl -X POST "http://api.mailerlite.com/api/v2/campaigns/2418787/actions/send" \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$campaignsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->campaigns();

$campaignId = 123;
$response = $campaignsApi->send($campaignId); // send now
$response = $campaignsApi->cancel($campaignId); // cancel sending and put campaign back to drafts

$campaignId = 234;
$scheduleSettings = [
  'type' => 2,
  'date' => '2016-05-18 18:00'
];
$response = $campaignsApi->send($campaignId, $scheduleSettings); // send on scheduled time
A binary file was returned
{
  "id": 2418787,
  "count": 0,
  "mail_id": 2851096,
  "timezone": "120",
  "account_id": 441087,
  "campaign_type": "regular",
  "date": "2016-09-30 13:15:00",
  "end_time": "0000-00-00 00:00:00",
  "send_date": "2016-09-30 15:15:00",
  "opened": null,
  "clicked": null,
  "status": "draft",
  "campaign_name": "Test regular campaign",
  "mails": [
    {
      "id": 2851096,
      "date": "2015-12-28 17:25:31",
      "subject": "Test regular campaign",
      "code": "t4h8j0",
      "from": "demo@mailerlite.com",
      "from_name": "Demo",
      "url": "Test-regular-campaign-2851096",
      "send_date": "2016-09-30 15:15:00",
      "host": "mailerlite.com",
      "type": "custom_html",
      "updated": "2016-02-04 11:55:01",
      "language": {
        "code": "en",
        "title": "English"
      },
      "groups": [
        {
          "id": 2984475,
          "name": "Personal",
          "total": 7,
          "active": 7,
          "unsubscribed": 0,
          "bounced": 0,
          "unconfirmed": 0,
          "junk": 0,
          "sent": 4,
          "opened": 2,
          "clicked": 1,
          "ordering": 5,
          "updating": 0,
          "date": "2015-12-16 14:43:46",
          "updated": "2016-01-29 07:45:54"
        }
      ]
    }
  ]
}
{
  "error": {
    "code": 123,
    "message": "Campaign not found"
  }
}

Path Params

id
int32
required

ID of campaign

action
string
required

Action type. Possible values: send, cancel

 

Every action is active due to some conditions (campaign type) described in table below.

Action
Campaign type
Campaign Status
Description

send

regular
ab
followup

draft

You can send every campaign in draft which has step value equal to 3

cancel

regular
ab
followup
rss

outbox

You can cancel every campaign in outbox.

Please take attention that every action is available only for specific type campaigns:

  • send: you can send or schedule those campaigns which are in draft and has step value equal to 3
  • cancel: you can cancel only those campaigns which are in outbox

Send or schedule campaign

Send or schedule endpoint has additional body parameters associated with Google analytics, schedule and followup campaigns.

Campaign sending time

We provide two options how campaign can be sent regarding to sending time.

Send now

There is no need to use request parameters for all types of campaigns.

Send later (schedule)

For all types of campaigns:

  • type = 2
  • date is required
  • timezone_id is optional. Default value is ID of timezone which is associated with Account

Followup campaign schedule

If campaign type is followup, its followup mail will be sent 24 hours from campaign sending time by default. If you want to set custom time for followup campaign, then use these additional request parameters:

  • followup_schedule = specific
  • followup_date is required
  • followup_timezone_id is optional. Default value is ID of timezone which is associated with Account

Request Body Parameters

Parameter
Type
Description

type

Integer

Possible values:

  • 1 - send instantly (default value)
  • 2 - schedule send

followup_schedule

String

Possible values:

  • 24h - followup mail is sent in 24 hours (default value)
  • specific - must provide custom time described below

Only for followup campaigns

analytics

Integer

Possible values:

  • 0 - false
  • 1 - true

date

String

Format:

yyyy-mm-dd H:i

Available when type is 2

timezone_id

Integer

ID of Timezone

Available when type is 2

followup_date

String

Format:

yyyy-mm-dd H:i

Available only for followup campaigns when followup_schedule is specific

followup_timezone_id

Integer

ID of Timezone

Available only for followup campaigns when followup_schedule is specific

Suggest Edits

/groups

Get list of groups

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/groups
curl -v http://api.mailerlite.com/api/v2/groups \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groups = $groupsApi->get(); // returns array of groups
A binary file was returned
[
  {
    "id": 3640549,
    "name": "Demo API v2 List",
    "total": 1,
    "active": 1,
    "unsubscribed": 0,
    "bounced": 0,
    "unconfirmed": 0,
    "junk": 0,
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "date_created": "2016-04-04 11:02:33",
    "date_updated": "2016-04-04 11:02:33"
  },
  {
    "id": 3640743,
    "name": "Demo Group",
    "total": 0,
    "active": 0,
    "unsubscribed": 0,
    "bounced": 0,
    "unconfirmed": 0,
    "junk": 0,
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "date_created": "2016-04-04 11:14:18",
    "date_updated": "2016-04-04 11:14:18"
  }
]

Query Params

limit
int32
offset
int32
filters
string
 

Response Body Parameters

Parameter
Type
Description

id

integer

ID of group

name

string

Title of group

total

integer

Total count of people in group

active

integer

Total count of active people in group

unsubscribed

integer

Total count of unsubscribed people in group

bounced

integer

Total count of bounced people in group

unconfirmed

integer

Total count of unconfirmed people in group

junk

integer

Total count of junk people in group

sent

integer

Total count of sent emails in a group

opened

integer

Total count of opens in a group

clicked

integer

Total count of clicks in a group

date_created

string

Date & time when group is created

date_updated

string

Date & time when group is updated

Suggest Edits

/groups/:id

Get single group by ID

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/groups/id
curl -v http://api.mailerlite.com/api/v2/groups/3640549 \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupId = 123;
$group = $groupsApi->find($groupId); // returns group object
A binary file was returned
[
  {
    "id": 3640549,
    "name": "Demo API v2 List",
    "total": 1,
    "active": 1,
    "unsubscribed": 0,
    "bounced": 0,
    "unconfirmed": 0,
    "junk": 0,
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "date_created": "2016-04-04 11:02:33",
    "date_updated": "2016-04-04 11:02:33"
  }
]
{
  "error": {
    "code": 123,
    "message": "Group not found"
  }
}

Path Params

id
int32
required
 

Response Body Parameters

Parameter
Type
Description

id

integer

ID of group

name

string

Title of group

total

integer

Total count of people in group

active

integer

Total count of active people in group

unsubscribed

integer

Total count of unsubscribed people in group

bounced

integer

Total count of bounced people in group

unconfirmed

integer

Total count of unconfirmed people in group

junk

integer

Total count of junk people in group

sent

integer

Total count of sent emails in a group

opened

integer

Total count of opens in a group

clicked

integer

Total count of clicks in a group

date_created

string

Date & time when group is created

date_updated

string

Date & time when group is updated

Suggest Edits

/groups

Create new group

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.mailerlite.com/api/v2/groups
curl -X POST http://api.mailerlite.com/api/v2/groups \
-d '{"name":"Demo Group"}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupData = ['name' => 'New Group'];
$groups = $groupsApi->create($groupData); // returns created group object
A binary file was returned
{
  "id": 3640743,
  "name": "Demo Group",
  "total": 0,
  "active": 0,
  "unsubscribed": 0,
  "bounced": 0,
  "unconfirmed": 0,
  "junk": 0,
  "sent": 0,
  "opened": 0,
  "clicked": 0,
  "date_created": null,
  "date_updated": null
}
{
  "error": {
    "code": 123,
    "message": "Group name must be provided"
  }
}

Body Params

name
string

Name of your group

 

Response Body Parameters

Parameter
Type
Description

id

integer

ID of group

name

string

Title of group

total

integer

Total count of people in group

active

integer

Total count of active people in group

unsubscribed

integer

Total count of unsubscribed people in group

bounced

integer

Total count of bounced people in group

unconfirmed

integer

Total count of unconfirmed people in group

junk

integer

Total count of junk people in group

sent

integer

Total count of sent emails in a group

opened

integer

Total count of opens in a group

clicked

integer

Total count of clicks in a group

date_created

string

Date & time when group is created

date_updated

string

Date & time when group is updated

Suggest Edits

/groups/:id

Update existing group

 

Header Auth

 Authentication is required for this endpoint.
puthttps://api.mailerlite.com/api/v2/groups/id
curl -X PUT http://api.mailerlite.com/api/v2/groups/3640743 \
-d "{name:'Renamed Group'}" \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupId = 123;
$groupData = ['name' => 'Awesome Group'];
$group = $groupsApi->update($groupId, $groupData); // returns updated group object
A binary file was returned
{
  "id": 3640743,
  "name": "Renamed Group",
  "total": 0,
  "active": 0,
  "unsubscribed": 0,
  "bounced": 0,
  "unconfirmed": 0,
  "junk": 0,
  "sent": 0,
  "opened": 0,
  "clicked": 0,
  "date_created": "2016-04-04 11:14:18",
  "date_updated": "2016-04-04 11:14:18"
}
{
  "error": {
    "code": 123,
    "message": "Group not found"
  }
}
{
  "error": {
    "code": 123,
    "message": "Group name must be provided"
  }
}

Path Params

id
string
required

ID of group

Body Params

name
string

Name of group

 

Response Body Parameters

Parameter
Type
Description

id

integer

ID of group

name

string

Title of group

total

integer

Total count of people in group

active

integer

Total count of active people in group

unsubscribed

integer

Total count of unsubscribed people in group

bounced

integer

Total count of bounced people in group

unconfirmed

integer

Total count of unconfirmed people in group

junk

integer

Total count of junk people in group

sent

integer

Total count of sent emails in a group

opened

integer

Total count of opens in a group

clicked

integer

Total count of clicks in a group

date_created

string

Date & time when group is created

date_updated

string

Date & time when group is updated

Suggest Edits

/groups/:id

Remove group

 

Header Auth

 Authentication is required for this endpoint.
deletehttps://api.mailerlite.com/api/v2/groups/id
curl -X DELETE https://api.mailerlite.com/api/v2/groups/28353 \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupId = 123;

$groupsApi->delete($groupId);
A binary file was returned
{
  "success": true
}
{
  "error": {
    "code": 123,
    "message": "Group not found"
  }
}

Path Params

id
int32
required

ID of group

 
Suggest Edits

/groups/:id/subscribers

Get all subscribers in a specified group

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/groups/id/subscribers
curl -v http://api.mailerlite.com/api/v2/groups/3640549/subscribers \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupId = 123;
$groupSubscribers = $groupsApi->getSubscribers($groupId); // returns list of subscribers
$groupSubscribers = $groupsApi->limit(10)->getSubscribers($groupId); // returns maximum of 10 subscribers
A binary file was returned
[
  {
    "id": 1343965485,
    "email": "demo@mailerlite.com",
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "key": "email",
        "value": "demo@mailerlite.com",
        "type": "TEXT"
      },
      {
        "key": "name",
        "value": "Demo Subscriber",
        "type": "TEXT"
      },
      {
        "key": "last_name",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "company",
        "value": "MailerLite",
        "type": "TEXT"
      },
      {
        "key": "country",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "city",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "phone",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "state",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "zip",
        "value": "",
        "type": "TEXT"
      }
    ],
    "date_subscribe": "2016-04-04",
    "date_unsubscribe": null,
    "date_created": "2016-04-04"
  },
  {
    "id": 1343939473,
    "email": "justinas.posiunas@mailerlite.com",
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "key": "email",
        "value": "justinas.posiunas@mailerlite.com",
        "type": "TEXT"
      },
      {
        "key": "name",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "last_name",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "company",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "country",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "city",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "phone",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "state",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "zip",
        "value": "",
        "type": "TEXT"
      }
    ],
    "date_subscribe": "2016-04-04",
    "date_unsubscribe": null,
    "date_created": "2016-04-04"
  }
]
[
  {
    "id": 1125190581,
    "email": "john@doe.com",
    "sent": 1,
    "opened": 0,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "name": "name",
        "value": "John Doe"
      },
      {
        "name": "last_name",
        "value": "Doe",
      },
      {
        "name": "company",
        "value": "Doe Co."
      },
      {
        "name": "country",
        "value": "USA"
      },
      {
        "name": "city",
        "value": "San Francisco"
      },
      {
        "name": "state",
        "value": "California"
      },
      {
        "name": "phone",
        "value": "+123456789"
      },
      {
        "name": "zip",
        "value": ""
      }
    ],
    "date_subscribe": "2016-03-31",
    "date_unsubscribe": null,
    "date_created": "2016-03-31",
    "groups": [
      {
        "id": 2984475,
        "name": "Foo bar",
        "total": 6,
        "active": 6,
        "unsubscribed": 0,
        "bounced": 1,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 4,
        "opened": 2,
        "clicked": 1,
        "date_created": "2015-12-16 14:43:46",
        "date_updated": "2016-03-31 15:23:04"
      }
    ]
  },
  {
    "id": 1060028385,
    "email": "justinas.posiunas@mailerlite.com",
    "sent": 14,
    "opened": 5,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "name": "name",
        "value": "Justinas Pošiūnas"
      },
      {
        "name": "last_name",
        "value": "Pošiūnas",
      },
      {
        "name": "company",
        "value": "MailerLite"
      },
      {
        "name": "country",
        "value": "Lithuania"
      },
      {
        "name": "city",
        "value": "Vilnius"
      },
      {
        "name": "state",
        "value": "Lithuania"
      },
      {
        "name": "phone",
        "value": "+37061000000"
      },
      {
        "name": "zip",
        "value": ""
      }
    ],
    "date_subscribe": "2015-12-29",
    "date_unsubscribe": null,
    "date_created": "2015-11-16",
    "groups": [
      {
        "id": 2590376,
        "name": "Main List",
        "total": 5,
        "active": 5,
        "unsubscribed": 0,
        "bounced": 0,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 3,
        "opened": 3,
        "clicked": 2,
        "date_created": "2015-09-30 11:33:42",
        "date_updated": "2015-11-27 14:20:10"
      },
      {
        "id": 2839197,
        "name": "Christmas Contest",
        "total": 11,
        "active": 11,
        "unsubscribed": 0,
        "bounced": 0,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 11,
        "opened": 9,
        "clicked": 2,
        "date_created": "2015-11-19 16:07:13",
        "date_updated": "2015-12-10 20:40:58"
      },
      {
        "id": 2984475,
        "name": "Facebook Leads",
        "total": 6,
        "active": 6,
        "unsubscribed": 0,
        "bounced": 1,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 4,
        "opened": 2,
        "clicked": 1,
        "date_created": "2015-12-16 14:43:46",
        "date_updated": "2016-01-05 15:23:04"
      }
    ]
  }
]

Path Params

id
int32
required

ID of group

Query Params

filters
string
offset
int32
limit
int32
type
string

available values: active, unsubscribed, bounced, junk, unconfirmed

 

Response is the array of Single Subscriber objects.

Additional endpoints

Also there is some additional endpoints associated with subscribers in group:

Getting a count of subscibers in a group

Endpoint

GET /groups/:group_id/subscribers/count

Response Example

{
  "count": 5
}

Getting subscribers in a group by type

Endpoint

GET /groups/:group_id/subscribers/:type

Possible values of :type:

  • active
  • unsubscribed
  • bounced
  • junk
  • unconfirmed

Response Example

The same structure as it is described above so response is the array of Single Subscriber objects.

Suggest Edits

/groups/:id/subscribers/:type

Get all subscribers in a specified group

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/groups/id/subscribers/type
curl -v http://api.mailerlite.com/api/v2/groups/3640549/subscribers \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupId = 123;
$groupSubscribers = $groupsApi->getSubscribers($groupId, 'unsubscribed'); // returns only unsubscribed subscribers
A binary file was returned
[
  {
    "id": 1343965485,
    "email": "demo@mailerlite.com",
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "key": "email",
        "value": "demo@mailerlite.com",
        "type": "TEXT"
      },
      {
        "key": "name",
        "value": "Demo Subscriber",
        "type": "TEXT"
      },
      {
        "key": "last_name",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "company",
        "value": "MailerLite",
        "type": "TEXT"
      },
      {
        "key": "country",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "city",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "phone",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "state",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "zip",
        "value": "",
        "type": "TEXT"
      }
    ],
    "date_subscribe": "2016-04-04",
    "date_unsubscribe": null,
    "date_created": "2016-04-04"
  },
  {
    "id": 1343939473,
    "email": "justinas.posiunas@mailerlite.com",
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "key": "email",
        "value": "justinas.posiunas@mailerlite.com",
        "type": "TEXT"
      },
      {
        "key": "name",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "last_name",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "company",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "country",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "city",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "phone",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "state",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "zip",
        "value": "",
        "type": "TEXT"
      }
    ],
    "date_subscribe": "2016-04-04",
    "date_unsubscribe": null,
    "date_created": "2016-04-04"
  }
]
[
  {
    "id": 1125190581,
    "email": "john@doe.com",
    "sent": 1,
    "opened": 0,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "name": "name",
        "value": "John Doe"
      },
      {
        "name": "last_name",
        "value": "Doe",
      },
      {
        "name": "company",
        "value": "Doe Co."
      },
      {
        "name": "country",
        "value": "USA"
      },
      {
        "name": "city",
        "value": "San Francisco"
      },
      {
        "name": "state",
        "value": "California"
      },
      {
        "name": "phone",
        "value": "+123456789"
      },
      {
        "name": "zip",
        "value": ""
      }
    ],
    "date_subscribe": "2016-03-31",
    "date_unsubscribe": null,
    "date_created": "2016-03-31",
    "groups": [
      {
        "id": 2984475,
        "name": "Foo bar",
        "total": 6,
        "active": 6,
        "unsubscribed": 0,
        "bounced": 1,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 4,
        "opened": 2,
        "clicked": 1,
        "date_created": "2015-12-16 14:43:46",
        "date_updated": "2016-03-31 15:23:04"
      }
    ]
  },
  {
    "id": 1060028385,
    "email": "justinas.posiunas@mailerlite.com",
    "sent": 14,
    "opened": 5,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "name": "name",
        "value": "Justinas Pošiūnas"
      },
      {
        "name": "last_name",
        "value": "Pošiūnas",
      },
      {
        "name": "company",
        "value": "MailerLite"
      },
      {
        "name": "country",
        "value": "Lithuania"
      },
      {
        "name": "city",
        "value": "Vilnius"
      },
      {
        "name": "state",
        "value": "Lithuania"
      },
      {
        "name": "phone",
        "value": "+37061000000"
      },
      {
        "name": "zip",
        "value": ""
      }
    ],
    "date_subscribe": "2015-12-29",
    "date_unsubscribe": null,
    "date_created": "2015-11-16",
    "groups": [
      {
        "id": 2590376,
        "name": "Main List",
        "total": 5,
        "active": 5,
        "unsubscribed": 0,
        "bounced": 0,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 3,
        "opened": 3,
        "clicked": 2,
        "date_created": "2015-09-30 11:33:42",
        "date_updated": "2015-11-27 14:20:10"
      },
      {
        "id": 2839197,
        "name": "Christmas Contest",
        "total": 11,
        "active": 11,
        "unsubscribed": 0,
        "bounced": 0,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 11,
        "opened": 9,
        "clicked": 2,
        "date_created": "2015-11-19 16:07:13",
        "date_updated": "2015-12-10 20:40:58"
      },
      {
        "id": 2984475,
        "name": "Facebook Leads",
        "total": 6,
        "active": 6,
        "unsubscribed": 0,
        "bounced": 1,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 4,
        "opened": 2,
        "clicked": 1,
        "date_created": "2015-12-16 14:43:46",
        "date_updated": "2016-01-05 15:23:04"
      }
    ]
  }
]

Path Params

id
int32
required

ID of group

type
string
required

available values: active, unsubscribed, bounced, junk, unconfirmed

Query Params

filters
string
offset
int32
limit
int32
 

The same endpoint as /groups/:id/subscribers but it has type parameter defined so results are filtered by its value.

Possible values of :type:

  • active
  • unsubscribed
  • bounced
  • junk
  • unconfirmed

Response is the array of Single Subscriber objects.

Getting a count of subscibers by type in a group

Endpoint

GET /groups/:group_id/subscribers/:type/count

Response Example

{
  "count": 5
}
Suggest Edits

/groups/:id/subscribers

Add new single subscriber to specified group

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.mailerlite.com/api/v2/groups/id/subscribers
curl -X POST https://api.mailerlite.com/api/v2/groups/3640549/subscribers \
-d '{"email":"demo@mailerlite.com", "name": "John", "fields": {"company": "MailerLite"}}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupId = 123;

$subscriber = [
  'email' => 'johndoe@mailerlite.com',
  'name' => 'John',
  'fields' => [
    'surname' => 'Doe',
    'company' => 'MailerLite'
  ]
];

$addedSubscriber = $groupsApi->addSubscriber($groupId, $subscriber); // returns added subscriber
var client = new RestClient("https://api.mailerlite.com/api/v2/groups/3640549/subscribers");
var request = new RestRequest(Method.POST);
request.AddHeader("x-mailerlite-apikey", "fc7b8c5b32067bcd47cafb5f475d2fe9");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"email\":\"demo@mailerlite.com\", \"name\": \"John\", \"fields\": {\"company\": \"MailerLite\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
HttpResponse<String> response = Unirest.post("https://api.mailerlite.com/api/v2/groups/3640549/subscribers")
  .header("content-type", "application/json")
  .header("x-mailerlite-apikey", "fc7b8c5b32067bcd47cafb5f475d2fe9")
  .body("{\"email\":\"demo@mailerlite.com\", \"name\": \"John\",  \"fields\": {\"company\": \"MailerLite\"}}")
  .asString();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.mailerlite.com/api/v2/groups/3640549/subscribers",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"email\":\"demo@mailerlite.com\", \"name\": \"John\", \"fields\": {\"company\": \"MailerLite\"}}",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json",
    "x-mailerlite-apikey: fc7b8c5b32067bcd47cafb5f475d2fe9"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "https://api.mailerlite.com/api/v2/groups/3640549/subscribers"

payload = "{\"email\":\"demo@mailerlite.com\", \"name\": \"John\", \"fields\": {\"company\": \"MailerLite\"}}"
headers = {
    'content-type': "application/json",
    'x-mailerlite-apikey': "fc7b8c5b32067bcd47cafb5f475d2fe9"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
POST /api/v2/groups/3640549/subscribers HTTP/1.1
Host: api.mailerlite.com
Content-Type: application/json
X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9

{"email":"demo@mailerlite.com", "name":"John", "fields": {"company": "MailerLite"}}
A binary file was returned
{
  "id": 1343965485,
  "name": "John",
  "email": "demo@mailerlite.com",
  "sent": 0,
  "opened": 0,
  "clicked": 0,
  "type": "active",
  "fields": [
    {
      "key": "email",
      "value": "demo@mailerlite.com",
      "type": "TEXT"
    },
    {
      "key": "name",
      "value": "John",
      "type": "TEXT"
    },
    {
      "key": "last_name",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "company",
      "value": "MailerLite",
      "type": "TEXT"
    },
    {
      "key": "country",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "city",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "phone",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "state",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "zip",
      "value": "",
      "type": "TEXT"
    }
  ],
  "date_subscribe": null,
  "date_unsubscribe": null,
  "date_created": "2016-04-04"
}
{
  "error": {
    "code": 123,
    "message": "Group not found"
  }
}

Path Params

id
int32
required

ID of group

Body Params

email
string

email of new subscriber

name
string
fields
array of strings

ex. ['name' => 'Justinas', 'company' => 'mailerlite'], default fields: name, last_name, company, country, city, state, zip, phone. also custom fields which are created in your account.

resubscribe
boolean

reactivate subscriber if value is true

autoresponders
boolean

autoresponders will be sent if value is true

type
string

available values: subscribed, active, unconfirmed

 

Response Body Parameters

Response contains Single Subscriber object.

Double opt-in for API

Find out how to enable it in our knowledge base.

Suggest Edits

/groups/:id/subscribers/import

Add many new subscribers to specified group at once

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.mailerlite.com/api/v2/groups/id/subscribers/import
curl -X POST http://api.mailerlite.com/api/v2/groups/123456/subscribers/import \
-d '{"subscribers": [{"email": "demo@mailerlite.com"}, {"email": "another.demo@mailerlite.com", "fields": {"name": "Another Demo", "company": "MailerLite"}}]}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupId = 123;

$subscribers = [
  [
    'email' => 'johndoe@mailerlite.com',
  	'fields' => [
    	'name' => 'John',
    	'surname' => 'Doe',
    	'company' => 'MailerLite'
  	],
    'email' => 'johndoejr@mailerlite.com',
  	'fields' => [
    	'name' => 'John Jr.',
    	'surname' => 'Doe',
    	'company' => 'MailerLite'
  	]
  ]
];

$options = [
	'resubscribe' => false,
  'autoresponders' => true // send autoresponders for successfully imported subscribers 
];

$addedSubscribers = $groupsApi->importSubscribers($groupId, $subscribers, $options); // returns imported subscribers divided into groups by import status
A binary file was returned
{
  "imported": [
    {
      "id": 1343991205,
      "email": "another.demo@mailerlite.com"
    }
  ],
  "updated": [
  ],
  "unchanged": [
    {
      "id": 1343965485,
      "email": "demo@mailerlite.com"
    }
  ],
  "errors": []
}
{
  "error": {
    "code": 123,
    "message": "Group not found"
  }
}
{
  "error": {
    "code": 123,
    "message": "Wrong data provided"
  }
}

Body Params

subscribers
array
resubscribe
boolean

reactivate subscriber if value is true

autoresponders
boolean

autoresponders will be sent if value is true

 

Response Body Parameters

Response contains Single Subscriber object.

Suggest Edits

/groups/:id/subscribers/(:subscriber_id)

Get all subscribers in a specified group

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/groups/id/subscribers/subscriber_id
curl -v http://api.mailerlite.com/api/v2/groups/3640549/subscribers/1343965485 \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupId = 123;
$groupSubscribers = $groupsApi->getSubscribers($groupId); // returns list of subscribers
$groupSubscribers = $groupsApi->limit(10)->getSubscribers($groupId); // returns maximum of 10 subscribers
A binary file was returned
{
  "id": 1343965485,
  "email": "demo@mailerlite.com",
  "sent": 0,
  "opened": 0,
  "clicked": 0,
  "type": "active",
  "fields": [
    {
      "key": "email",
      "value": "demo@mailerlite.com",
      "type": "TEXT"
    },
    {
      "key": "name",
      "value": "Demo Subscriber",
      "type": "TEXT"
    },
    {
      "key": "last_name",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "company",
      "value": "MailerLite",
      "type": "TEXT"
    },
    {
      "key": "country",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "city",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "phone",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "state",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "zip",
      "value": "",
      "type": "TEXT"
    }
  ],
  "date_subscribe": "2016-04-04",
  "date_unsubscribe": null,
  "date_created": "2016-04-04"
}
[
  {
    "id": 1125190581,
    "email": "john@doe.com",
    "sent": 1,
    "opened": 0,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "name": "name",
        "value": "John Doe"
      },
      {
        "name": "last_name",
        "value": "Doe",
      },
      {
        "name": "company",
        "value": "Doe Co."
      },
      {
        "name": "country",
        "value": "USA"
      },
      {
        "name": "city",
        "value": "San Francisco"
      },
      {
        "name": "state",
        "value": "California"
      },
      {
        "name": "phone",
        "value": "+123456789"
      },
      {
        "name": "zip",
        "value": ""
      }
    ],
    "date_subscribe": "2016-03-31",
    "date_unsubscribe": null,
    "date_created": "2016-03-31",
    "groups": [
      {
        "id": 2984475,
        "name": "Foo bar",
        "total": 6,
        "active": 6,
        "unsubscribed": 0,
        "bounced": 1,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 4,
        "opened": 2,
        "clicked": 1,
        "date_created": "2015-12-16 14:43:46",
        "date_updated": "2016-03-31 15:23:04"
      }
    ]
  },
  {
    "id": 1060028385,
    "email": "justinas.posiunas@mailerlite.com",
    "sent": 14,
    "opened": 5,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "name": "name",
        "value": "Justinas Pošiūnas"
      },
      {
        "name": "last_name",
        "value": "Pošiūnas",
      },
      {
        "name": "company",
        "value": "MailerLite"
      },
      {
        "name": "country",
        "value": "Lithuania"
      },
      {
        "name": "city",
        "value": "Vilnius"
      },
      {
        "name": "state",
        "value": "Lithuania"
      },
      {
        "name": "phone",
        "value": "+37061000000"
      },
      {
        "name": "zip",
        "value": ""
      }
    ],
    "date_subscribe": "2015-12-29",
    "date_unsubscribe": null,
    "date_created": "2015-11-16",
    "groups": [
      {
        "id": 2590376,
        "name": "Main List",
        "total": 5,
        "active": 5,
        "unsubscribed": 0,
        "bounced": 0,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 3,
        "opened": 3,
        "clicked": 2,
        "date_created": "2015-09-30 11:33:42",
        "date_updated": "2015-11-27 14:20:10"
      },
      {
        "id": 2839197,
        "name": "Christmas Contest",
        "total": 11,
        "active": 11,
        "unsubscribed": 0,
        "bounced": 0,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 11,
        "opened": 9,
        "clicked": 2,
        "date_created": "2015-11-19 16:07:13",
        "date_updated": "2015-12-10 20:40:58"
      },
      {
        "id": 2984475,
        "name": "Facebook Leads",
        "total": 6,
        "active": 6,
        "unsubscribed": 0,
        "bounced": 1,
        "unconfirmed": 0,
        "junk": 0,
        "sent": 4,
        "opened": 2,
        "clicked": 1,
        "date_created": "2015-12-16 14:43:46",
        "date_updated": "2016-01-05 15:23:04"
      }
    ]
  }
]

Path Params

id
int32
required

ID of a group

subscriber_id
string
required

ID of a subscriber

 

A response is an array of Single Subscriber objects.

Suggest Edits

/groups/:id/subscribers/:subscriber_id or :email

Remove single subscriber from specified group

 

Header Auth

 Authentication is required for this endpoint.
deletehttps://api.mailerlite.com/api/v2/groups/id/subscribers/subscriber_identifier
curl -X DELETE https://api.mailerlite.com/api/v2/groups/123456/subscribers/123456789 \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$groupId = 123;
$subscriberId = 456;

$groupsApi->removeSubscriber($groupId, $subscriberId); // returns empty response
A binary file was returned
{
  "error": {
    "code": 123,
    "message": "Group not found"
  }
}
{
  "error": {
    "code": 123,
    "message": "Subscriber not found"
  }
}

Path Params

id
mixed type
required
subscriber_identifier
int32
required

ID or email of subscriber

 
Suggest Edits

/subscribers/(:id or :email)

Get single subscriber

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/subscribers/identifier
curl -v http://api.mailerlite.com/api/v2/subscribers/1343965485 \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$subscribersApi = (new \MailerLiteApi\MailerLite('your-api-key'))->subscribers();

$subscriber = $subscribersApi->find(123); // returns object of subscriber by its ID

$subscriber = $subscribersApi->find('johndoe@mailerlite.com'); // returns object of subscriber by its email
A binary file was returned
{
  "id": 1343965485,
  "name": "John",
  "email": "demo@mailerlite.com",
  "sent": 0,
  "opened": 0,
  "clicked": 0,
  "type": "active",
  "fields": [
    {
      "key": "email",
      "value": "demo@mailerlite.com",
      "type": "TEXT"
    },
    {
      "key": "name",
      "value": "John",
      "type": "TEXT"
    },
    {
      "key": "last_name",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "company",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "country",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "city",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "phone",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "state",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "zip",
      "value": "",
      "type": "TEXT"
    }
  ],
  "date_subscribe": null,
  "date_unsubscribe": null,
  "date_created": "2016-04-04"
}
{
  "id": 1060028385,
  "email": "justinas.posiunas@mailerlite.com",
  "sent": 21,
  "opened": 5,
  "clicked": 0,
  "type": "active",
  "fields": [
    {
      "name": "name",
      "value": "Justinas Pošiūnas"
    },
    {
      "name": "last_name",
      "value": "Pošiūnas",
    },
    {
      "name": "company",
      "value": "MailerLite"
    },
    {
      "name": "country",
      "value": "Lithuania"
    },
    {
      "name": "city",
      "value": "Vilnius"
    },
    {
      "name": "state",
      "value": "Lithuania"
    },
    {
      "name": "phone",
      "value": "+37061000000"
    },
    {
      "name": "zip",
      "value": ""
    }
  ],
  "date_subscribe": null,
  "date_unsubscribe": null,
  "date_created": "2015-12-31",
  "groups": [
    {
      "id": 2590376,
      "name": "Main List",
      "total": 5,
      "active": 5,
      "unsubscribed": 0,
      "bounced": 0,
      "unconfirmed": 0,
      "junk": 0,
      "sent": 3,
      "opened": 3,
      "clicked": 2,
      "date_created": "2015-09-30 11:33:42",
      "date_updated": "2015-11-27 14:20:10"
    },
    {
      "id": 2984475,
      "name": "Subscribers from website",
      "total": 6,
      "active": 6,
      "unsubscribed": 0,
      "bounced": 1,
      "unconfirmed": 0,
      "junk": 0,
      "sent": 4,
      "opened": 2,
      "clicked": 1,
      "date_created": "2015-12-16 14:43:46",
      "date_updated": "2016-01-05 15:23:04"
    }
  ]
}
{
  "error": {
    "code": 123,
    "message": "Subscriber not found"
  }
}

Path Params

identifier
mixed type
required

ID or email of subscriber

 

Response Body Parameters

Parameter
Type
Description

id

integer

ID of a subscriber

email

string

Email address

name

string

Name of a subscriber

sent

integer

Count of emails sent to subscriber

opened

integer

Count of emails opened by subscriber

clicked

integer

Count of clicks made by subscriber

type

string

Available values:

  • active
  • bounced
  • unsubscribed
  • junk
  • unconfirmed

fields

array of objects Subscriber's Field Value

Array which contains default and custom fields.

date_subscribe

string

Important only when getting Subscribers in a Group. It shows when subscriber is added to group.

Date format: Y-m-d
Default value: null.

date_unsubscribe

string

Important only when getting Subscribers in a Group. It shows when subscriber's status changed to unsubscribed.

Date format: Y-m-d
Default value: null.

date_created

string

Date when subscriber is created

Date format: Y-m-d

Subscriber profile image

We use Gravatar profile images for subscriber profile in web application. The image below is used as default.

Suggest Edits

/subscribers/(:id or :email)

Update single subscriber

 

Header Auth

 Authentication is required for this endpoint.
puthttps://api.mailerlite.com/api/v2/subscribers/identifier
curl -X PUT http://api.mailerlite.com/api/v2/subscribers/22348 \
-d '{"type": "unsubscribed", "fields": {"name": "Demo", "company": "MailerLite"}}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: 12a1b1234abcd123123a1231234a1ab2"
<?php
$subscribersApi = (new \MailerLiteApi\MailerLite('your-api-key'))->subscribers();

// change type of subscriber
$subscriberId = 132;
$subscriberData = [
  'type' => 'unsubscribed',
];

$subscriber = $subscribersApi->update($subscriberId, $subscriberData); // returns object of updated subscriber

// change fields of subscriber
$subscriberEmail = 'johndoe@mailerlite.com';
$subscriberData = [
  'fields' => [
    'name' => 'John',
   	'company' => 'MailerLite'
  ]
];

$subscriber = $subscribersApi->update($subscriberEmail, $subscriberData); // returns object of updated subscriber
A binary file was returned
{
  "id": 1343965485,
  "email": "demo@mailerlite.com",
  "sent": 0,
  "opened": 0,
  "clicked": 0,
  "type": "unsubscribed",
  "fields": [
    {
      "key": "email",
      "value": "demo@mailerlite.com",
      "type": "TEXT"
    },
    {
      "key": "name",
      "value": "Demo",
      "type": "TEXT"
    },
    {
      "key": "last_name",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "company",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "country",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "city",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "phone",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "state",
      "value": "",
      "type": "TEXT"
    },
    {
      "key": "zip",
      "value": "",
      "type": "TEXT"
    }
  ],
  "date_subscribe": null,
  "date_unsubscribe": "2016-04-04 12:07:26",
  "date_created": "2016-04-04"
}

Path Params

identifier
mixed type
required

ID or email of subscriber

Body Params

fields
array of strings

Associated array where key is the same as field key

type
string

Available values: unsubscribed, active

resend_autoresponders
boolean

Defines if it is needed to resend autoresponders

 

Response Body Parameters

Response contains Single Subscriber objects.

Suggest Edits

/subscribers/search

Search for subscribers

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/subscribers/search
curl -v http://api.mailerlite.com/api/v2/subscribers/search?query=demo \
-H "X-MailerLite-ApiKey: 12a1b1234abcd123123a1231234a1ab2"
<?php
$subscribersApi = (new \MailerLiteApi\MailerLite('your-api-key'))->subscribers();

$query = 'john';

$subscribers = $subscribersApi->search($query); // returns array of subscriber objects that match query
A binary file was returned
[
    {
    "id": 1343965485,
    "email": "demo@mailerlite.com",
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "type": "active",
    "fields": [
      {
        "key": "email",
        "value": "demo@mailerlite.com",
        "type": "TEXT"
      },
      {
        "key": "name",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "last_name",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "company",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "country",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "city",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "phone",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "state",
        "value": "",
        "type": "TEXT"
      },
      {
        "key": "zip",
        "value": "",
        "type": "TEXT"
      }
    ],
    "date_subscribe": null,
    "date_unsubscribe": null,
    "date_created": "2016-04-04"
  }
]
[
  {
    "id": 1343965485,
    "email": "demo@mailerlite.com",
    "type": "active"
  }
]
[]

Query Params

query
string
offset
int32
limit
int32
minimized
boolean

returns minimized response with: id, email, type

 

Response Body Parameters

Response contains Single Subscriber objects.

Suggest Edits

/subscribers/(:id or :email)/groups

Get groups subscriber belongs to

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/subscribers/identifier/groups
curl -v http://api.mailerlite.com/api/v2/subscribers/:id/groups \
-H "X-MailerLite-ApiKey: 12a1b1234abcd123123a1231234a1ab2"
<?php
$subscribersApi = (new \MailerLiteApi\MailerLite('your-api-key'))->subscribers();

$subscriberEmail = 'johndoe@mailerlite.com';

$subscriberGroups = $subscribersApi->getGroups($subscriberEmail); // returns array of group objects subscriber belongs to
A binary file was returned
[
  {
    "id": 1996556,
    "name": "Main List",
    "total": 9,
    "active": 9,
    "unsubscribed": 0,
    "bounced": 0,
    "unconfirmed": 0,
    "junk": 0,
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "date_created": "2016-02-12 11:04:45",
    "date_updated": "2016-03-30 23:09:30"
  },
  {
    "id": 1996559,
    "name": "iPad App Subscribers",
    "total": 101,
    "active": 95,
    "unsubscribed": 6,
    "bounced": 0,
    "unconfirmed": 0,
    "junk": 0,
    "sent": 0,
    "opened": 0,
    "clicked": 0,
    "date_created": "2016-02-24 15:16:52",
    "date_updated": "2016-02-24 16:27:43"
  }
]

Path Params

identifier
mixed type
required

ID or email of subscriber

 

Response is an array of Group objects.

Suggest Edits

/subscribers/(:id or :email)/activity

Get activity (clicks, opens, etc) of selected subscriber

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/subscribers/identifier/activity
curl -v https://api.mailerlite.com/api/v2/subscribers/123123/activity \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$subscribersApi = (new \MailerLiteApi\MailerLite('your-api-key'))->subscribers();

$subscriberEmail = 'johndoe@mailerlite.com';

$subscriberActivity = $subscribersApi->getActivity($subscriberEmail); // returns array of action objects subscriber has been made
A binary file was returned
[
  {
    "date": "2016-03-24 22:52:02",
    "report_id": 3377235,
    "subject": "Demo Campaign #4",
    "type": "open"
  },
  {
    "date": "2016-03-16 11:07:36",
    "report_id": 3315097,
    "subject": "Demo campaign #3",
    "type": "open"
  },
  {
    "date": "2016-03-15 11:30:08",
    "report_id": 3305419,
    "subject": "5 books that changed our business",
    "type": "click",
    "link": "https://blog.mailerlite.com"
  },
  {
    "date": "2016-03-15 11:30:04",
    "report_id": 3305419,
    "subject": "5 books that changed our business",
    "type": "click",
    "link": "https://blog.mailerlite.com/2016/01/5-books-that-changed-our-business/"
  },
  {
    "date": "2016-03-15 11:29:59",
    "report_id": 3305419,
    "subject": "5 books that changed our business",
    "type": "open"
  },
  {
    "date": "2016-03-14 11:22:04",
    "report_id": 3301113,
    "subject": "Demo campaign #1",
    "type": "open"
  },
]
{
  "error": {
    "code": 123,
    "message": "Subscriber not found"
  }
}

Path Params

identifier
mixed type
required

ID or email of subscriber

 

Response Body Parameters

Paramater
Type
Description

date

string

Date & time when action is performed

report_id

integer

ID of report actions belongs to

subject

string

Subject of received email

type

string

Available values:

  • open
  • click
  • junk
  • bounce
  • unsubscribe
  • forward

Additional Response Body Parameters

These parameters are provided when the following condition is true:

type = click
Parameter
Type
Description

link_id

integer

ID of link object

link

string

URL value

These parameters are provided when the following condition is true:

type = forward
Parameter
Type
Description

receiver

object

receiver.name

string

Name of forwarded email receiver

receiver.email

string

Email of forwarded email receiver

sender

object

sender.name

string

Name of forwarded mail sender

sender.email

string

Email of forwarded mail sender

Suggest Edits

/subscribers/(:id or :email)/activity/:type

Get activity of selected subscriber by specified type (opens, clicks, etc)

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/subscribers/identifier/activity/type
curl -v https://api.mailerlite.com/api/v2/subscribers/123123/activity/clicks \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$subscribersApi = (new \MailerLiteApi\MailerLite('your-api-key'))->subscribers();

$subscriberEmail = 'johndoe@mailerlite.com';

$subscriberOpens = $subscribersApi->getActivity($subscriberEmail, 'opens'); // returns array of action objects subscriber has been made
A binary file was returned
[
  {
    "date": "2016-03-15 11:30:08",
    "report_id": 3305419,
    "subject": "5 books that changed our business",
    "type": "click",
    "link": "https://blog.mailerlite.com"
  },
  {
    "date": "2016-03-15 11:30:04",
    "report_id": 3305419,
    "subject": "5 books that changed our business",
    "type": "click",
    "link": "https://blog.mailerlite.com/2016/01/5-books-that-changed-our-business/"
  }
]
{
  "error": {
    "code": 123,
    "message": "Subscriber not found"
  }
}

Path Params

identifier
mixed type
required

ID or email of subscriber

type
string
required

Available values: opens, clicks, junks, bounces, unsubscribes, forwards, sendings

 

This endpoint is the same as Actions of Subscriber but it allows to get actions by specified type.

Suggest Edits

/fields

Get subscriber fields of account

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/fields
curl -v http://api.mailerlite.com/api/v2/fields \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$fieldsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->fields();

$fields = $fieldsApi->get(); // returns array of field objects
A binary file was returned
[
  {
    "id": 6,
    "title": "Name",
    "key": "name",
    "type": "TEXT",
    "date_updated": "",
    "date_created": ""
  },
  {
    "id": 8,
    "title": "Email",
    "key": "email",
    "type": "TEXT",
    "date_updated": "",
    "date_created": ""
  },
  {
    "id": 12,
    "title": "Company",
    "key": "company",
    "type": "TEXT",
    "date_updated": "",
    "date_created": ""
  },
  {
    "id": 14,
    "title": "Country",
    "key": "country",
    "type": "TEXT",
    "date_updated": "",
    "date_created": ""
  },
  {
    "id": 16,
    "title": "City",
    "key": "city",
    "type": "TEXT",
    "date_updated": "",
    "date_created": ""
  },
  {
    "id": 18,
    "title": "Phone",
    "key": "phone",
    "type": "TEXT",
    "date_updated": "",
    "date_created": ""
  },
  {
    "id": 20,
    "title": "State",
    "key": "state",
    "type": "TEXT",
    "date_updated": "",
    "date_created": ""
  },
  {
    "id": 22,
    "title": "ZIP",
    "key": "zip",
    "type": "TEXT",
    "date_updated": "",
    "date_created": ""
  },
  {
    "id": 24,
    "title": "Last name",
    "key": "last_name",
    "type": "TEXT",
    "date_updated": "",
    "date_created": ""
  },
  {
    "id": 28349,
    "title": "Favourite Color",
    "key": "favourite_color",
    "type": "TEXT",
    "date_updated": "2016-03-30 21:08:59",
    "date_created": "2016-03-30 21:08:59"
  }
]
 
Parameter
Type
Description

id

integer

ID of field

title

string

Title of field

key

string

Key of field which is generated automatically

type

string

Possible values:

  • TEXT
  • NUMBER
  • DATE

date_updated

string

Date & time.

Default: null

date_created

string

Date & time.

Default: null

Suggest Edits

/fields

Create new custom field in account

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.mailerlite.com/api/v2/fields
curl -X POST http://api.mailerlite.com/api/v2/fields \
-d '{"title": "Favourite Color"}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$fieldsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->fields();

$fieldData = [
  'title' => 'Eye Color',
  'type' => 'TEXT'
];

$addedField = $fieldsApi->create($fieldData); // returns created field object
A binary file was returned
{
  "id": 28353,
  "title": "Favourite Color",
  "key": "favourite_color",
  "type": "TEXT",
  "date_updated": "2016-04-04 15:46:15",
  "date_created": "2016-04-04 15:46:15"
}
{
  "error": {
    "code": 123,
    "message": "You must provide field title"
  }
}
{
  "error": {
    "code": 123,
    "message": "You used all available fields"
  }
}

Body Params

title
string

Title of field

type
string

Type of field. Available values: TEXT, NUMBER, DATE

 
Suggest Edits

/fields/:id

Update custom field in account

 

Header Auth

 Authentication is required for this endpoint.
puthttps://api.mailerlite.com/api/v2/fields/id
curl -X PUT http://api.mailerlite.com/api/v2/fields/28353 \
-d '{"title": "Renamed Group"}' \
-H "Content-Type: application/json" \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$fieldsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->fields();

$fieldId = 123;
$fieldData = [
  'title' => 'Eye Color',
  'type' => 'TEXT'
];

$updatedField = $fieldsApi->update($fieldId, $fieldData); // returns updated field object
A binary file was returned
{
  "id": 28353,
  "title": "Favourite Color",
  "key": "favourite_color",
  "type": "TEXT",
  "date_updated": "2016-04-04 15:46:15",
  "date_created": "2016-04-04 15:46:15"
}
{
  "error": {
    "code": 123,
    "message": "You must provide field title"
  }
}
{
  "error": {
    "code": 123,
    "message": "Field not found"
  }
}

Path Params

id
int32
required

ID of field

Body Params

title
string

Title of field

 
Suggest Edits

/fields/:id

Remove custom field from account

 

Header Auth

 Authentication is required for this endpoint.
deletehttps://api.mailerlite.com/api/v2/fields/id
curl -X DELETE http://api.mailerlite.com/api/v2/fields/28353 \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$fieldsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->fields();

$fieldId = 123;

$fieldsApi->delete($fieldId); // returns empty response if successful
A binary file was returned
{
  "error": {
    "code": 123,
    "message": "Field not found"
  }
}

Path Params

id
int32
required

ID of field

 
 
Code
Title

ar

(arabic)العربية

bg

Български

ca

Català

ch

Chinese

cz

Český

de

Deutsch

dk

Dansk

ee

Eesti

en

English

es

Español

fi

Finnish

fr

Français

frq

Français - Québec

gr

Ελληνικά

he

(hebrew)עברית

hr

Hrvatski

hu

Magyar

it

Italiano

lt

Lietuviškai

lv

Latviešu

mk

Македонски

mx

Español (Mexican)

nl

Nederlands

no

Norsk

pl

Polski

pr

(persian)فارسی

pt

Português

ptbr

Português (Brazil)

ro

Română

ru

Русский

se

Svenska

sk

Slovensky

sl

Slovenski

sr

Српски

tr

Türkçe

ua

Українська

Response Body Parameters

Parameter
Type
Description

code

String

Language code

title

String

Language title

Examples

{
  "code": "en",
  "title": "English"
}

Available languages

Suggest Edits

Subscriber's Field Value

 

This object is used in Single Subscriber object. Subscriber has fields parameter and it is array of that kind of objects described below.

Response Body Parameters

Parameter
Type
Description

key

string

URL friendly field name

value

string

Value of field

type

string

Allowed type for field value.

Available values:

  • TEXT
  • NUMBER
  • DATE

Examples

{
  "key": "first_name",
  "value": "Justinas",
  "type": "TEXT"
}
{
  "key": "favourite_color",
  "value": "MailerLite Green",
  "field_type": "TEXT"
}
 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/master/timezones/timezone_id
curl --request GET \
  --url https://api.mailerlite.com/api/master/timezones/timezone_id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.mailerlite.com/api/master/timezones/timezone_id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.mailerlite.com/api/master/timezones/timezone_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.mailerlite.com/api/master/timezones/timezone_id",
  "method": "GET",
  "headers": {},
  "processData": false
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
import requests

url = "https://api.mailerlite.com/api/master/timezones/timezone_id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
[
  {
    "id": 1,
    "time": 0,
    "gmt": "+00:00",
    "title": "Casablanca"
  },
  {
    "id": 2,
    "time": 0,
    "gmt": "+00:00",
    "title": "Coordinated Universal Time"
  },
  {
    "id": 3,
    "time": 60,
    "gmt": "+01:00",
    "title": "Dublin, Edinburgh, Lisbon, London"
  },
  {
    "id": 4,
    "time": 0,
    "gmt": "+00:00",
    "title": "Monrovia, Reykjavik"
  },
  {
    "id": 5,
    "time": 120,
    "gmt": "+02:00",
    "title": "Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"
  }
]
{
  "error": {
    "code": 123,
    "message": "Timezone not found"
  }
}
{
  "id": 18,
  "time": 180,
  "gmt": "+03:00",
  "title": "Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",
}

Path Params

timezone_id
int32
required
 

Response Body Parameters

Parameter
Type
Description

id

Integer

ID of timezone

time

Integer

Offset in minutes

gmt

String

GMT offset

title

String

List of cities or countries

Suggest Edits

/stats

Get basic stats for of account, such as subscribers, open/click rates and so on.

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.mailerlite.com/api/v2/stats
curl -v http://api.mailerlite.com/api/v2/stats \
-H "X-MailerLite-ApiKey: fc7b8c5b32067bcd47cafb5f475d2fe9"
<?php
$statsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->stats();

$stats = $statsApi->get();

// specify a unix timestamp in the past
$statsInThePast = $statsApi->getHistorical(1483228800);
A binary file was returned
{
    "subscribed": 10187,
    "unsubscribed": 1,
    "campaigns": 4,
    "sent_emails": 2,
    "open_rate": 0.1,
    "click_rate": 0.05,
    "bounce_rate": 0.05
}

Query Params

timestamp
int32

Specify UNIX timestamp if you want to receive stats values at the specific point in the past.