🔗 URL Shortener API
A fast, reliable, and easy-to-use URL shortening service built with Node.js, Express, and MongoDB.
Use the API Documentation below to Test this live API.
📚 API Documentation
🏥 Health Check
Checks the operational status of the server.
GET /health
🔗 Create Short URL
Generates a new short URL. A custom code is optional.
POST /add
Request Body:
{
"originalUrl": "https://www.example.com/a/very/long/url/to/shorten",
"code": "my-custom-code" // Optional: 10-character max
}
🔄 Redirect to Original URL
Redirects a short URL to its original destination and tracks the click.
GET /:shortURL
📊 Get URL Analytics
Retrieves click count and other details for a short URL.
GET /analytics/:shortURL
Example Response:
{
"shortURL": "my-custom-code",
"originalUrl": "https://www.example.com/a/very/long/url/to/shorten",
"clicks": 42,
"createdAt": "2025-07-27T10:30:00.000Z",
"updatedAt": "2025-07-27T12:45:00.000Z"
}