API Documentation
Integrate Shorty's powerful URL shortening and analytics into your applications
Get API Key
Sign up and generate your API key from your dashboard
Make Request
Send authenticated requests to our REST API endpoints
Get Response
Receive JSON responses with shortened URLs and analytics
API Base URL
All endpoints are relative to this base URL. Authentication required for all requests.
Authentication
Include your API key in the request header:
Authorization: Bearer YOUR_API_KEY
Important: Keep your API key secure. Never expose it in client-side code or public repositories.
/shorten
Create a new shortened URL
Request Body
{
"url": "https://example.com/very/long/url",
"custom_alias": "my-link", // optional
"domain": "short.fy" // optional
}
Response (200 OK)
{
"success": true,
"data": {
"id": "abc123",
"short_url": "https://short.fy/abc123",
"original_url": "https://example.com/very/long/url",
"created_at": "2025-01-15T10:30:00Z"
}
}
Example
curl -X POST https://api.shorty.com/v1/shorten \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/page"}'
/links/{id}
Get information about a shortened link
Response (200 OK)
{
"success": true,
"data": {
"id": "abc123",
"short_url": "https://short.fy/abc123",
"original_url": "https://example.com/page",
"clicks": 1234,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}
}
Example
curl https://api.shorty.com/v1/links/abc123 \
-H "Authorization: Bearer YOUR_API_KEY"
/links/{id}/analytics
Get detailed analytics for a link
Query Parameters
period- Time period (7d, 30d, 90d, all)groupBy- Group by (day, week, month)
Response (200 OK)
{
"success": true,
"data": {
"total_clicks": 1234,
"unique_clicks": 856,
"referrers": [
{"source": "twitter.com", "clicks": 450},
{"source": "facebook.com", "clicks": 320}
],
"countries": [
{"country": "US", "clicks": 600},
{"country": "UK", "clicks": 200}
],
"devices": [
{"type": "mobile", "clicks": 700},
{"type": "desktop", "clicks": 534}
]
}
}
/links/{id}
Delete a shortened link
Response (200 OK)
{
"success": true,
"message": "Link deleted successfully"
}
Error Handling
The API uses standard HTTP status codes and returns errors in this format:
{
"success": false,
"error": {
"code": "invalid_url",
"message": "The provided URL is invalid"
}
}
Common Status Codes
Rate Limits
Free Plan
100
requests per hour
Pro Plan
1,000
requests per hour
Enterprise
Custom
unlimited requests
Ready to Start Building?
Sign up now and get your API key to start integrating Shorty