Shorten links. Track every click. Self-destruct when done.
Stats and link management routes require a Bearer token. Pass it in your request headers — that's it.
/api/shorten
30 REQ / MIN
Turns a URL into a short code. You can bring your own slug (vanity URLs), cap how many times the link can be visited before it deletes itself, or set a hard expiry date. Payloads are validated with Zod.
{
"success": true,
"message": "Link shortened successfully!",
"code": "hack",
"shortUrl": "http://localhost:3000/hack",
"originalUrl": "https://hackclub.com"
}
customCode: Pick your own slug instead of a random hash.
maxClicks: Link deletes itself after X visits.
expiresAt: ISO-8601 timestamp. Link is gone after this moment.
/:code
Redirects to the destination. On every hit, it silently parses the User-Agent to record OS, device, and browser — then fires a Discord webhook in the background. If the link has hit its click limit, it returns 410 and deletes itself.
HTTP/1.1 301 Moved Permanently
Location: https://hackclub.com
410 Gone — click limit reached
HTTP/1.1 410 Gone
"This link has reached its maximum view count and self-destructed."
/api/qr/:code
Returns a high-res PNG QR code for any short link. Generated in-memory and streamed directly.
HTTP/1.1 200 OK
Content-Type: image/png
[Binary image data]
/api/stats/:code
AUTH REQUIRED
Click analytics for a single link. Joins the link row with its click events — each one tagged with OS, device, and browser. Useful for understanding who's actually hitting your links.
{
"success": true,
"data": {
"id": "hack",
"originalUrl": "https://hackclub.com",
"clicks": 1,
"createdAt": "2026-05-09T10:11:35.433Z",
"lastClicked": "2026-05-09T10:22:17.541Z",
"recentActivity": [
{
"id": 1,
"os": "Mac OS",
"browser": "Chrome",
"device": "Desktop",
"timestamp": "2026-05-09T10:22:17.541Z"
}
]
}
}
/api/links
AUTH REQUIRED
Lists all active short codes in the database. Paginated via
?page=1&limit=10
query params so it won't fall over on large datasets.
{
"success": true,
"meta": {
"totalItems": 15,
"totalPages": 2,
"currentPage": 1,
"itemsPerPage": 10
},
"data": [
{
"id": "hack",
"originalUrl": "https://hackclub.com",
"clicks": 42,
"createdAt": "2026-05-08T09:00:00Z",
"expiresAt": "2026-06-08T09:00:00Z"
}
]
}