Textlocal Logo

API Documentation

Create Short URL

This command can be used to create a shortened URL using our built in Short URL Creator.

Resource URL

https://api.txtlocal.com/create_shorturl/

Sample Request

<?php
	// Account details
	$apiKey = urlencode('Your apiKey');

	// URL Information
	$url = "https://api.txtlocal.com";

	// Prepare data for POST request
	$data = array('apikey' => $apiKey, 'url' => $url);

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

	// URL Information
	$url = "https://api.txtlocal.com";

	// Prepare data for POST request
	$data = 'apikey=' . $apiKey . '&url=' . $url;

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

	// Process your response here
	echo $response;
?>

Sorry, we do not have an example for Class in the language you have chosen.

Parameters

url Use this field to specify the URL you want the shortened URL to redirect to.
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.

Sample Response

{
    "shorturl":"https://tx.vc/r/1sId",
    "status":"success"
}
<response>
    <shorturl>https://tx.vc/r/1sId</shorturl>
    <status>success</status>
</response>

Errors

Error Codes
185 No URL Specified
186 Invalid URL Specified