MailerLite
MailerLite API

Fields

Create, update, list, and delete the custom fields you can attach to subscribers.

Fields can be assigned to subscribers

List all fields

If you want to list all of your fields, use this GET endpoint

GET https://connect.mailerlite.com/api/fields

Request parameters

ParameterTypeRequiredLimitations
limitintegernoAn account can have at most a 100 groups
pageintegernoCount starts from 1
filter[keyword]stringnoReturns partial matches
filter[type]stringnoCan be one of the following: text, number or date
sortstringnoCan be one of: name, type, Defaults to ascending order; prepend -, e.g. -name for descending order.

Response

Response Code: 200 OK
{
  "data": [
    {
      "id": "1",
      "name": "new field",
      "key": "new_field",
      "type": "text"
    }
  ],
  "links": {
    "first": "https://connect.mailerlite.com/api/fields?page=1",
    "last": "https://connect.mailerlite.com/api/fields?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "« Previous",
        "active": false
      },
      {
        "url": "https://connect.mailerlite.com/api/fields?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": null,
        "label": "Next »",
        "active": false
      }
    ],
    "path": "https://connect.mailerlite.com/api/fields",
    "per_page": 100,
    "to": 1,
    "total": 1
  }
}

Create a field

If you want to create a field that can be assigned to subscribers, use this POST request

POST https://connect.mailerlite.com/api/fields

Request body

ParameterTypeRequiredLimitations
namestringyesMaximum length of 255 characters
typestringyesCan be text, number or date

Response

Response Code: 200 OK
{
  "data": {
    "id": "1",
    "name": "new field",
    "key": "new_field",
    "type": "text"
  }
}

Error

If invalid data has been passed

Response Code: 422 Unprocessable Entity
{
  "message": "The given data was invalid.",
  "errors": {
    "type": ["The selected type is invalid."]
  }
}

Update a field

If you want to update a field, use this PUT request

PUT https://connect.mailerlite.com/api/fields/{field_id}

Request body

ParameterTypeRequiredLimitations
namestringyesMaximum length of 255 characters

Response

Response Code: 200 OK
{
  "data": {
    "id": "1",
    "name": "new field",
    "key": "new_field",
    "type": "text"
  }
}

Error

If invalid data has been passed

Response Code: 422 Unprocessable Entity
{
  "message": "The given data was invalid.",
  "errors": {
    "type": ["The name may not be greater than 255 characters."]
  }
}

Delete a field

If you want to delete a field, use this DELETE request

DELETE https://connect.mailerlite.com/api/fields/{field_id}

Response

Response code: 204 No Content

Error

Response Code: 404 Not found

On this page