API

Lists and subscribers

A site sends people from its own forms into your newsletter lists: a sign-up on the site becomes a subscriber in mailrust, with the same double opt-in as the list's own form.

Your lists

curl https://mail.example.com/api/v1/lists -H "Authorization: Bearer mr_..."
{
  "ok": true,
  "lists": [
    { "key": "37d85e995ab83f16be7f", "name": "Weekly news", "confirm": true, "subscribers": 20 }
  ]
}

key names the list in the requests below. confirm tells whether new people confirm by email first.

Add a subscriber

curl https://mail.example.com/api/v1/subscribers \
  -H "Authorization: Bearer mr_..." \
  -H "Content-Type: application/json" \
  -d '{
    "list": "37d85e995ab83f16be7f",
    "email": "ben@example.com",
    "name": "Ben",
    "tags": ["website", "trial"],
    "fields": { "plan": "trial" }
  }'
FieldWhat it is
list (required)The list's key
email (required)The address
nameUp to 200 characters
tagsA list of tags, or one string separated by spaces; up to 20
fieldsYour own fields: up to 30, each a string, a number or true/false, used in the list's emails
confirmedtrue when the person already confirmed on your side; skips the confirmation email
{ "ok": true, "status": "pending" }
StatusMeaning
pendingA confirmation email went out; the person joins once they press the link
activeThe person is on the list
existsThe person was already on the list
goneThe person unsubscribed earlier and is not added back without them
suppressedThe address bounced or complained before

A list takes up to 600 new people an hour through the API, because each of them gets an email. Import a ready base as a file in the list instead.

Unsubscribe

curl -X DELETE https://mail.example.com/api/v1/subscribers \
  -H "Authorization: Bearer mr_..." \
  -H "Content-Type: application/json" \
  -d '{ "list": "37d85e995ab83f16be7f", "email": "ben@example.com" }'
{ "ok": true, "status": "unsubscribed" }
StatusMeaning
unsubscribedDone
goneThe person had already left
absentThe address is not on the list