ResourcesAPI documentation

mailkit.email.unsubscribe

Function mailkit.email.unsubscribe is used to unsubscribe recipient.

API call example:

XML

<?xml version="1.0"?>
<methodCall>
  <methodName>mailkit.email.unsubscribe</methodName>
  <params>
    <param>
      <value>
        <int>client_id</int>
      </value>
    </param>
    <param>
      <value>
        <string>client_md5</string>
      </value>
    </param>
    <param>
      <value>
        <int>email_id</int>
      </value>
    </param>
    <param>
      <value>
        <int>ID_send_message</int>
      </value>
    </param>
    <param>
      <value>
        <boolean>send_optout</boolean>
      </value>
    </param>
    <param>
     <value>
      <struct>
       <member>
        <name>timeout</name>
        <value>
         <boolean>1</boolean>
        </value>
       </member>
       <member>
        <name>timeout_days</name>
        <value>
         <int>60</int>
        </value>
       </member>
      </struct>
     </value>
   </param>
  </params>
</methodCall>
		

JSON

{ 
   "function":"mailkit.email.unsubscribe",
   "id":"client_id",
   "md5":"client_md5",
   "parameters":{ 
      "send_optout":"FALSE",
      "email":"email@example.com",
      "ID_email":null,
      "ID_send_message":"",
      "timeout":"true",
      "timeout_days":"60"
   }
}

Values

client_id* = client ID can be found in your Mailkit account's menu Profile / Integration / API settings.

client_md5* = MD5 code can be found in your Mailkit account's menu Profile / Integration / API settings.

email_id* = may contain ID of email address, (returned by mailkit.mailinglist.adduser), or email address. When this function is called the email specified will be marked as unsubscribed and won't be available for any future campaign deliveries. If you want to unsubscribe a phone number, you must enter it in the international format without spaces (eg + 420XXXXXXXXX).
email * = email address/phone number in international format without spaces (eg + 420XXXXXXXXX) to be unsubscribed. For JSON only.

ID_send_message = ID of a specific campaign delivery (Optional). When provided the unsubscribe will be recorded for the specific delivery.

send_optout = send opt-out confirmation email

  • TRUE = recipient will receive an email with confirmation of his opt-out (default value)
  • FALSE = recipient will not receive an email with confirmation of his opt-out

timeout = activate temporary unsubscribe - allowed values TRUE / FALSE

timeout_days = number of days for the unsubscribe to expire after, eg. how long will the recipient stay unsubscribed - allowed values are 14-90.

* required value

Successful call response:

XML

<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
  <params>
    <param>
      <value>
        <i4>282837490</i4>
      </value>
    </param>
  </params>
</methodResponse>
		

JSON

{
    "error_status": "0",
    "ID_email": "123456789",
    "status": "1"
}

Values

XML response only returns the ID of unsubscribed e-mail or email address/phone number in case the address doesn't exist in any lists.

JSON response contains:

ID_email - ID of the unsubscribed email address or email address/phone number in case the address doesn't exist in any lists.
error_status - error code
status - 1 (recipient unsubscribe succesfully), 2 (recipient has already been unsubscribed)

Unsuccessful call response:

XML

<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
  <params>
    <param>
      <value>
        <string>unknown email</string>
      </value>
    </param>
  </params>
</methodResponse>
		

JSON

{
   "error_status":1,
   "error":"Missing ID_email or email"
}

Values

Invalid ID_email or email = email address/phone number has wrong format / email ID does not exist for the account