Textlocal Logo

API Documentation

Create User API Key

A Reseller only service Requires Advanced Reseller API This command will create a new a API key for a sub account under a dual brand or white label provider account.

Resource URL

https://api.textlocal.in/create_user_apikey/

Sample Request

<?php

$data = [
    'apiKey' => 'Your API Key',
    'user_id' => '12345',
    'notes' => 'My API Key',
    'ip_addresses' => '127.0.0.1,192.168.4.88',
];

// Send the POST request with cURL
$ch = curl_init('https://api.textlocal.in/create_user_apikey/');
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

	$data = [
	    'apiKey' => 'Your API Key',
	    'user_id' => '12345',
	    'notes' => 'My API Key',
	    'ip_addresses' => '127.0.0.1,192.168.4.88',
	];

	$data = http_build_query($data);

	// Send the GET request with cURL
	$ch = curl_init('https://api.textlocal.in/create_user_apikey/?' . $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);

	// Process your response here
	echo $response;

Parameters

user_id ID of the user you wish to add an API key to. Found in get_users
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.
Optional Parameters
notes A helpful note to identify the API key.
ip_addresses A comma separated list of IP addresses that are whitelisted to use the API key. If omitted, then the API key can be used from any IP address.

Sample Response

{
  "api_key": "GSi8ihLplrc-N39XO7AK8STYIG25QUBV1JPFC0ZRMD",
  "ip_addresses": [
    "127.0.0.1"
  ],
  "notes": "Hello World",
  "status": "success"
}
<?xml version="1.0" encoding="UTF-8"?>
<response>
    <api_key>GSi8ihLplrc-1A8EQO693ZLIDT7UHGW5Y0N2BCM4FP</api_key>
    <ip_addresses>
        <ip_addresse>127.0.0.1</ip_addresse>
    </ip_addresses>
    <notes>Hello World</notes>
    <status>success</status>
</response>

Errors

Error Codes
172 No reseller account found
311 This endpoint requires the advanced reseller API.
69 Invalid user ID specified.

Warnings

Warning Codes
400 Invalid IP address specified.
401 Invalid IP addresses specified.