The API is available only to registered users API key can be generate in Edit Account page. The parameter userDomain for using branded domains is available only to registered users with any paid subscription plan.
To interact with the URL shortening service, make a request to https://cutt.ly/api/api.php remotely (e.g., using the PHP file_get_contents function). Depending on the operation you wish to perform—whether shortening a link, editing an existing short link, or accessing URL statistics—you will need to include specific parameters in your request. The required parameters and their descriptions for each operation are outlined in the sections below.
status 7{"url":{"status":7,"shortLink":"https://cutt.ly/aB3x"}}
Link shortening
Link Shortening API Parameters
Below is the list of all possible parameters for the Link Shortening API. Required parameters are marked with Required, while optional ones are marked with Optional.
Parameter
Value
Description
Requirement Level
key
{{key}}
Your API key. Necessary to authenticate your request.
Required
short
{{short}}
URL you want to shorten. It must be encoded using urlencode().
Required
name
{{name}}
Your desired short link if not already taken.
Optional
userDomain
1
If set to 1, it will use the domain from the user account that is approved and has the status: active. Requires a paid subscription.
Optional
noTitle
1
Disables getting the page title from the source page meta tag, resulting in faster API response time. Available for Team Enterprise plan.
Optional
public
1
Sets public click stats for the shortened link via API. Available from Single plan.
public class Class1
{
private const string URL = "https://cutt.ly/api/api.php";
private string urlParameters = "?key={{key}}&short={{short}}&name={{name}}&userDomain=1";
static void Main(string[] args)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(URL);
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
// List data response.
HttpResponseMessage response = client.GetAsync(urlParameters).Result; // Blocking call! Program will wait here until a response is received or a timeout occurs.
if (response.IsSuccessStatusCode)
{
// Parse the response body.
var dataObjects = response.Content.ReadAsAsync>().Result; //Make sure to add a reference to System.Net.Http.Formatting.dll
foreach (var d in dataObjects)
{
Console.WriteLine("{0}", d.Name);
}
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}
//Make any other calls using HttpClient here.
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class NetClientGet {
public static void main(String[] args) {
try {
URL url = new URL("https://cutt.ly/api/api.php?key={{key}}&short={{short}}&name={{name}}&userDomain=1");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
if (conn.getResponseCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ conn.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader(
(conn.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
conn.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
As a reply, json string will be sent, containing following data
url => status: 1
the shortened link comes from the domain that shortens the link, i.e. the link has already been shortened
url => status: 2
the entered link is not a link
url => status: 3
the preferred link name is already taken
url => status: 4
Invalid API key
url => status: 5
the link has not passed the validation. Includes invalid characters
url => status: 6
The link provided is from a blocked domain
url => status: 7
OK - the link has been shortened
url => status: 8
You have reached your monthly link limit. You can upgrade your subscription plan to add more links.
If the status is equal to 7, then
url => date
date of shortening the link
url => shortLink
shortened link
url => fullLink
original link
url => title
website title
Errors
401 Unauthorized
Your API key is incorrect, and a JSON response with the parameter auth:false has been returned.
Subscription has expired or you've reached your shortening limit
You should consider upgrading your subscription plan.
You do not own provided domain
This occurs when you do not own the provided domain.
You do not own any domain
This occurs when you specified that you want to shorten using your own domain, but you do not own any.
Too many requests - see API limits - https://cutt.ly/subscriptions/checkout
This error indicates that you have exceeded the allowed number of requests within a certain time period. You should review the API limits and consider upgrading your plan to increase your request limit.
Example 1: Shorten URL
This is the simplest example where a URL is shortened with the minimum required parameters.
URL you want to shorten. It must be encoded using urlencode().
Required
Adding UTM tags, parameters, etc. The entered URL {{short}} should go through the built-in urlencode() function, then the link parameters will be sent, including UTM tags, etc.
Example 2: Shorten URL with Custom Alias (back-half)
This example shows how to shorten a URL with a custom alias (back-half).
URL you want to shorten. It must be encoded using urlencode().
Required
name
{{name}}
Your desired short link if not already taken.
Optional
Adding UTM tags, parameters, etc. The entered URL {{short}} should go through the built-in urlencode() function, then the link parameters will be sent, including UTM tags, etc.
Example 3: Shorten URL using Custom Domain
To shorten a URL using a custom domain, make a GET request to the endpoint below. You must include your API key, the URL you wish to shorten, and set the userDomain parameter to 1. Optionally, you can include other parameters such as name, noTitle, and public.
URL you want to shorten. It must be encoded using urlencode().
Required
userDomain
1
If set to 1, it will use the domain from the user account that is approved and has the status: active. Check subscription plans for more details - available with active paid subscription plan.
Optional
Adding UTM tags, parameters, etc. The entered URL {{short}} should go through the built-in urlencode() function, then the link parameters will be sent, including UTM tags, etc.
Example 4: Shorten URL with Custom Alias (back-half) using Custom Domain
This example shows how to shorten a URL with a custom alias (back-half) and using a custom domain.
URL you want to shorten. It must be encoded using urlencode().
Required
name
{{name}}
Your desired short link if not already taken.
Optional
userDomain
1
If set to 1, it will use the domain from the user account that is approved and has the status: active. Check subscription plans for more details - available with active paid subscription plan.
Adding UTM tags, parameters, etc. The entered URL {{short}} should go through the built-in urlencode() function, then the link parameters will be sent, including UTM tags, etc.
Example 5: Shorten URL using noTitle Parameter
To shorten a URL with a faster API response time, you can use the noTitle parameter. This parameter disables getting the page title from the source page meta tag. Optionally, you can include other parameters such as name and userDomain.
URL you want to shorten. It must be encoded using urlencode().
Required
noTitle
1
Faster API response time. This parameter disables getting the page title from the source page meta tag which results in faster API response time. Available for Team Enterprise plan.
Optional
Adding UTM tags, parameters, etc. The entered URL {{short}} should go through the built-in urlencode() function, then the link parameters will be sent, including UTM tags, etc.
Example 6: Shorten URL using public Parameter
To shorten a URL and set the click stats as public via API, you can use the public parameter. Optionally, you can include other parameters such as name, noTitle, and userDomain.
URL you want to shorten. It must be encoded using urlencode().
Required
public
1
Settings public click stats for shortened link via API. Available from Single plan.
Optional
Adding UTM tags, parameters, etc. The entered URL {{short}} should go through the built-in urlencode() function, then the link parameters will be sent, including UTM tags, etc.
Example: Shorten URL with TRAI SMS Compliant Custom Domain or 2s.ms Domain
This example demonstrates how to shorten a URL using a custom domain that complies with TRAI SMS regulations.
Specifies the use of custom domain with HEADER for TRAI SMS compliance. Custom domain or 2s.ms Domain with HEADER should be set as active in your dashboard.
Required
Example: Shorten URL with Custom Alias using TRAI SMS Compliant Custom Domain or 2s.ms Domain
This example demonstrates how to shorten a URL and specify a custom alias (name) using a custom domain that complies with TRAI SMS regulations.
Specifies the use of custom domain with HEADER for TRAI SMS compliance. Custom domain or 2s.ms Domain with HEADER should be set as active in your dashboard.
Required
name
{{name}}
The custom alias (name) for the shortened URL.
Optional
Link editing
Editing short links | from Single plan
In order to edit short link, open the file https://cutt.ly/api/api.php remotely (eg via the php file_get_contents), with the following parameters
Below is the list of all possible parameters for the Link Editing API. Specific examples of usage are provided for each case below.
Parameter
Value
Description
key
{{key}}
Your API key. Required to authenticate your request.
edit
{{edit}}
The shortened link you want to edit.
tag
{{tag}}
The TAG you want to add for the shortened link.
name
{{name}}
New alias/name, if not already taken.
delete
1
It will delete your shortened link.
source
{{sourceURL}}
It will change the source URL of the shortened link. Should be passed through urlencode().
unique
1, 15-1440, 0
Sets a unique stat count for a short link. unique=0 removes counting unique clicks, unique=1 for Single subscription plan. Time to count unique clicks can range from 15 to 1440 minutes (24h) for Team subscription plans.
title
{{title}}
It will change the title of the shortened link.
mobile
android, ios, windowsMobile, redirect
Sets up alternative redirects depending on the operating system on mobile devices. Parameter mobile is case sensitive and can be set to redirect | alternative | android | ios | windowsMobile.
destination
{{destinationURL}}
An encoded URL to be assigned in the mobile option. If the parameter is omitted, the destination from the mobile option will be removed.
expire
0 | 1
0 for click expiration, 1 for date expiration.
expireCond
number of clicks (integers), YYYY-MM-DD, 0
Set date of expiration (YYYY-MM-DD), expiration after reaching a certain number of clicks, or delete expiration by providing 0.
expireRedirect
{{redirectURL}}
Set the link destination after the expiration condition is met.
expireUnique
1 | 0
Define if clicks should be unique. 1 = yes, 0 = no.
password
{{password}}
The password you want to set for the link. Leave blank to remove the password.
abtest
0 | 1 | 2
Sets an AB test or ABC test on the link. 0 for deleting, 1 for AB test, 2 for ABC test.
abtest_b
0-100
Chance for B test. Cannot be lower than 0 or higher than 100.
abtest_bvariation
{{B_variationURL}}
URL for B variation.
abtest_c
0-100
Chance for C test. Cannot be lower than 0 or higher than 100. The sum of both B and C cannot exceed 100.
abtest_cvariation
{{C_variationURL}}
URL for C variation.
Status for editing short links
status => 1
OK
status => 2
Could not save in database
status => 3
The url does not exist or you do not own it
status => 4 (for source and for destination only)
URL didn't pass the validation
Errors
Insufficient subscription level
When using parameters without the required subscription.
Unique time must be between 15 - 1440 minutes
Time to count unique clicks must be from 15 minutes to 1440 minutes (24h).
Provided alias is unavailable
This alias is already in use and cannot be used.
Edit a Link - Add Tag
To edit a shortened link by adding a tag, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and the tag you want to add.
To edit a shortened link by changing its alias, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and the new alias you want to assign.
To edit a shortened link by changing its source URL, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and the new source URL.
It will change the source URL of the shortened link. You can change the source URL depending on your subscription plan. Should be passed through urlencode();.
Optional
Edit a Link - Set Unique Clicks
To edit a shortened link by setting unique click statistics, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and set the unique parameter.
Sets a unique stat count for a short link. unique=0 removes counting unique clicks. unique=1 for Single subscription plan. Time of uniqueness is 15 minutes. unique=15-1440 for Team subscription plans. Time to count unique clicks ranges from 15 minutes to 1440 minutes (24h).
Optional
Edit a Link - Set Unique Clicks to 1440 Minutes
To edit a shortened link by setting the unique click statistic period to 1440 minutes (24 hours), make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and set the unique parameter to 1440.
Sets a unique stat count for a short link. unique=0 removes counting unique clicks. unique=1 for Single subscription plan. The time of uniqueness is 15 minutes. unique=15-1440 for Team subscription plans. Time to count unique clicks ranges from 15 minutes to 1440 minutes (24h).
Optional
Edit a Link - Remove Unique Clicks
To edit a shortened link by removing the unique click statistic, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and set the unique parameter to 0.
Sets a unique stat count for a short link. Setting unique=0 removes counting unique clicks. unique=1 is for Single subscription plan. The time of uniqueness is 15 minutes. unique=15-1440 for Team subscription plans. Time to count unique clicks ranges from 15 minutes to 1440 minutes (24h).
Optional
Edit a Link - Set Title
To edit a shortened link by setting the title, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and set the title parameter to the desired title.
It will change the title of the shortened link. You can change the short link title depending on your subscription plan.
Optional
Edit a Link - Set Mobile Redirect
To edit a shortened link by setting mobile redirects, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and set the mobile parameter along with the corresponding destination.
Sets up alternative redirects depending on the operating system on mobile devices. Parameter mobile is case sensitive. Options: redirect (alternative all other devices) | android | ios | windowsMobile.
Optional
destination
{{destinationURL}}
An encoded URL to be assigned in the mobile option. If the parameter is omitted (only mobile parameter is posted), then the destination from the mobile option will be removed.
Optional
Edit a Link - Remove Mobile Redirect
To remove a mobile redirect for a shortened link, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and set the mobile parameter to the operating system for which you want to remove the redirect.
Sets up alternative redirects depending on the operating system on mobile devices. Parameter mobile is case sensitive. Options: redirect (alternative all other devices) | android | ios | windowsMobile.
Optional
Edit a Link - Set Mobile Deep Link
This example demonstrates how to edit a shortened link and set a direct mobile deep link.
Works for both Android and iOS by changing the mobile parameter.
Android application package name (e.g. com.example.app).
Optional
Edit a Link - Set Android Deferred Deep Link with Referrer
This example demonstrates how to set a deferred deep link payload for Android.
The referrer value is passed to the app via Google Play Install Referrer API.
Removes the Android application package and all deferred deep link data.
Optional
Edit a Link - Delete Shortened Link with Specific Edit
To delete a specific shortened link, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and set the delete parameter to 1.
To set an expiration for a shortened link based on the number of clicks, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and configure the expiration settings using the parameters expire, expireCond, expireRedirect, and expireUnique.
Set date of expiration (YYYY-MM-DD), expiration after reaching a certain number of clicks, or delete expiration by providing 0.
Required
expireRedirect
{{redirectURL}}
Set the link destination after the expiration condition is met.
Required
expireUnique
1
Define if clicks should be unique. 1 = yes, 0 = no.
Optional
Edit a Link - Set Expiration (Date)
To set an expiration for a shortened link based on a specific date, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and configure the expiration settings using the parameters expire, expireCond, expireRedirect, and expireUnique.
Set date of expiration (YYYY-MM-DD), expiration after reaching a certain number of clicks, or delete expiration by providing 0.
Required
expireRedirect
{{redirectURL}}
Set the link destination after the expiration condition is met.
Required
expireUnique
1
Define if clicks should be unique. 1 = yes, 0 = no.
Optional
Edit a Link - Remove Expiration
To remove an expiration setting from a shortened link, make a GET request to the endpoint below. You must include your API key, the shortened link to be edited, and configure the expiration settings using the parameters expire, expireCond, expireRedirect, and expireUnique.
Set date of expiration (YYYY-MM-DD), expiration after reaching a certain number of clicks, or delete expiration by providing 0.
Required
Set Password
To set a password to a shortened link using this API, make a POST request to the endpoint below. You must include your API key, the link you want to add a password to, and set the password status to 1 in the query parameters. Provide the actual password in the request body.
In the request body, include the password using form-data as shown below:
Key
Value
Description
password
Your password or blank if you want to remove
The password you want to set for the link. Leave blank to remove the password.
Set AB Test
To set up an AB/C test using this API, make a GET request to the endpoint below. You must include your API key, the shortened link you want to edit, and specify the parameters for the AB/C test.
Chance for B test. Cannot be lower than 0 or higher than 100.
Required
abtest_bvariation
{{B_variation_URL}}
URL for B variation.
Required
Set ABC Test
To set up an ABC test with C variation using this API, make a GET request to the endpoint below. You must include your API key, the shortened link you want to edit, and specify the parameters for the AB/C test, including the chances and URLs for both B and C variations.
Chance for B test. Cannot be lower than 0 or higher than 100.
Required
abtest_bvariation
{{B_variationURL}}
URL for B variation.
Required
abtest_c
0-100
Chance for C test. Cannot be lower than 0 or higher than 100. Has to be used with B chance. The sum of both B and C cannot be higher than 100.
Required
abtest_cvariation
{{C_variationURL}}
URL for C variation.
Required
AB/C Test - Remove
To remove an AB/C test from a shortened link using this API, make a GET request to the endpoint below. You must include your API key, the shortened link you want to edit, and set the abtest parameter to 0.
In order to access URL statistics, open the file https://cutt.ly/api/api.php remotely (eg via the php file_get_contents), with the following parameters
Parameter
Value
Description
Requirement Level
key
{{key}}
Your API key. Used to authenticate your request.
Required
url
{{shortenedURL}}
The shortened URL for which you want to check statistics.
Required
date_from
YYYY-MM-DD
Returns clicks from the start date. Can be used with date_to or separately. Available from Team subscription plan.
Optional
date_to
YYYY-MM-DD
Returns clicks until the end date. Can be used with date_from or separately. Available from Team subscription plan.
public class Class1
{
private const string URL = "https://cutt.ly/api/api.php";
private string urlParameters = "?key={{key}}&stats={{shortenedURL}}";
static void Main(string[] args)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(URL);
// Add an Accept header for JSON format.
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
// List data response.
HttpResponseMessage response = client.GetAsync(urlParameters).Result; // Blocking call! Program will wait here until a response is received or a timeout occurs.
if (response.IsSuccessStatusCode)
{
// Parse the response body.
var dataObjects = response.Content.ReadAsAsync>().Result; //Make sure to add a reference to System.Net.Http.Formatting.dll
foreach (var d in dataObjects)
{
Console.WriteLine("{0}", d.Name);
}
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}
//Make any other calls using HttpClient here.
//Dispose once all HttpClient calls are complete. This is not necessary if the containing object will be disposed of; for example in this case the HttpClient instance will be disposed automatically when the application terminates so the following call is superfluous.
client.Dispose();
}
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class NetClientGet {
public static void main(String[] args) {
try {
URL url = new URL("https://cutt.ly/api/api.php?key={{key}}&stats={{shortenedURL}}");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
if (conn.getResponseCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ conn.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader(
(conn.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
conn.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
In order to access URL statistics, open the file https://cutt.ly/api/api.php remotely (eg via the php file_get_contents), with the following parameters
stats=>date
Date of shortening the link
stats=>clicks
Total number of clicks
stats=>title
Title of the shortened link
stats=>fullLink
Original link
stats=>shortLink
Shortened link
stats=>facebook
The number of clicks from Facebook
stats=>twitter
The number of clicks from twitter
stats=>linkedin
The number of clicks from linkedin
stats=>rest
Other clicks
stats=>bots
The number of clicks from bots
In order to display subsequent data, it should take place in a loop. (E.g. for, while, foreach loop)
Let $i to be the next variable in the array.
stats=>refs=>ref=>$i=>link
displaying the domain from which you clicked on the link
stats=>refs=>ref=>$i=>clicks
displaying the number of clicks from that domain
stats=>devices=>geo=>$i=>tag
displaying the abbreviation of the country from which the link was clicked
stats=>devices=>geo=>$i=>clicks
displaying the number of clicks from this country
stats=>devices=>dev=>$i=>tag
displaying the type of device from which the link was clicked
stats=>devices=>dev=>$i=>clicks
displaying the number of clicks from this device
stats=>devices=>sys=>$i=>tag
displaying the operating system of the device from which the link was clicked
stats=>devices=>sys=>$i=>clicks
displaying the number of clicks from this system
stats=>devices=>bro=>$i=>tag
displaying the browser from which the link was clicked
stats=>devices=>bro=>$i=>clicks
displaying the number of clicks from this browser
stats=>devices=>brand=>$i=>tag
displaying the brand from which the link was clicked
stats=>devices=>brand=>$i=>clicks
displaying the number of clicks from this brand
stats=>devices=>lang=>$i=>tag
displaying the language set on the device from which the link was clicked
stats=>devices=>lang=>$i=>clicks
displaying the number of clicks from this language
stats=>bots=>bots=>$i=>name
displaying the bot from which the link was clicked
stats=>bots=>bots=>$i=>clicks
displaying the number of clicks from this bot
Errors
Incorrect date format
In case the date format is incorrect. The correct format of the given dates: YYYY-MM-DD, e.g. 2021-03-02
Insufficient subscription level
When using parameters without the required subscription plan.
Analytics - Get Statistics
To retrieve the number of successful clicks for a shortened URL, make a GET request to the endpoint below. You must include your API key and the shortened URL you want to get statistics for.
The shortened URL you want to check statistics for.
Required
Analytics - Date Range
To retrieve the number of clicks for a shortened URL within a specific date range, make a GET request to the endpoint below. You must include your API key, the shortened URL, and optionally specify the date range.