shlau.link

URL Shortening
API Service

Fast, secure, and developer-friendly. Create shortened URLs programmatically with JWT authentication and detailed analytics.

5
Endpoints
JWT
Auth
REST
API

API Endpoints

Create a new user account

Request Body
{ "email": "user@example.com", "password": "secure123" }
Response
{ "token": "eyJhbG...", "user": { "id": "...", "email": "..." } }

Authenticate and receive JWT token

Request Body
{ "email": "user@example.com", "password": "secure123" }
Response
{ "token": "eyJhbG...", "user": { "id": "...", "email": "..." } }

Create a shortened URL

Request Body
{ "url": "https://example.com/very-long-url", "customCode": "mylink" }
Response
{ "shortCode": "mylink", "shortUrl": "https://shlau.link/mylink", "originalUrl": "..." }

List all your shortened URLs

Response
[{ "id": "...", "shortCode": "abc123", "clicks": 42, ... }]

Delete a shortened URL

Response
{ "message": "URL deleted successfully" }

Quick Start

example.js
1// Create a short URL
2const response = await fetch('https://shlau.link/api/urls', {
3 method: 'POST',
4 headers: {
5 'Content-Type': 'application/json',
6 'Authorization': 'Bearer YOUR_JWT_TOKEN'
7 },
8 body: JSON.stringify({
9 url: 'https://example.com/my-very-long-url-here',
10 customCode: 'mylink' // optional
11 })
12});
13
14const { shortUrl } = await response.json();
15console.log(shortUrl); // https://shlau.link/mylink