URL Shortener
Create short, memorable links with built-in analytics. Track clicks, geographic locations, referrers, and user behavior in real-time.
API Endpoint
https://xhp.cz/api/shortenParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Required | The URL to shorten (must include http:// or https://) |
custom | string | Optional | Custom short code (3-20 characters, alphanumeric only) |
Examples
Basic URL Shortening
Shorten a URL with an auto-generated code
GET https://xhp.cz/api/shorten?url=https://bizkithub.comResponse:
{
"success": true,
"data": {
"short_url": "https://xhp.cz/abc123",
"original_url": "https://bizkithub.com",
"short_code": "abc123",
"created_at": "2025-01-15T10:30:00Z"
}
}Custom Short Code
Create a branded short link with your own code
GET https://xhp.cz/api/shorten?url=https://bizkithub.com&custom=bizkithubResponse:
{
"success": true,
"data": {
"short_url": "https://xhp.cz/bizkithub",
"original_url": "https://bizkithub.com",
"short_code": "bizkithub",
"created_at": "2025-01-15T10:30:00Z"
}
}Analytics & Tracking
Automatic Tracking
Every shortened URL automatically tracks clicks, geographic location, referrers, and user agents. Access analytics by appending + to any short URL.
Analytics Access
View analytics in browser:
https://xhp.cz/abc123+JSON API endpoint:
https://xhp.cz/api/stats/abc123JavaScript Integration
async function shortenURL(originalUrl, customCode = null) {
const params = new URLSearchParams({ url: originalUrl });
if (customCode) {
params.append('custom', customCode);
}
const response = await fetch(`https://xhp.cz/api/shorten?${params}`);
const data = await response.json();
if (data.success) {
return data.data.short_url;
} else {
throw new Error(data.error || 'Failed to shorten URL');
}
}
async function getAnalytics(shortCode) {
const response = await fetch(`https://xhp.cz/api/stats/${shortCode}`);
return await response.json();
}
// Usage examples
try {
const shortUrl = await shortenURL('https://bizkithub.com');
console.log('Shortened URL:', shortUrl);
const customUrl = await shortenURL('https://bizkithub.com', 'bizkithub');
console.log('Custom URL:', customUrl);
const stats = await getAnalytics('abc123');
console.log('Analytics:', stats);
} catch (error) {
console.error('Error:', error.message);
}Rate Limits
Error Handling
Invalid URL format or missing parameters
Custom short code already exists
Rate limit exceeded, please try again later
Advanced Features
GEO IP Tracking
Automatically detect and track the geographic location of visitors, including country, region, and city information for detailed audience insights.
Real-time Analytics
Get instant access to click statistics, referrer data, and user behavior patterns through our analytics API and web dashboard.