URL Shortener
Shorten long URLs with advanced tracking and analytics. Get detailed insights about clicks, geographic location, and user behavior.
API Endpoint
GET
https://xhp.cz/api/shorten
Parameters
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) |
Examples
Basic URL Shortening
GET https://xhp.cz/api/shorten?url=https://bizkithub.com
Response:
{
"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
GET https://xhp.cz/api/shorten?url=https://bizkithub.com&custom=bizkithub
Response:
{
"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.
Tracked Data
- Total clicks and unique visitors
- Geographic location (country, city)
- Referrer websites
- Device and browser information
- Click timestamps
Analytics Access
View analytics for any short URL:
https://xhp.cz/abc123+
JSON API endpoint:
https://xhp.cz/api/stats/abc123
JavaScript Integration
// Shorten URL function
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');
}
}
// Get analytics for a short 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
✅ Free Usage
- • 500 URLs per hour per IP address
- • Unlimited clicks on shortened URLs
- • Permanent storage - URLs never expire
- • Free analytics for all shortened URLs
Error Handling
400Bad Request
Invalid URL format or missing parameters
409Conflict
Custom short code already exists
429Too Many Requests
Rate limit exceeded, try again later
Advanced Features
GEO IP Tracking
Automatically detect and track the geographic location of visitors, including country, region, and city information.
Real-time Analytics
Get instant access to click statistics, referrer data, and user behavior patterns through our analytics dashboard.