The Link-To API allows you to programmatically create shortened URLs. Our API is RESTful, returns JSON responses, and uses standard HTTP response codes. This documentation provides all the information you need to integrate our URL shortening service into your applications.
https://link-to.site
Download our machine-readable API specifications for integration with tools like Postman, Swagger UI, or automated SDK generators.
Use the public demo API key below to test the API without registration. This endpoint simulates the real API behavior but doesn't save data to the database. All test requests are logged and displayed below.
Loading test logs...
All API requests require authentication using your API key. You can obtain your API key from your account dashboard after purchasing an API-enabled plan.
We support two authentication methods for backward compatibility:
Method 1: Header Authentication (Recommended)
X-API-Key: your_api_key_here
Content-Type: application/json
Method 2: POST Parameter (Legacy)
apikey=your_api_key_here&url=https://example.com
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
string | Required | The long URL to shorten. Must be a valid HTTP/HTTPS URL. |
group |
string | Optional | Group ID or API group identifier to organize your links. |
curl -X POST https://link-to.site/create \
-H 'Content-Type: application/json' \
-H 'X-API-Key: your_api_key_here' \
-d '{
"url": "https://example.com"
}'
curl -X POST https://link-to.site/create \
-d 'apikey=your_api_key_here' \
-d 'url=https://example.com'
<?php
$apiUrl = 'https://link-to.site/create';
$apiKey = 'your_api_key_here';
$data = json_encode([
'url' => 'https://example.com'
]);
$options = [
'http' => [
'method' => 'POST',
'header' => [
'Content-Type: application/json',
'X-API-Key: ' . $apiKey
],
'content' => $data
]
];
$context = stream_context_create($options);
$response = file_get_contents($apiUrl, false, $context);
$result = json_decode($response, true);
if ($result['success'] === 'true') {
echo "Short URL: " . $result['short_url'];
} else {
echo "Error: " . $result['message'];
}
?>
const apiUrl = 'https://link-to.site/create';
const apiKey = 'your_api_key_here';
const data = {
url: 'https://example.com'
};
fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': apiKey
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
if (result.success === 'true') {
console.log('Short URL:', result.short_url);
} else {
console.error('Error:', result.message);
}
})
.catch(error => console.error('Request failed:', error));
import requests
import json
api_url = 'https://link-to.site/create'
api_key = 'your_api_key_here'
data = {
'url': 'https://example.com'
}
headers = {
'Content-Type': 'application/json',
'X-API-Key': api_key
}
response = requests.post(api_url, json=data, headers=headers)
result = response.json()
if result['success'] == 'true':
print(f"Short URL: {result['short_url']}")
else:
print(f"Error: {result['message']}")
{
"success": "true",
"timestamps": "2025/11/13 16:53:37",
"message": "Certification completed",
"error": "",
"short_code": "abc123",
"short_url": "https://link-to.site/abc123",
"long_url": "https://example.com",
"qr_code": "https://link-to.site/qrcode/abc123.png",
"title": "Example Domain",
"clicks": 0
}
{
"success": "false",
"timestamps": "2025/11/13 16:53:37",
"message": "API key not detected",
"error": "301"
}
The API uses the following error codes to indicate specific issues:
| Code | Description |
|---|---|
| 300 | API not queried correctly - Invalid request format |
| 301 | API key not detected - Missing authentication |
| 302 | URL not found - Missing required 'url' parameter |
| 303 | User not found or wrong API key - Invalid credentials |
| 304 | The shortenable URLs are finished - No available URL slots |
| 305 | The indicated URL has already been shortened |
| 306 | The URL could not be processed - Connection or fetch error |
| 307 | 404 Error - The page does not exist |
| 308 | The page is hosted on a server with Mod_Security enabled |
| 309 | The page is hosted on a secure server with Cloudflare protection |
| 310 | The URL directs to a social network - Not allowed |
| 311 | HTTP headers returned 0 as file size - Empty response |
| 312 | The indicated group does not exist |
| 429 | Rate limit exceeded - Please try again later |
To ensure fair usage and system stability, API requests are rate-limited:
If you exceed the rate limit, you'll receive a 429 error response.
The rate limit resets every hour. If you need higher limits, please
contact support.
success field and handle errors appropriatelyNeed help? We're here to assist you: