NAV -image
bash javascript php python

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

This API is authenticated 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 -X POST \
    "https://t.ly/api/v1/link/shorten?api_token=%7BYOUR_API_TOKEN%7D" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"long_url":"http:\/\/example.com\/","domain":"https:\/\/short.com\/","include_qr_code":false}'
const url = new URL(
    "https://t.ly/api/v1/link/shorten"
);

let params = {
    "api_token": "{YOUR_API_TOKEN}",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "long_url": "http:\/\/example.com\/",
    "domain": "https:\/\/short.com\/",
    "include_qr_code": false
}

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' => [
            'Accept' => 'application/json',
        ],
        'query' => [
            'api_token'=> '{YOUR_API_TOKEN}',
        ],
        'json' => [
            'long_url' => 'http://example.com/',
            'domain' => 'https://short.com/',
            'include_qr_code' => false,
        ],
    ]
);
$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\/",
    "domain": "https:\/\/short.com\/",
    "include_qr_code": false
}
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"
}

Stats

requires authentication

Example request:

curl -X GET \
    -G "https://t.ly/api/v1/link/stats?api_token=%7BYOUR_API_TOKEN%7D&short_url=https%3A%2F%2Ft.ly%2FOYXL" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "https://t.ly/api/v1/link/stats"
);

let params = {
    "api_token": "{YOUR_API_TOKEN}",
    "short_url": "https://t.ly/OYXL",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let 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' => [
            '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"
    }
}

Expand

requires authentication

Example request:

curl -X POST \
    "https://t.ly/api/v1/link/expand?api_token=%7BYOUR_API_TOKEN%7D" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"short_url":"https:\/\/t.ly\/OYXL","password":"password123"}'
const url = new URL(
    "https://t.ly/api/v1/link/expand"
);

let params = {
    "api_token": "{YOUR_API_TOKEN}",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let 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' => [
            '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
}

Get

requires authentication

Example request:

curl -X GET \
    -G "https://t.ly/api/v1/link?api_token=%7BYOUR_API_TOKEN%7D&short_url=https%3A%2F%2Ft.ly%2Fc55j" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "https://t.ly/api/v1/link"
);

let params = {
    "api_token": "{YOUR_API_TOKEN}",
    "short_url": "https://t.ly/c55j",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let 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' => [
            '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..."
}

Update

requires authentication

Example request:

curl -X PUT \
    "https://t.ly/api/v1/link?api_token=%7BYOUR_API_TOKEN%7D" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"short_url":"https:\/\/t.ly\/OYXL","long_url":"https:\/\/weatherextension.com\/","expire_at_datetime":"2022-01-17T15: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"
);

let params = {
    "api_token": "{YOUR_API_TOKEN}",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "short_url": "https:\/\/t.ly\/OYXL",
    "long_url": "https:\/\/weatherextension.com\/",
    "expire_at_datetime": "2022-01-17T15: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' => [
            'Accept' => 'application/json',
        ],
        'query' => [
            'api_token'=> '{YOUR_API_TOKEN}',
        ],
        'json' => [
            'short_url' => 'https://t.ly/OYXL',
            'long_url' => 'https://weatherextension.com/',
            'expire_at_datetime' => '2022-01-17T15: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",
    "long_url": "https:\/\/weatherextension.com\/",
    "expire_at_datetime": "2022-01-17T15: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"
}

Delete

requires authentication

Example request:

curl -X DELETE \
    "https://t.ly/api/v1/link?api_token=%7BYOUR_API_TOKEN%7D" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"short_url":"https:\/\/t.ly\/OYXL"}'
const url = new URL(
    "https://t.ly/api/v1/link"
);

let params = {
    "api_token": "{YOUR_API_TOKEN}",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let 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' => [
            '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):

{}