Skip to Content
MailerLite
MailerLite API

Automation triggers

Create, read, update and delete the triggers that start an automation.

A trigger is what starts an automation. Every automation needs at least one before it can be enabled, and it can have up to three on plans that support multiple triggers.

Create and update calls take the same shape: a type that says what starts the workflow, and a data object holding the settings for that type. data is optional on create, so you can add an empty trigger and configure it later. Updates replace the whole data object, so send every field you want to keep.

Triggers can only be changed while the automation is inactive. A trigger's type cannot be changed once it exists. Delete it and create a new one instead.

If the automation was deleted, every endpoint on this page returns 410 Gone.

Trigger types

typeFires whendata fields
subscriber_joins_groupA subscriber is added to a groupgroup_ids: int[] (required), exclude_group_ids: int[]
subscriber_joins_segmentA subscriber starts matching a segmentsegment_id: int (required, the segment must have a filter)
clicks_linkA subscriber clicks a linklink: string (required, a valid URL)
form_completedA subscriber submits a form or landing pageform_type: string (required), form_id: int (required)
field_updatedA subscriber's field changesfield_id: int or "email" (required), field_operator: string (required, depends on the field's type), value: mixed (required for operators that compare a value)
anniversaryA date field comes round again each yearSee the date fields below
exact_dateA date field matches one specific dateSee the date fields below
manualOnly when you add subscribers yourselfNone
purchased_any_productA subscriber buys anythingecommerce_shop_id: int (required, an enabled shop)
purchased_from_categoryA subscriber buys from a categoryecommerce_shop_id: int (required), ecommerce_category_id: int (required)
purchased_specific_productA subscriber buys a given productecommerce_shop_id: int (required), ecommerce_product_id: int (required), variation_ids: int[] (omit for every variant)
abandoned_cartA subscriber leaves items in their cartecommerce_shop_id: int (required), unit: hours, days, weeks or months (required), value: int (required, min 1)
abandoned_checkoutA subscriber starts checkout and does not finishSame as abandoned_cart
purchase_frequencyA subscriber has not bought again within a periodecommerce_shop_id: int (required), interval: int (required, min 1), value: int (required, min 1), unit: string (required), order_cap: int (must be at least interval)

Not every shop supports every e-commerce trigger. Category, abandoned cart and abandoned checkout triggers are unavailable on some connected platforms, and the API rejects a shop that cannot support the trigger you asked for.

Date trigger fields

anniversary and exact_date take the same data fields:

FieldTypeRequiredNotes
field_idintyesA date custom field
group_idsint[]yesOnly subscribers in these groups are considered
exclude_group_idsint[]noSubscribers in these groups are skipped. Cannot overlap group_ids
send_hourstringyes"00" to "23"
send_minutestringyes"00", "15", "30" or "45"
start_before_timeintnoStart this long before the date
start_before_time_unitstringnoday or month
start_after_timeintnoStart this long after the date
start_after_time_unitstringnoday or month
use_timezonestringnoaccount, subscriber or custom. Defaults to account
timezone_idintconditionalRequired when use_timezone is custom

start_before_* and start_after_* are mutually exclusive. Send one pair or the other, not both. For anniversary triggers the offset must stay under 365 days or 12 months.

List automation triggers

Returns every trigger on an automation, with its type and its configuration. An automation can have up to three triggers, depending on your plan.

If you want to get all triggers of an automation use this GET request

GET https://connect.mailerlite.com/api/automations/{automation_id}/triggers

Response

Response code: 200 OK
{
  "data": [
    {
      "id": "203114222968636621",
      "type": "subscriber_joins_group",
      "group_ids": [
        "203105145192450069"
      ],
      "groups": [
        {
          "id": "203105145192450069",
          "name": "Test",
          "url": "https://connect.mailerlite.com/groups/203105145192450069"
        }
      ],
      "exclude_group_ids": [
        "203114217220344581"
      ],
      "excluded_groups": [
        {
          "id": "203114217220344581",
          "name": "Newsletter readers",
          "url": "https://connect.mailerlite.com/groups/203114217220344581"
        }
      ],
      "broken": false,
      "complete": true,
      "exit_when_no_longer_matches": false
    }
  ]
}

Create an automation trigger

Adds a trigger to an automation. type decides what starts the workflow. data holds the settings for that type. The automation must be inactive and below its trigger limit: three triggers on plans that support multiple triggers, one otherwise.

If you want to add a trigger to an automation use this POST request

POST https://connect.mailerlite.com/api/automations/{automation_id}/triggers

Request body

ParameterTypeRequiredLimitations
typestringyesWhat starts the automation. Must be one of the trigger types listed above, for example subscriber_joins_group or abandoned_cart
dataobjectnoThe trigger's configuration. The fields it takes depend on type, see the trigger types table above. Omit it to create an empty trigger and configure it later with the update endpoint

Request example:

{
  "type": "subscriber_joins_group",
  "data": {
    "group_ids": [
      "203105145192450069"
    ]
  }
}

Response

Response code: 201 Created
{
  "data": {
    "id": "203114222968636621",
    "type": "subscriber_joins_group",
    "group_ids": [
      "203105145192450069"
    ],
    "groups": [
      {
        "id": "203105145192450069",
        "name": "Test",
        "url": "https://connect.mailerlite.com/groups/203105145192450069"
      }
    ],
    "exclude_group_ids": [],
    "excluded_groups": [],
    "broken": false,
    "complete": true,
    "exit_when_no_longer_matches": false
  }
}

Get an automation trigger

Returns a single trigger with its type and its configuration.

If you want to get a single trigger use this GET request

GET https://connect.mailerlite.com/api/automations/{automation_id}/triggers/{trigger_id}

Response

Response code: 200 OK
{
  "data": {
    "id": "203114222968636621",
    "type": "subscriber_joins_group",
    "group_ids": [
      "203105145192450069"
    ],
    "groups": [
      {
        "id": "203105145192450069",
        "name": "Test",
        "url": "https://connect.mailerlite.com/groups/203105145192450069"
      }
    ],
    "exclude_group_ids": [
      "203114217220344581"
    ],
    "excluded_groups": [
      {
        "id": "203114217220344581",
        "name": "Newsletter readers",
        "url": "https://connect.mailerlite.com/groups/203114217220344581"
      }
    ],
    "broken": false,
    "complete": true,
    "exit_when_no_longer_matches": false
  }
}

Update an automation trigger

Replaces a trigger's configuration. Send the complete data payload for the trigger's type. Fields you leave out are cleared, not kept. The trigger's type cannot be changed here, and the automation must be inactive.

If you want to update a trigger use this PUT request

PUT https://connect.mailerlite.com/api/automations/{automation_id}/triggers/{trigger_id}

Request body

ParameterTypeRequiredLimitations
dataobjectnoThe trigger's configuration. The fields it takes depend on the trigger's type, see the trigger types table above

Request example:

{
  "data": {
    "group_ids": [
      "203105145192450069"
    ],
    "exclude_group_ids": [
      "203114217220344581"
    ]
  }
}

Response

Response code: 200 OK
{
  "data": {
    "trigger": {
      "id": "203114222968636621",
      "type": "subscriber_joins_group",
      "group_ids": [
        "203105145192450069"
      ],
      "groups": [
        {
          "id": "203105145192450069",
          "name": "Test",
          "url": "https://connect.mailerlite.com/groups/203105145192450069"
        }
      ],
      "exclude_group_ids": [
        "203114217220344581"
      ],
      "excluded_groups": [
        {
          "id": "203114217220344581",
          "name": "Newsletter readers",
          "url": "https://connect.mailerlite.com/groups/203114217220344581"
        }
      ],
      "broken": false,
      "complete": true,
      "exit_when_no_longer_matches": false
    },
    "trigger_data": {
      "track_ecommerce": false,
      "broken_workflow": false,
      "complete_workflow": false,
      "show_analytics": true,
      "valid": true,
      "repeatable": false,
      "repeatable_settings": {
        "mode": "wait",
        "value": 1,
        "unit": "day"
      }
    },
    "qualified_subscribers_count": 10
  }
}

Delete an automation trigger

Removes a trigger from an automation. The automation must be inactive. It cannot be enabled again until it has at least one configured trigger.

If you want to delete a trigger use this DELETE request

DELETE https://connect.mailerlite.com/api/automations/{automation_id}/triggers/{trigger_id}

Response

Response code: 204 No Content

On this page