Skip to content

Unsubscribe API

unsubscribe

Synopsis

This API will unsubscribe users to a particular campaign. Once a user is subscribed to a campaign they will receive all auto responders and scheduled messages for that campaign until they are unsubscribed through the API or through normal STOP or STOP ALL SMS request. You may not import someone who has unsubscribed themselves from a campaign however may re-subscribe someone who has unsubscribed through the Subscribe API.

Request: XML

<REQUEST>
    <ACTION>unsubscribe</ACTION>
    <API_KEY>apiKey</API_KEY>
    <CAMPAIGNREF>Campaign Reference ID</CAMPAIGNREF>
    <MOBILE>Number to unsubscribe</MOBILE>
    <NOTIFY>'yes/no' on whether to notify user on opt-out</NOTIFY>
</REQUEST>

Request Parameters

Term Mandatory/Optional Description
ACTION Mandatory This is the name of the function you want to execute with the API.
API_KEY Mandatory The API key that is assigned to your account that is used for authentication. You can find this key on the API Settings page.
CAMPAIGNREF Mandatory This is the identifier of the Campaign you would like to unsubscribe the number to. You generated the campaignRef when you created the Campaign.
MOBILE Mandatory A Phone Number to unsubscribe to a campaign.
Notify Optional A mobile owner will be notified about being unsubscribed via a confirmation SMS (yes/no).

Response Parameters

Param Name Presence Description
STATUS Always “Success” or “Failure”.
CAMPAIGNREF Success Response Only This is the identifier of the Campaign you would like to unsubscribe the number to. You generated the campaignRef when you created the Campaign.
MOBILE Success Response Only A Phone Number to unsubscribe to a campaign.
ERRORCODE Error response only Error code associated with the error.
ERRORINFO Error response only Error message explaining the error code.

Request Example: XML

<REQUEST>
    <ACTION>unsubscribe</ACTION>
    <API_KEY>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</API_KEY>
    <CAMPAIGNREF>1116</CAMPAIGNREF>
    <MOBILE>11111111111</MOBILE>
    <NOTIFY>no</NOTIFY>
</REQUEST>

Response Example: Success

<RESPONSE>
    <STATUS>Success</STATUS>
    <CAMPAIGNREF>1116</CAMPAIGNREF>
    <MOBILE>11111111111</MOBILE>
</RESPONSE>

Response Example: Failure

<RESPONSE>
    <STATUS>Failure</STATUS>
    <ERRORCODE>E721</ERRORCODE>
    <ERRORINFO>Invalid campaignref</ERRORINFO>
</RESPONSE>

Postback Notification

Upon unsubscribing a number the system will generate a notification. For more details please visit the Mobile Unsubscribe section of the Opt-in Status Postback documentation.

General Error Codes

Code Description
E100 Invalid request. Make a valid request via GET/POST/XML with all the required variables.
E104 User Authentication Failed.
E105 This account has no API rights.
E106 You can call API every X seconds.
E107 This account has no rights to use this action.
E108 XML Parse error: $error.
E109 API not activated.
E112 IP was not whitelisted. API call rejected.
E113 Set throughput exceeded for this API action. API call rejected.
E114 Phone number is blacklisted. API call rejected.
E120 Account has reached the API request limit.
E503 Internal error.
Code Description
E718 The ‘campaignref’ is required
E721 Invalid campaignref
E901 The ‘mobile’ is required.
E905 Could not unsubscribe this number.