Sortify API Reference
Create, manage, and analyze short links programmatically using API keys generated from your dashboard.
Base URL
https://your-domain.comAuthentication
Include your API key in every request using the x-api-key header.
Header
x-api-key: sk_sortify_xxxxxxxxxxxxxxxxx
Create Link
POSTPOST /api/v1/linksCreate a new short link. Optionally provide a custom slug, expiry date, and password.
Request body
{
"url": "https://example.com/very-long-url",
"slug": "my-link", // optional
"expiresAt": "2025-12-31", // optional ISO date
"password": "secret" // optional
}Response
{
"success": true,
"shortUrl": "https://your-domain.com/my-link"
}Get All Links
GETGET /api/v1/linksRetrieve all short links associated with your API key.
Response
{
"links": [
{
"id": "clxyz...",
"slug": "my-link",
"originalUrl": "https://example.com/very-long-url",
"clicks": 42,
"createdAt": "2024-01-15T10:30:00Z"
}
]
}Analytics
GETGET /api/v1/analytics/:slugGet detailed analytics for a short link — total clicks, browser breakdown, device breakdown, countries, and a click timeline.
Response
{
"slug": "my-link",
"totalClicks": 42,
"browsers": { "Chrome": 30, "Firefox": 8, "Safari": 4 },
"devices": { "Desktop": 35, "Mobile": 7 },
"countries": { "United States": 20, "India": 12 },
"clicksByDay": [
{ "date": "2024-01-15", "clicks": 10 },
{ "date": "2024-01-16", "clicks": 32 }
]
}Delete Link
DELETEDELETE /api/v1/links/:slugPermanently delete a short link and all its analytics data.
Response
{
"success": true
}