DEV Community

lostmaniac
lostmaniac

Posted on

Free URL Shortener API — No Limits, No Signup, Just Works

Free URL Shortener API — No Limits, No Signup, Just Works

I recently built a simple service that provides a free, developer-friendly URL shortener API.

It’s designed for anyone who needs short links in tools, scripts, or web apps without worrying about rate limits or authentication.


Features

  • Completely free — no usage limits or hidden restrictions
  • No authentication required — just send a request
  • Simple JSON API — works with any language or framework
  • Fast and lightweight — built for developer use cases

Example

curl -X POST http://urlfy.org/api/v1/shorten \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'
Enter fullscreen mode Exit fullscreen mode

Response

{"shortUrl": "SHORT_URL", "cid": 304}
Enter fullscreen mode Exit fullscreen mode

API Documentation

Full API documentation:
https://urlfy.org/api-doc

Top comments (2)

Collapse
 
ahmad_shokry profile image
Ahmad Shokry

That's nice, can you please describe how will you use the data sent to your server ?

Collapse
 
lostmaniac profile image
lostmaniac • Edited

Can you describe the programming language you use?

Python Examples:

Using requests library (Recommended)

import requests

url = "http://urlfy.org/api/v1/shorten"
headers = {
    "Content-Type": "application/json"
}
data = {
    "url": "https://example.com"
}

try:
    response = requests.post(url, headers=headers, json=data)
    response.raise_for_status()  # Check if request was successful

    result = response.json()
    print(f"Short URL: {result['shortUrl']}")
    print(f"CID: {result['cid']}")

except requests.exceptions.RequestException as e:
    print(f"Request error: {e}")
except KeyError as e:
    print(f"Missing field in response: {e}")
except ValueError as e:
    print(f"JSON decode error: {e}")
Enter fullscreen mode Exit fullscreen mode

Node.js Examples
Using native http module


const http = require('http');

const data = JSON.stringify({
    url: 'https://example.com'
});

const options = {
    hostname: 'urlfy.org',
    path: '/api/v1/shorten',
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Content-Length': Buffer.byteLength(data)
    }
};

const req = http.request(options, (res) => {
    let responseData = '';

    res.on('data', (chunk) => {
        responseData += chunk;
    });

    res.on('end', () => {
        try {
            const result = JSON.parse(responseData);
            console.log(`Short URL: ${result.shortUrl}`);
            console.log(`CID: ${result.cid}`);
        } catch (error) {
            console.error('JSON parse error:', error);
        }
    });
});

req.on('error', (error) => {
    console.error('Request error:', error);
});

req.write(data);
req.end();
Enter fullscreen mode Exit fullscreen mode