Knowledgebase

Mark as Unsubscribed

If you are looking to set a contact's subscription status as "Unsubscribed", use this API.

Required Parameters to Submit Request

Method (PUT)

Endpoint URL: http://www.mydomain.com/api/markAsUnsubscribed/{id}

Parameter Type Required

Description 

$id int Yes It refers to contact ID of the email address which you want to be set as unsubscribed.

Response Parameters

Parameter Type Response
status string Success or Error
 

Example Request (CURL)

<?php
$id = 62;
$params = [
    'is_unsubscribed' => 1,
];
$api_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://sapmledomain.com/api/markAsUnsubscribed/$id");
//curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER,
    array('Content-Type: application/json', 'Authorization: Bearer ' . $api_token));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
print_r($response);
curl_close($ch);
?>


Success Response

{"status":"success","result":"Success: Contact has been successfully marked as Unsubscribed"}
Status value of the success response will be "Success"  along with a text-based success message.


Error Response

{"status":"error","result":"Error message goes here"}
Upon submitting an API request that ended up with an error, Its response will show you the status value as "Error" with a short text-based message referring to the nature of the error.
PUT
/api/markAsUnsubscribed/{id}
Try it out