Integrate link shortening into your applications
/api/v1/links
Creates a new shortened link from a long URL.
Content-Type: application/json
{
"url": "https://example.com/your/long/url"
}
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | The long URL to shorten (must be valid http/https URL) |
{
"id": 1,
"short_url": "https://linkshor.tr/abc123",
"long_url": "https://example.com/your/long/url"
}
{
"error": "url is required"
}
{
"error": "url must be a valid URL (e.g., https://example.com)"
}
curl -X POST https://linkshor.tr/api/v1/links \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/very/long/url"}'
const response = await fetch('https://linkshor.tr/api/v1/links', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://example.com/very/long/url'
})
});
const data = await response.json();
console.log(data.short_url);
import requests
response = requests.post(
'https://linkshor.tr/api/v1/links',
json={'url': 'https://example.com/very/long/url'}
)
data = response.json()
print(data['short_url'])