API Documentation

Simple REST API for URL shortening. Perfect for integrating into your projects.

Base URL

https://your-domain.com/shortitfast
POST /postUrl

Create a new shortened URL.

Request Body

{
"url": "https://example.com/very/long/url"
}

Response (Success)

{
"message": "Inserted the new URL",
"shortUrl": "https://shortitfast.com/shortitfast/abc123",
"longUrl": "https://example.com/very/long/url"
}

Response (URL Already Exists)

{
"message": "URL already shortified!",
"shortUrl": "https://shortitfast.com/shortitfast/abc123",
"longUrl": "https://example.com/very/long/url"
}
GET /:hashValue

Redirect to the original URL using the short URL hash.

Example

GET https://shortitfast.com/shortitfast/abc123

Response

Redirects (HTTP 302) to the original URL. If the hash is not found, returns a 404 error.

Example Usage

JavaScript (Fetch API)

const shortenUrl = async (longUrl) => {
const response = await fetch('https://your-domain.com/shortitfast/postUrl', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url: longUrl })
});

const data = await response.json();
console.log('Short URL:', data.shortUrl);
return data.shortUrl;
};

// Usage
shortenUrl('https://example.com/very/long/url');

cURL

curl -X POST https://your-domain.com/shortitfast/postUrl \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/very/long/url"}'

Technical Details

Hash Generation

Uses UUID v4 with Base62 encoding for unique, short hashes

Storage

PostgreSQL database for reliable URL mapping

Duplicate Detection

Automatically returns existing short URL for duplicate submissions

Open Source

View the code on GitHub

Note: This is a portfolio project. For production use, please host your own instance or contact the developer for more information.