Mailrelay API Reference

Create or update a subscriber

POST https://{account}/api/v1/subscribers/sync

Authentication

Requires an API key sent in the X-AUTH-TOKEN header.

Create or update a subscriber

This method can be used when you want to add a subscriber regardless if it already exists.

Similar to create action, you should provide a default status which will be used if subscriber doesn't exists.

There are two optional parameters that you can provide:

Parameters

NameTypeRequiredDescription
replace_groups boolean No Set this to true if existing groups should be replaced when subscriber already exists.
replace_tags boolean No Set this to true if existing tags should be replaced when subscriber already exists.
restore_if_deleted boolean No Set this to true if deleted subscribers should be restored.
status string Yes Initial status of the subscriber
email string Yes Email
whatsapp_phone string No WhatsApp phone
name string No Name
address string No Address
city string No City
state string No State
country string No Country of the subscriber. The value should be in ISO 3166-1 alpha-2 format
birthday string No Birthday
website string No Website
locale string No Locale
time_zone string No Time zone
group_ids array No An array of group IDs that this subscriber should be assigned to. Example: [1, 4, 5]

Responses

StatusDescription
200 Subscriber was updated or restored
201 Subscriber was created
400 The request is invalid. Check if the field names in the request and the request data is valid.
422 A validation error occurred. Check the response body for more information.
401 The API key wasn't sent, is invalid or has expired
403 The API key or its user doesn't have permission to use this endpoint, or the request comes from an IP address the key doesn't allow.
429 Too many requests. You have exceeded the rate limit, wait and try again later.
500 An internal error happened. Try again later.

Response fields

NameTypeDescription
id integer ID
name string Name
email string Email
status string Status
sms_phone string SMS phone
sms_status string SMS status
whatsapp_phone string WhatsApp phone
whatsapp_status string WhatsApp status
subscribed_at string Subscribed at
subscribed_with_acceptance boolean Subscribed with acceptance
subscribe_ip string Subscribe ip
unsubscribed boolean Unsubscribed
unsubscribed_at string Unsubscribed at
unsubscribe_ip string Unsubscribe ip
unsubscribe_sent_email_id integer Unsubscribe sent email
score integer Score
address string Address
city string City
state string State
country string Country of the subscriber. The value should be in ISO 3166-1 alpha-2 format
birthday string Birthday
website string Website
time_zone string Time zone
locale string Locale
bounced boolean Bounced
bounce_category string Bounce category
reported_spam boolean Reported spam
local_ban boolean Local ban
global_ban boolean Global ban
created_at string Created at
updated_at string Updated at
groups array Groups
tags array Tags
custom_fields object Custom fields