Skip to content

Update subscriber

Updates subscriber’s information, fields, groups or status.

HTTP method: PATCH

https://api.sender.net/v2/subscribers/{email}or{phone}or{ID}


ParameterTypeDescription
Email, phone number, or IDstring requiredSubscriber’s email address, phone number, or ID
firstnamestringUpdated first name
lastnamestringUpdated last name
groupsarrayNew groups assigned to the subscriber, you can use group ids separated by commas for more than one.
fieldsarrayProvide an array formed by key - field name, value - field value.
subscriber_statusstringThe value must be one of ACTIVE, UNSUBSCRIBED, BOUNCED, SPAM_REPORTED
phonestringPhone number must include the country code: +370 or 00370 follow by a valid phone number
trigger_automationbooleanThis property by default its true. You ca send it as false if you want not to activate an automation.
sms_statusstringThe value must be one of ACTIVE, UNSUBSCRIBED, BOUNCED, SPAM_REPORTED
transactional_email_statusstringThe value must be one of ACTIVE, UNSUBSCRIBED, BOUNCED, SPAM_REPORTED

const url = new URL("https://api.sender.net/v2/subscribers/{email}or{phone}or{ID}");
let headers = {
"Authorization": "Bearer [your-token]",
"Content-Type": "application/json",
"Accept": "application/json",
};
let bodyContent = {
"firstname": "Sender",
"lastname": "Support",
"groups": ["e320lO", "e7L7Xj"],
"fields": {"{$test_text}":"Documentation example - edit","{$test_num}": 9},
"subscriber_status": "UNSUBSCRIBED",
"phone": "+370XXXXXXXX",
"trigger_automation": false,
"transactional_email_status": "BOUNCED",
"sms_status": "UNSUBSCRIBED"
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(bodyContent)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Example Response
{
"success": true,
"message": "Success",
"data": []
}