Introduction
T.LY URL Shortener API documentation to create URLs to track, brand, and share short links. This documentation aims to provide all the information you need to work with our API. Please contact [email protected] if you have any issues.
API docs for T.LY.
Base URL
https://t.ly
Authenticating requests
Authenticate requests to this API's endpoints by sending a query parameter api_token
in the request.
All authenticated endpoints are marked with a requires authentication
badge in the documentation below.
Please sign in and generate an API Token to begin using the API. On POST, PUT, and DELETE request the api_token parameter can be included in the BODY.
Endpoints
Create
requires authentication
Example request:
curl --request POST \
"https://t.ly/api/v1/link/shorten?api_token=%7BYOUR_API_TOKEN%7D" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"long_url\": \"http:\\/\\/example.com\\/\",
\"short_id\": \"new_url_ending\",
\"domain\": \"https:\\/\\/t.ly\\/\",
\"include_qr_code\": false,
\"expire_at_datetime\": \"2022-01-17 15:00:00\",
\"expire_at_views\": 9,
\"description\": \"Social Media Link\",
\"public_stats\": true,
\"password\": \"password123\"
}"
const url = new URL(
"https://t.ly/api/v1/link/shorten"
);
const params = {
"api_token": "{YOUR_API_TOKEN}",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"long_url": "http:\/\/example.com\/",
"short_id": "new_url_ending",
"domain": "https:\/\/t.ly\/",
"include_qr_code": false,
"expire_at_datetime": "2022-01-17 15:00:00",
"expire_at_views": 9,
"description": "Social Media Link",
"public_stats": true,
"password": "password123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://t.ly/api/v1/link/shorten',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'api_token'=> '{YOUR_API_TOKEN}',
],
'json' => [
'long_url' => 'http://example.com/',
'short_id' => 'new_url_ending',
'domain' => 'https://t.ly/',
'include_qr_code' => false,
'expire_at_datetime' => '2022-01-17 15:00:00',
'expire_at_views' => 9.0,
'description' => 'Social Media Link',
'public_stats' => true,
'password' => 'password123',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://t.ly/api/v1/link/shorten'
payload = {
"long_url": "http:\/\/example.com\/",
"short_id": "new_url_ending",
"domain": "https:\/\/t.ly\/",
"include_qr_code": false,
"expire_at_datetime": "2022-01-17 15:00:00",
"expire_at_views": 9,
"description": "Social Media Link",
"public_stats": true,
"password": "password123"
}
params = {
'api_token': '{YOUR_API_TOKEN}',
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload, params=params)
response.json()
Example response (200):
{
"short_url": "https://t.ly/c55j",
"description": null,
"long_url": "https://weatherextension.com/",
"domain": "https://t.ly/",
"short_id": "c55j",
"expire_at_views": null,
"expire_at_datetime": null,
"public_stats": false,
"created_at": "2022-01-16T19:32:20.000000Z",
"updated_at": "2022-01-16T19:32:20.000000Z"
}
Received response:
Request failed with error:
Stats
requires authentication
Example request:
curl --request GET \
--get "https://t.ly/api/v1/link/stats?api_token=%7BYOUR_API_TOKEN%7D&short_url=https%3A%2F%2Ft.ly%2FOYXL" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://t.ly/api/v1/link/stats"
);
const params = {
"api_token": "{YOUR_API_TOKEN}",
"short_url": "https://t.ly/OYXL",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://t.ly/api/v1/link/stats',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'api_token'=> '{YOUR_API_TOKEN}',
'short_url'=> 'https://t.ly/OYXL',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://t.ly/api/v1/link/stats'
params = {
'api_token': '{YOUR_API_TOKEN}',
'short_url': 'https://t.ly/OYXL',
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"clicks": 0,
"unique_clicks": 0,
"browsers": [],
"countries": [],
"referrers": [],
"platforms": [],
"daily_clicks": [],
"data": {
"description": null,
"long_url": "https://weatherextension.com/",
"short_url": "https://t.ly/c55j",
"created_at": "2022-01-16T19:10:36.000000Z"
}
}
Received response:
Request failed with error:
Get
requires authentication
Example request:
curl --request GET \
--get "https://t.ly/api/v1/link?api_token=%7BYOUR_API_TOKEN%7D&short_url=https%3A%2F%2Ft.ly%2Fc55j" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://t.ly/api/v1/link"
);
const params = {
"api_token": "{YOUR_API_TOKEN}",
"short_url": "https://t.ly/c55j",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://t.ly/api/v1/link',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'api_token'=> '{YOUR_API_TOKEN}',
'short_url'=> 'https://t.ly/c55j',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://t.ly/api/v1/link'
params = {
'api_token': '{YOUR_API_TOKEN}',
'short_url': 'https://t.ly/c55j',
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200):
{
"short_url": "https://t.ly/c55j",
"long_url": "https://weatherextension.com/",
"domain": "https://t.ly/",
"short_id": "c55j",
"expire_at_views": null,
"expire_at_datetime": null,
"public_stats": false,
"qr_code_url": "https://t.ly/qr?url=https://t.ly/c55j",
"qr_code_base64": "data:image/png;base64,iVBORw0KGgoA..."
}
Received response:
Request failed with error:
Update
requires authentication
Example request:
curl --request PUT \
"https://t.ly/api/v1/link?api_token=%7BYOUR_API_TOKEN%7D" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"short_url\": \"https:\\/\\/t.ly\\/OYXL\",
\"short_id\": \"new_url_ending\",
\"long_url\": \"https:\\/\\/weatherextension.com\\/\",
\"expire_at_datetime\": \"2022-01-17 15:00:00\",
\"expire_at_views\": 9,
\"description\": \"Social Media Link\",
\"public_stats\": true,
\"password\": \"password123\",
\"include_qr_code\": false
}"
const url = new URL(
"https://t.ly/api/v1/link"
);
const params = {
"api_token": "{YOUR_API_TOKEN}",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"short_url": "https:\/\/t.ly\/OYXL",
"short_id": "new_url_ending",
"long_url": "https:\/\/weatherextension.com\/",
"expire_at_datetime": "2022-01-17 15:00:00",
"expire_at_views": 9,
"description": "Social Media Link",
"public_stats": true,
"password": "password123",
"include_qr_code": false
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://t.ly/api/v1/link',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'api_token'=> '{YOUR_API_TOKEN}',
],
'json' => [
'short_url' => 'https://t.ly/OYXL',
'short_id' => 'new_url_ending',
'long_url' => 'https://weatherextension.com/',
'expire_at_datetime' => '2022-01-17 15:00:00',
'expire_at_views' => 9.0,
'description' => 'Social Media Link',
'public_stats' => true,
'password' => 'password123',
'include_qr_code' => false,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://t.ly/api/v1/link'
payload = {
"short_url": "https:\/\/t.ly\/OYXL",
"short_id": "new_url_ending",
"long_url": "https:\/\/weatherextension.com\/",
"expire_at_datetime": "2022-01-17 15:00:00",
"expire_at_views": 9,
"description": "Social Media Link",
"public_stats": true,
"password": "password123",
"include_qr_code": false
}
params = {
'api_token': '{YOUR_API_TOKEN}',
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload, params=params)
response.json()
Example response (200):
{
"short_url": "https://t.ly/c55j",
"description": null,
"long_url": "https://weatherextension.com/",
"domain": "https://t.ly/",
"short_id": "c55j",
"expire_at_views": null,
"expire_at_datetime": null,
"public_stats": false,
"created_at": "2022-01-16T19:32:20.000000Z",
"updated_at": "2022-01-16T19:32:20.000000Z"
}
Received response:
Request failed with error:
Delete
requires authentication
Example request:
curl --request DELETE \
"https://t.ly/api/v1/link?api_token=%7BYOUR_API_TOKEN%7D" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"short_url\": \"https:\\/\\/t.ly\\/OYXL\"
}"
const url = new URL(
"https://t.ly/api/v1/link"
);
const params = {
"api_token": "{YOUR_API_TOKEN}",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"short_url": "https:\/\/t.ly\/OYXL"
};
fetch(url, {
method: "DELETE",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://t.ly/api/v1/link',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'api_token'=> '{YOUR_API_TOKEN}',
],
'json' => [
'short_url' => 'https://t.ly/OYXL',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://t.ly/api/v1/link'
payload = {
"short_url": "https:\/\/t.ly\/OYXL"
}
params = {
'api_token': '{YOUR_API_TOKEN}',
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers, json=payload, params=params)
response.json()
Example response (202):
{}
Received response:
Request failed with error:
Expand
requires authentication
Example request:
curl --request POST \
"https://t.ly/api/v1/link/expand?api_token=%7BYOUR_API_TOKEN%7D" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"short_url\": \"https:\\/\\/t.ly\\/OYXL\",
\"password\": \"password123\"
}"
const url = new URL(
"https://t.ly/api/v1/link/expand"
);
const params = {
"api_token": "{YOUR_API_TOKEN}",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"short_url": "https:\/\/t.ly\/OYXL",
"password": "password123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://t.ly/api/v1/link/expand',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'api_token'=> '{YOUR_API_TOKEN}',
],
'json' => [
'short_url' => 'https://t.ly/OYXL',
'password' => 'password123',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://t.ly/api/v1/link/expand'
payload = {
"short_url": "https:\/\/t.ly\/OYXL",
"password": "password123"
}
params = {
'api_token': '{YOUR_API_TOKEN}',
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload, params=params)
response.json()
Example response (200):
{
"long_url": "http: //example.com/",
"expired": false
}
Received response:
Request failed with error: