Skip to content

Create new subscriber

Creates a new subscriber, providing basic information, fields and groups.

HTTP method: POST

https://api.sender.net/v2/subscribers


ParameterTypeDescription
emailstring requiredThe value must be a valid email address.
firstnamestringSubscriber firstname
lastnamestringSubscriber lastname
groupsarrayProvide the new groups assigned to the subscriber, by inserting the group id separated by commas for more than one.
fieldsarrayProvide an array formed by key - field name, value - field value.
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.

const url = new URL("https://api.sender.net/v2/subscribers");
let headers = {
"Authorization": "Bearer [your-token]",
"Content-Type": "application/json",
"Accept": "application/json",
};
let bodyContent = {
"email": "[email protected]",
"firstname": "Sender",
"lastname": "Support",
"groups": ["eZVD4w", "b2vAR1"],
"fields": {"{$test_text}":"Documentation example","{$test_num}": 8},
"phone": "+370XXXXXXXX",
"trigger_automation": false
};
fetch(url, {
method: "POST",
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": [],
"data": {
"id": "o2lk68Y",
"email": "[email protected]",
"firstname": "Sender",
"lastname": "Support",
"phone": "+370XXXXXXXX",
"phone_country": {
"phone_code": 370,
"country_code": "LT"
},
"created": "2021-04-08 11:06:34",
"location": null,
"status": {
"email": "active",
"temail": "active"
},
"ip_address": null,
"subscriber_tags": [
{
"id": "eZVD4w",
"title": "Test group"
},
{
"id": "b2vAR1",
"title": "My Renamed Group"
}
],
"columns": [
{
"id": "bDqoKd",
"title": "test num",
"type": "number",
"default": true,
"value": 1
},
{
"id": "avAlVe",
"title": "First name",
"type": "text",
"default": true,
"value": "Support"
},
{
"id": "dwBVJb",
"title": "Last name",
"type": "text",
"default": true,
"value": "Sender"
}
],
"sms_campaign": {
"sent_count": 0,
"clicked_count": 0,
"delivered_count": 0,
"failed_count": 0,
"unsubscribed_at": null,
"unsubscribed": 0
},
"email_campaign": {
"sent_count": 4,
"opened_count": 0,
"clicked_count": 0,
"unsubscribed": 0,
"bounced": 0,
"spam_reported": 0
}
}
}