Textlocal Logo

API Documentation

Delete Contact

This command will remove a contact from a specific group.

Resource URL

https://api.txtlocal.com/delete_contact/

Sample Request

<?php
	// Account details
	$apiKey = urlencode('Your apiKey');
	
	// Contact details
	$group_id = '123456';
	$number = 447123456789;

	// Prepare data for POST request
	$data = array('apikey' => $apiKey, 'group_id' => $group_id, 'number' => $number);
 
	// Send the POST request with cURL
	$ch = curl_init('https://api.txtlocal.com/delete_contact/');
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);
	
	// Process your response here
	echo $response;
?>
<?php
	// Account details
	$apiKey = urlencode('Your apiKey');
	
	// Contact details
	$group_id = '123456';
	$number = urlencode('447123456789');

	// Prepare data for POST request
	$data = 'apikey=' . $apiKey . '&group_id=' . $group_id . '&number=' . $number;
 
	// Send the GET request with cURL
	$ch = curl_init('https://api.txtlocal.com/delete_contact/?' . $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);
	
	// Process your response here
	echo $response;
?>
<?php
	require('Textlocal.class.php');

	$Textlocal = new Textlocal(false, false, 'your apiKey');
	
	$contacts = array('447851236547','447852147936','447123456789');
	$group_id = 41029;
	
	$response = $Textlocal->deleteContacts($contacts, $group_id);
	print_r($response);
?>

Parameters

group_id ID of the group. Can either be found within Messenger (in the "Reports" - "Advanced Reports" - "List of Group ID's" section) or by running the get_groups command. Additionally group 5 contains "contacts" and group 6 contains "opt-outs".
number Mobile number of the contact to be deleted in international format (i.e. 447123456789).
Login Parameters (Additional Information)
apiKey You can create these in your Messenger Control Panel (click here) for each application, and limit the usage of them by host IP Address.

Caution: This will delete the specified contact, once deleted, it cannot be recovered.

Sample Response

{
	"group_id":123456,
	"number":447123456789,
	"status":"success"
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
	<group_id>123456</group_id>
	<number>447123456789</number>
	<status>success</status>
</response>

Errors

Error Codes
10 Invalid group ID.
25 No group ID specified.
51 No valid numbers specified.
55 No numbers specified.
61 Specified number(s) not found.