API Documentation

The API is available only to registered users
API key can be generate in account edit page

URL Shortener

To shorten the link, open the file https://cutt.ly/api/api.php remotely (eg via the php file_get_contents), and in the parameters: short enter the address to be shortened, name specify the preferred shortening of the link.

example:
$json = file_get_contents(https://cutt.ly/api/api.php?key=[API_KEY]&short=[URL_YOU_WANT_SHORTEN]&name=[CUSTOM_URL_ALIAS]);

As a reply, string json will be sent. It should then be decoded using the php function $data = json_decode ($json, true)

In this way, an array with information about the shortened link will be returned: $data["url"]

UTM tags, parameters etc.
The entered link should go through the built-in urlencode() function, then the link parameters will be sent, including UTM tags etc.
Example:
$link = urlencode(https://example.com?p1=1&p2=2);
$json = file_get_contents($url."?key=$key&short=$link&name=$name");

$data["url"]["status"] in the case of shortening can return 5 values:

1: the shortened link comes from the domain that shortens the link, i.e. the link has already been shortened.
2: the entered link is not a link.
3: the preferred link name is already taken
4: Invalid API key
5: the link has not passed the validation. Includes invalid characters
6: The link provided is from a blocked domain
7: OK - the link has been shortened

If the status is equal to 7, then:

$data["url"]["date"] - date of shortening the link
$data["url"]["shortLink"] - shortened link
$data["url"]["fullLink"] - original link
$data["url"]["title"] - website title

Analytics

In the case of access to statistics, open the file https://cutt.ly/api/api.php remotely with the following parameter:

$json = file_get_contents(https://cutt.ly/api/api.php?key=[API_KEY]&stats=[SHORTENED_URL]);

As a reply, string json will be sent.
It should then be decoded using the php function $data = json_decode($json, true)
In this way, an array with information about the shortened url will be returned: $data["stats"]

In this case, $data["stats"]["status"] can return three values:

0: This shortened link does not exist
1: This link exists and the data has been downloaded
2: Invalid API key

If the status is 1, then:

$data["stats"]["date"] - date of shortening the link
$data["stats"]["clicks"] - total number of clicks
$data["stats"]["title"] - title of the shortened link
$data["stats"]["fullLink"] - original link
$data["stats"]["shortLink"] - shortened link
$data["stats"]["facebook"] - the number of clicks from facebook
$data["stats"]["twitter"] - the number of clicks from twitter
$data["stats"]["pinterest"] - Currently, this feature has been disabled. This does not affect the API in the scripts that implemented this feature.
$data["stats"]["googlePlus"] - Currently, this feature has been disabled. This does not affect the API in the scripts that implemented this feature.
$data["stats"]["linkedin"] - the number of clicks from linkedin
$data["stats"]["rest"] - other clicks

The display of subsequent data should take place in the loop, because the amount of data is not constant.
Let $i to be the next variable in the array.

$data["stats"]["refs"]["ref"][$i]["link"] - displaying the domain from which you clicked on the link
$data["stats"]["refs"]["ref"][$i]["clicks"] - displaying the number of clicks from that domain

$data["stats"]["devices"]["geo"][$i]["tag"] - displaying the abbreviation of the country from which the link was clicked
$data["stats"]["devices"]["geo"][$i]["clicks"] - displaying the number of clicks from this country

$data["stats"]["devices"]["dev"][$i]["tag"] - displaying the type of device from which the link was clicked
$data["stats"]["devices"]["dev"][$i]["clicks"] - displaying the number of clicks from this device

$data["stats"]["devices"]["sys"][$i]["tag"] - displaying the operating system of the device from which the link was clicked
$data["stats"]["devices"]["sys"][$i]["clicks"] - displaying the number of clicks from this system

$data["stats"]["devices"]["bro"][$i]["tag"] - displaying the browser from which the link was clicked
$data["stats"]["devices"]["bro"][$i]["clicks"] - displaying the number of clicks from this browser

See offers:
eco hosting

Subscribe to our newsletter

Subscribe to our newsletter and keep up to date with news and useful information on shortening links.