# MailerLite

> Manage MailerLite subscribers, groups, segments, fields, campaigns, automations, forms and webhooks.

Lets an agent manage your MailerLite email marketing account - subscribers,
groups, segments, custom fields, campaigns, automations, forms and webhooks.

## What it can do

| Method | What it does |
| --- | --- |
| `mailerlite_list_subscribers` | List subscribers; filter by status, paginate by cursor, limit=0 for total count. |
| `mailerlite_get_subscriber` | Get a subscriber by id or email. |
| `mailerlite_upsert_subscriber` | Create or update a subscriber by email. |
| `mailerlite_update_subscriber` | Update a subscriber by id. |
| `mailerlite_delete_subscriber` | Delete a subscriber. |
| `mailerlite_forget_subscriber` | Forget a subscriber (GDPR erasure). |
| `mailerlite_get_subscriber_activity` | Get a subscriber's activity log. |
| `mailerlite_list_groups` | List groups. |
| `mailerlite_create_group` | Create a group. |
| `mailerlite_update_group` | Rename a group. |
| `mailerlite_delete_group` | Delete a group. |
| `mailerlite_get_group_subscribers` | List subscribers in a group. |
| `mailerlite_assign_subscriber_to_group` | Assign a subscriber to a group. |
| `mailerlite_unassign_subscriber_from_group` | Remove a subscriber from a group. |
| `mailerlite_list_fields` | List custom fields. |
| `mailerlite_create_field` | Create a custom field (text, number or date). |
| `mailerlite_update_field` | Rename a custom field. |
| `mailerlite_delete_field` | Delete a custom field. |
| `mailerlite_list_segments` | List segments. |
| `mailerlite_get_segment_subscribers` | List subscribers in a segment. |
| `mailerlite_update_segment` | Rename a segment. |
| `mailerlite_delete_segment` | Delete a segment. |
| `mailerlite_list_campaigns` | List campaigns; filter by status and type. |
| `mailerlite_get_campaign` | Get a campaign by id. |
| `mailerlite_create_campaign` | Create a campaign draft. |
| `mailerlite_update_campaign` | Update a draft or ready campaign. |
| `mailerlite_schedule_campaign` | Schedule or send a campaign. |
| `mailerlite_cancel_campaign` | Cancel a scheduled campaign (back to draft). |
| `mailerlite_delete_campaign` | Delete a campaign. |
| `mailerlite_get_campaign_activity` | Get per-subscriber activity for a campaign. |
| `mailerlite_list_automations` | List automations (workflows). |
| `mailerlite_get_automation` | Get one automation. |
| `mailerlite_get_automation_activity` | Get subscriber activity for an automation. |
| `mailerlite_list_forms` | List forms of a type (popup, embedded, promotion). |
| `mailerlite_get_form` | Get a form by id. |
| `mailerlite_update_form` | Rename a form. |
| `mailerlite_delete_form` | Delete a form. |
| `mailerlite_get_form_subscribers` | List subscribers who signed up via a form. |
| `mailerlite_list_webhooks` | List webhooks. |
| `mailerlite_get_webhook` | Get a webhook by id. |
| `mailerlite_create_webhook` | Create a webhook. |
| `mailerlite_update_webhook` | Update a webhook. |
| `mailerlite_delete_webhook` | Delete a webhook. |
| `mailerlite_list_timezones` | List available timezones (for scheduling). |
| `mailerlite_list_campaign_languages` | List campaign languages (for create). |

## How to get credentials

1. Open [dashboard.mailerlite.com/integrations/api](https://dashboard.mailerlite.com/integrations/api).
2. Under **API**, click **Generate new token**.
3. Name it (e.g. *FlyMyAI Agent*) and create it.
4. Copy the token - it is shown only once.

The token authenticates as your account via the
`Authorization: Bearer <token>` header against `https://connect.mailerlite.com/api`.

## Fields to fill in FlyMyAI

| FlyMyAI field | Where it comes from |
| --- | --- |
| `MAILERLITE_API_KEY` | Dashboard -> Integrations -> API -> Generate new token |

## Troubleshooting

- **401 Unauthorized** - the token is wrong or revoked. Generate a new one.
- **422 Unprocessable Entity** - a required field is missing or invalid;
  check the field types (e.g. custom field type must be text, number or date).
- **429 Too Many Requests** - you hit the rate limit; retry after a short wait.

## Links

- [MailerLite API tokens](https://dashboard.mailerlite.com/integrations/api)
- [API reference](https://developers.mailerlite.com/docs)
