API Documentation
Complete reference for Shortner Pro REST API endpoints
Base URL
https://shortner-pro.vercel.app🔐 Authentication
Using API Tokens
To use the API, you need to create an API token from your dashboard. Include it in your requests using the Authorization header:
Authorization: Bearer sp_your_api_token_hereGetting Your API Token
- Navigate to your Dashboard
- Click on "API Tokens" button
- Create a new token with a descriptive name
- Copy the generated token (it starts with "sp_")
- Use it in your API requests
Example Request with cURL
curl -X POST https://shortner-pro.vercel.app/api/shorten \
-H "Authorization: Bearer sp_your_api_token_here" \
-H "Content-Type: application/json" \
-d '{
"originalUrl": "https://example.com",
"title": "My Link",
"expiry": "never"
}'Example Request with JavaScript
const response = await fetch('https://shortner-pro.vercel.app/api/shorten', {
method: 'POST',
headers: {
'Authorization': 'Bearer sp_your_api_token_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
originalUrl: 'https://example.com',
title: 'My Link',
expiry: 'never'
})
});
const data = await response.json();
console.log(data.shortUrl);⚠️ Important: Keep your API tokens secure. Never share them publicly or commit them to version control. Each token has rate limits based on your account configuration.
Filter by Category
POST
/api/auth/registerRegister a new user account
POST
/api/auth/loginAuthenticate user and get session
POST
/api/auth/googleAuthenticate with Google OAuth
POST
/api/shortenCreate a new short URL
GET
/api/redirect/{shortCode}Redirect to original URL by short code
GET
/api/user/linksGet all links for authenticated user
DELETE
/api/user/links/{linkId}Delete a specific link
GET
/api/analytics/{shortCode}Get analytics for a specific short URL
GET
/api/analytics/detailed/{shortCode}Get detailed analytics including device, location, and hourly data
POST
/api/impression/{shortCode}Track an ad impression for a short URL
POST
/api/admin/cleanupDelete expired links from database (admin only)
GET
/api/migrateRun database migrations