Update subscriber
Updates subscriber’s information, fields, groups or status.
Endpoint
Section titled “Endpoint”HTTP method: PATCH
https://api.sender.net/v2/subscribers/{email}or{phone}or{ID}
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
Email, phone number, or ID | string required | Subscriber’s email address, phone number, or ID |
firstname | string | Updated first name |
lastname | string | Updated last name |
groups | array | New groups assigned to the subscriber, you can use group ids separated by commas for more than one. |
fields | array | Provide an array formed by key - field name, value - field value. |
subscriber_status | string | The value must be one of ACTIVE, UNSUBSCRIBED, BOUNCED, SPAM_REPORTED |
phone | string | Phone number must include the country code: +370 or 00370 follow by a valid phone number |
trigger_automation | boolean | This property by default its true. You ca send it as false if you want not to activate an automation. |
sms_status | string | The value must be one of ACTIVE, UNSUBSCRIBED, BOUNCED, SPAM_REPORTED |
transactional_email_status | string | The value must be one of ACTIVE, UNSUBSCRIBED, BOUNCED, SPAM_REPORTED |
Request Examples
Section titled “Request Examples”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));$client = new \GuzzleHttp\Client();
$json = [ "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"];
$response = $client->patch( 'https://api.sender.net/v2/subscribers/{email}or{phone}or{ID}', [ 'headers' => [ 'Authorization' => 'Bearer [your-token]', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'json' => $json ]);
$body = $response->getBody()->getContents();$data = json_decode($body, true);print_r($data);import requestsimport json
url = "https://api.sender.net/v2/subscribers/{email}or{phone}or{ID}"
headers = { "Authorization": "Bearer [your-token]", "Content-Type": "application/json", "Accept": "application/json",}
payload = { "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"}
response = requests.request('PATCH', url, headers=headers, json=payload)
print(response.json())curl -X PATCH \"https://api.sender.net/v2/subscribers/{email}or{phone}or{ID}" \-H "Authorization: Bearer [your-token]" \-H "Content-Type: application/json" \-H "Accept: application/json" \-d '{"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"}'Response
Section titled “Response”{ "success": true, "message": "Success", "data": []}