Create and sync subscribers
Create audience members, update their data, and manage groups and subscription status deliberately.
A member represents a contact in a specific audience. Choose that audience explicitly, then separate data synchronization from subscription changes:
| Your intent | Operation |
|---|---|
| Add someone to an audience and start its subscription flow | POST /audiences/{audienceUuid}/members |
| Update an existing member's profile, groups, or custom fields | PUT /audiences/{audienceUuid}/members/{uuid} |
| Change whether an existing member receives messages | The dedicated subscribe or unsubscribe action |
POST can reuse an existing contact and trigger confirmation or welcome
messages. Use PUT for a routine data update. See Core concepts
for the relationship between contacts, members, and audiences.
All identifiers and contact details below are fictitious. Run requests from your backend, with your key kept outside client-side code. See Authentication for other authentication options.
Choose the audience
Prepare your server environment:
export EASYMAILING_API_KEY='YOUR_API_KEY'
API_BASE='https://api.easymailing.com'
MEMBER_EMAIL='alex@example.com'List audiences and select the destination intended by your integration:
curl --fail-with-body --silent --show-error \
"${API_BASE}/audiences" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json'Use the selected audience's uuid. Do not automatically choose the first
audience returned by the API.
AUDIENCE_UUID='11111111-1111-4111-8111-111111111111'Find an existing member
If you already saved this audience member's uuid, use it. Otherwise,
list members in the chosen audience
with an email filter:
curl --fail-with-body --silent --show-error --get \
"${API_BASE}/audiences/${AUDIENCE_UUID}/members" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json' \
--data-urlencode "email=${MEMBER_EMAIL}" \
--data-urlencode 'page=1' \
--data-urlencode 'itemsPerPage=50'The email filter performs a partial match. Compare each returned email
with the address you intend to synchronize, and check the audience. Follow
hydra:view / hydra:next before concluding that no matching member exists.
See Pagination, filters and errors.
Do not filter this lookup to confirmed members: an unsubscribed member still exists and should not accidentally enter a new subscription flow.
Store the matching member's uuid and @id with its audience in your own
integration. If a previous write timed out, read the member again before
deciding whether to repeat it; this lookup does not make writes atomic or
provide a deduplication guarantee.
Create a member
Use Create or Update a member when adding someone to the selected audience is an intended subscription action. The following request disables the welcome email but retains the audience's normal double opt-in behavior:
curl --fail-with-body --silent --show-error \
--request POST \
"${API_BASE}/audiences/${AUDIENCE_UUID}/members?disableWelcomeEmail=true" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json' \
--header 'Content-Type: application/json' \
--data-binary @- <<JSON
{
"email": "${MEMBER_EMAIL}",
"first_name": "Alex",
"last_name": "Morgan"
}
JSONThis request can send a confirmation email. A successful 201 response does
not mean the email subscription is already confirmed. For example, a member
awaiting confirmation may return this subset of fields:
{
"@id": "/audiences/11111111-1111-4111-8111-111111111111/members/22222222-2222-4222-8222-222222222222",
"uuid": "22222222-2222-4222-8222-222222222222",
"email": "alex@example.com",
"status": "suscriber.status.unconfirmed"
}The creation endpoint accepts these query options:
| Option | Effect |
|---|---|
disableWelcomeEmail=true | Suppresses the welcome email for this request. It does not disable confirmation. |
disableDoubleOptIn=true | Can bypass the audience's normal email confirmation step. It does not override a previous contact unsubscribe or guarantee confirmation. |
disableSmsDoubleOptIn=true | Bypasses the SMS confirmation step; use only when that SMS subscription behavior is intended. |
Leaving disableDoubleOptIn unset follows the audience configuration; it
does not force double opt-in on a single opt-in audience. If confirmation or
welcome emails are enabled, the audience needs its sender and reply-to settings.
If the contact has a phone number, creation may also start the audience's SMS
opt-in flow. That number can already exist on the contact even when this
request omits phone. Check the audience's SMS settings before using creation
as part of an integration with existing contacts.
Manage groups
Use the member UUID from the lookup or creation response:
MEMBER_UUID='22222222-2222-4222-8222-222222222222'Read the member to
inspect its current groups and subscription status:
curl --fail-with-body --silent --show-error \
"${API_BASE}/audiences/${AUDIENCE_UUID}/members/${MEMBER_UUID}" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json'List the audience's groups to choose a group from that same audience:
curl --fail-with-body --silent --show-error \
"${API_BASE}/audiences/${AUDIENCE_UUID}/groups" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json'Copy its uuid for the action URL. Use its @id when a request body needs a
group IRI.
GROUP_UUID='33333333-3333-4333-8333-333333333333'To add that group when the member does not already belong to it:
curl --fail-with-body --silent --show-error \
--request PUT \
"${API_BASE}/audiences/${AUDIENCE_UUID}/members/${MEMBER_UUID}/actions/add_to_group/${GROUP_UUID}" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json'To remove that group when it is currently assigned:
curl --fail-with-body --silent --show-error \
--request PUT \
"${API_BASE}/audiences/${AUDIENCE_UUID}/members/${MEMBER_UUID}/actions/remove_from_group/${GROUP_UUID}" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json'These actions change one membership. Compare the current state and apply only the changes needed. Do not assume repeated add/remove requests are guaranteed to succeed: an already assigned or already absent group can produce a validation error. Read the latest state before deciding how to handle it.
By contrast, the groups array on a member PUT is a replacement, not a
merge. Send every group you intend the member to retain. An explicit empty
array removes all group memberships.
Sync profile data and custom fields
List custom fields in the same audience:
curl --fail-with-body --silent --show-error \
"${API_BASE}/audiences/${AUDIENCE_UUID}/list_fields" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json'Select the field definition you intend to update and copy its @id into
custom_fields[].list_field. A bare UUID, a field tag such as CITY, or a
personalization tag is not the field IRI. Check the field's type and permitted
values; this example assumes an existing text field for a city.
Read the member again after any group changes. Populate CURRENT_GROUPS_JSON
with the complete array of group @id values from that fresh response. The
values below illustrate the format and must be replaced with the actual
member's groups and the selected field IRI:
CURRENT_GROUPS_JSON='["/audiences/11111111-1111-4111-8111-111111111111/groups/33333333-3333-4333-8333-333333333333"]'
CITY_FIELD_IRI='/audiences/11111111-1111-4111-8111-111111111111/list_fields/44444444-4444-4444-8444-444444444444'first_name and last_name belong to the shared contact. Updating them can
also change the name shown for that contact in other audiences. Groups,
custom fields, and subscription state belong to the selected audience member.
Update the existing member with profile changes, its retained groups, and the custom field value:
curl --fail-with-body --silent --show-error \
--request PUT \
"${API_BASE}/audiences/${AUDIENCE_UUID}/members/${MEMBER_UUID}" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json' \
--header 'Content-Type: application/json' \
--data-binary @- <<JSON
{
"first_name": "Alex",
"last_name": "Morgan",
"groups": ${CURRENT_GROUPS_JSON},
"custom_fields": [
{
"list_field": "${CITY_FIELD_IRI}",
"value": "Valencia"
}
]
}
JSONKeep status, sms_status, and channels out of this data update; they are
not fields in the member write schema. Use the separate actions below for
subscription changes. Coordinate concurrent group writers, because a group
list read earlier can become stale before this replacement is sent.
Change subscription status
The actions accept a channels array. If it is omitted, both email and SMS
are selected. These examples explicitly select email.
When an active member asks to stop receiving email from this audience, use Unsubscribe a member:
curl --fail-with-body --silent --show-error \
--request PUT \
"${API_BASE}/audiences/${AUDIENCE_UUID}/members/${MEMBER_UUID}/actions/unsubscribe" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json' \
--header 'Content-Type: application/json' \
--data '{"channels":["email"]}'The member record remains available for data synchronization. When the member explicitly wants to subscribe again, use Subscribe a member:
curl --fail-with-body --silent --show-error \
--request PUT \
"${API_BASE}/audiences/${AUDIENCE_UUID}/members/${MEMBER_UUID}/actions/subscribe" \
--header "X-Auth-Token: ${EASYMAILING_API_KEY}" \
--header 'Accept: application/ld+json' \
--header 'Content-Type: application/json' \
--data '{"channels":["email"]}'Email resubscription can require confirmation. Inspect the returned status
instead of assuming an HTTP success response means immediate activation.
Do not use repeated subscribe requests as a confirmation check; read the member.
Status values are fully qualified strings, including the API's spelling:
suscriber.status.confirmedindicates a confirmed email subscription.suscriber.status.unconfirmedindicates pending confirmation.suscriber.status.unsuscribedrepresents a contact unsubscribe.suscriber.status.unsuscribed.admincan be returned by the unsubscribe action.
Keep an inactive member inactive during profile synchronization. A new source record or a successful data update is not a request to resubscribe.