Opt a user out of one list or all lists.


We created a new viewing experience for our SMS API documentation. It's now all in one central location. Click here to check it out!


Parameter

Description

Required

list_idID of the list to opt the user out of. Set this to 0 (zero) to opt out of all of your lists.YES
msisdnMobile number of the member to opt outYES


Example


curl https://api.transmitsms.com/optout-list-member.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d 'list_id=1234567,556677' \
  -d msisdn=61491570158 \


JSON Response

{
  list_ids: [
    83454,
    9762
  ]
}

XML Response

<?xmlversion="1.0"encoding="UTF-8"?>
<response>
  <list_ids>83454</list_ids>
  <list_ids>9762</list_ids>
</response>


PHP Examples


<?php
  include '../../APIClient2.php';

  $api = new transmitsmsAPI('API_KEY', 'API_SECRET');

  // Opt out of specific lists
  $result = $api->optoutListMember('1223,5667', '6140000000');

  // Opt out of all lists
  $result = $api->optoutListMember(0, '6140000000');

  if ($result->error->code == 'SUCCESS') {
    echo "Message to {$result->recipients} recipients sent with ID 
      {$result->message_id}, cost {$result->cost}";

  } else {
    echo "Error: {$result->error->description}";
  }