Advertisement
Developer Hub
REST API & Sanctum Documentation
Programmatically create short links, customize branded domains, extract click analytics, and manage link collections in real-time.
Step 1: Authentication & Token Format
All requests to protected API endpoints require a valid Sanctum API Key passed in the HTTP Authorization request header.
Why does my API key start with a number and a pipe symbol (e.g.
Laravel Sanctum formats API tokens as
5|...)?Laravel Sanctum formats API tokens as
{TOKEN_ID}|{SECRET_TOKEN} (for example: 5|7aaa71f1e4c2bffd8104575cc171dac966642bb7e51f4b4070b4640ef0cb2010).
The 5| represents your token ID in the database. You must include the complete string including 5| in your Bearer header!
Authorization: Bearer 5|7aaa71f1e4c2bffd8104575cc171dac966642bb7e51f4b4070b4640ef0cb2010
Advertisement
POST
Create Short URL
https://freeurlshortner.com/api/v1/links/shorten
Request Parameters (JSON Body):
| Parameter | Type | Required | Description |
|---|---|---|---|
original_url |
String (URL) | Required | The long URL to shorten (must start with http:// or https://). |
domain |
String | Optional | Branded shortener domain (e.g. freeurlshortner.com, linktr.top, domain-name.com). |
custom_alias |
String | Optional | Custom slug (e.g. my-promo-2026). |
password |
String | Optional | Set a password to protect the short link. |
redirect_type |
Integer | Optional | HTTP redirect type: 301 (Permanent), 302 (Temporary), or 307. |
curl -X POST "https://freeurlshortner.com/api/v1/links/shorten" \
-H "Authorization: Bearer 5|7aaa71f1e4c2bffd8104575cc171dac966642bb7e51f4b4070b4640ef0cb2010" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"original_url": "https://example.com/target-landing-page",
"domain": "freeurlshortner.com",
"custom_alias": "my-promo-2026"
}'
<?php
$apiKey = "5|7aaa71f1e4c2bffd8104575cc171dac966642bb7e51f4b4070b4640ef0cb2010";
$url = "https://freeurlshortner.com/api/v1/links/shorten";
$data = [
"original_url" => "https://example.com/target-landing-page",
"domain" => "freeurlshortner.com",
"custom_alias" => "my-promo-2026"
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer {$apiKey}",
"Content-Type: application/json",
"Accept: application/json"
]
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
?>
const apiKey = "5|7aaa71f1e4c2bffd8104575cc171dac966642bb7e51f4b4070b4640ef0cb2010";
fetch("https://freeurlshortner.com/api/v1/links/shorten", {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json",
"Accept": "application/json"
},
body: JSON.stringify({
original_url: "https://example.com/target-landing-page",
domain: "freeurlshortner.com",
custom_alias: "my-promo-2026"
})
})
.then(response => response.json())
.then(data => console.log("Short URL:", data.data.short_url))
.catch(error => console.error("Error:", error));
import requests
api_key = "5|7aaa71f1e4c2bffd8104575cc171dac966642bb7e51f4b4070b4640ef0cb2010"
url = "https://freeurlshortner.com/api/v1/links/shorten"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
"Accept": "application/json"
}
payload = {
"original_url": "https://example.com/target-landing-page",
"domain": "freeurlshortner.com",
"custom_alias": "my-promo-2026"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
Example JSON Success Response (201 Created):
{
"success": true,
"message": "Short URL created successfully.",
"data": {
"id": 42,
"uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"short_code": "my-promo-2026",
"short_url": "https://domain-name.com/my-promo-2026",
"original_url": "https://example.com/target-landing-page",
"domain": "domain-name.com",
"clicks_count": 0,
"created_at": "2026-08-12T06:40:09+00:00"
}
}
Advertisement
GET
List My Short Links
https://freeurlshortner.com/api/v1/links
Returns a paginated list of all short links created under your account.
curl -H "Authorization: Bearer 5|7aaa71f1e4c2bffd8104575cc171dac966642bb7e51f4b4070b4640ef0cb2010" \
"https://freeurlshortner.com/api/v1/links?page=1"
DELETE
Revoke Short Link
https://freeurlshortner.com/api/v1/links/{id}
Permanently revokes and erases a short URL by its numeric ID.
curl -X DELETE \
-H "Authorization: Bearer 5|7aaa71f1e4c2bffd8104575cc171dac966642bb7e51f4b4070b4640ef0cb2010" \
"https://freeurlshortner.com/api/v1/links/42"
Advertisement










