← Back to docs

Contact Lists & Contacts

Organise subscribers into contact lists, add and import contacts, attach metadata, and manage subscription status.

Menu

What a contact list is

A contact list is a named group of recipients with its own signup form, unsubscribe handling, and sending history. Lists are the audience you send newsletters and broadcasts to. Keep separate lists for separate intents. "Product Updates", "Billing Notices", "Beta Testers", so subscribers can opt in and out at the right granularity and your reporting stays meaningful.

For the full endpoint reference, see the Contact Lists API reference.

Create a list

curl -X POST https://api.euromail.dev/v1/contact-lists \
  -H "Authorization: Bearer em_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Updates",
    "description": "Monthly product news",
    "double_opt_in": true
  }'

Set double_opt_in to true (recommended, and required in practice for EU marketing mail) so new contacts must confirm via email before they are activated. See Signup Forms for the confirmation flow and GDPR Tooling for the consent record this creates.

Add a single contact

curl -X POST https://api.euromail.dev/v1/contact-lists/{list_id}/contacts \
  -H "Authorization: Bearer em_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "metadata": { "first_name": "Aino", "plan": "pro" }
  }'

metadata is arbitrary JSON stored with the contact. Use it for personalisation and segmentation. In a newsletter or broadcast that uses a template, each recipient's metadata is available under contact, so for this contact {{ contact.first_name }} is Aino and {{ contact.plan }} is pro. See Contact variables in templates.

Contact variables in templates

When a newsletter or broadcast uses a template, each recipient gets their own rendering. Their template data is the template_data you sent with the newsletter or broadcast, plus a contact object:

VariableValue
{{ contact.email }}The recipient's address
{{ contact.<field> }}Any field of the contact's metadata, such as {{ contact.first_name }}
<p>Hi {{ contact.first_name | default("there") }},</p>
{% if contact.plan == "pro" %}<p>Thanks for being a Pro customer.</p>{% endif %}

Things to know:

  • contact is reserved. If your own template_data has a contact key, it is replaced for each recipient.
  • contact.email is always the address the message goes to, even if the metadata has its own email field.
  • Missing values fail the render, as they do everywhere else. If the template prints {{ contact.first_name }} with no fallback, a recipient without that field gets a failed message with the reason, and the rest of the list still goes out. Use default or {% if %} for fields not every contact has.
  • Metadata that isn't a JSON object (a plain string, say) gives you only contact.email.
  • Newsletters and broadcasts with a raw html_body aren't rendered as templates, so these variables do nothing there.

Bulk import

To import many contacts at once, send a contacts array in the same endpoint instead of a single email:

curl -X POST https://api.euromail.dev/v1/contact-lists/{list_id}/contacts \
  -H "Authorization: Bearer em_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "contacts": [
      { "email": "[email protected]", "metadata": { "first_name": "A" } },
      { "email": "[email protected]", "metadata": { "first_name": "B" } }
    ]
  }'

Only import contacts who consented. Importing purchased or scraped lists wrecks deliverability and breaches GDPR. EuroMail screens new accounts for sudden bursts of cold contacts.

When you import into a double_opt_in list, decide whether the contacts have already confirmed consent elsewhere. If not, run them through the confirmation flow rather than activating them directly.

List and inspect contacts

# Contacts in a list, filtered by subscription status
curl "https://api.euromail.dev/v1/contact-lists/{list_id}/contacts?status=subscribed&page=1&per_page=100" \
  -H "Authorization: Bearer em_live_your_key_here"

# A single list with its stats
curl https://api.euromail.dev/v1/contact-lists/{list_id} \
  -H "Authorization: Bearer em_live_your_key_here"

Contacts carry a status. pending (awaiting double opt-in confirmation), subscribed, or unsubscribed. Only subscribed contacts receive broadcasts.

Remove a contact

curl -X DELETE https://api.euromail.dev/v1/contact-lists/{list_id}/contacts/{contact_id} \
  -H "Authorization: Bearer em_live_your_key_here"

Removing a contact deletes it from the list. To stop mailing someone while keeping the audit trail, an unsubscribe (which they trigger themselves, or you set) is usually the right action. See Suppressions.

Welcome emails

A list can automatically send a welcome email the moment a contact becomes subscribed. Configure the subject and body per list (dashboard or API); the send is deduplicated so a contact never receives two welcomes. This is the natural place to deliver a lead magnet or set expectations for cadence.

Set it up with PUT /v1/contact-lists/{id}/welcome-email:

curl -X PUT https://api.euromail.dev/v1/contact-lists/{list_id}/welcome-email \
  -H "Authorization: Bearer em_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "subject": "Welcome to the newsletter",
    "html_body": "<p>Thanks for subscribing.</p>",
    "text_body": "Thanks for subscribing.",
    "from_address": "[email protected]",
    "delay_seconds": 0
  }'
FieldNotes
enabledRequired. false turns the welcome email off.
subjectRequired when enabled, unless you use template_id.
html_body, text_bodyThe content. Cannot be combined with template_id.
template_idA stored template to send instead.
from_addressMay carry a display name, such as Acme News <[email protected]>, under the same rules as from on a send. Must be on a domain registered to your account. A sender that breaks a rule is refused with a 422 and nothing is saved. A named sender is stored and returned as "Acme News" <[email protected]>. If a list's sender was saved before these rules applied and its name breaks one, the welcome email is sent from the address without the name until you save a sender that passes. Leave it out to send from noreply@ your first verified domain.
delay_secondsHow long to wait after the contact subscribes, from 0 (at once) to 604800 (7 days). Defaults to 0.

When enabled, the welcome email needs content: a template_id, or an html_body or text_body. The response is the updated list. Read the current setup with GET /v1/contact-lists/{id}/welcome-email, which returns the same fields. Both calls need the contacts:manage scope.

How lists relate to other features

  • Signup forms feed contacts into a list. guide.
  • Newsletters / broadcasts send to a list. guide.
  • Unsubscribes and suppressions keep you compliant. guide.
  • GDPR export/erase operate across a contact's data. guide.

Send your first email in about 90 seconds

The free tier includes 3,000 emails a month. Email storage and AI processing in Finland, with a DPA on every plan.

Create free account See live delivery data