Developer API

ShortURLs API – dev/api.php

This documentation explains how to use https://www.shorturls.pro/dev/api.php to get JSON output.

1. Overview

There are two ways to use the API:

2. Base URL

https://www.shorturls.pro/dev/api.php

3. Endpoints

Method Endpoint Description
GET ?url={LONG_URL} Create short URL with auto alias
GET ?url={LONG_URL}&alias={ALIAS} Create short URL with custom alias

4. Parameters

Parameter Required? Description
url Yes The URL you want to shorten
alias No Custom alias for short URL

5. Example Response – Auto Alias

{
  "id": 188,
  "alias": "wTNHgX",
  "short_url": "https://sorts.pro/wTNHgX",
  "long_url": "https://google.com",
  "created_at": "2025-11-20T12:46:33+05:30",
  "expires_at": null
}

6. Example Response – Custom Alias

{
  "id": 190,
  "alias": "qDKTpi",
  "short_url": "https://sorts.pro/qDKTpi",
  "long_url": "https://google.com",
  "created_at": "2025-11-20T12:47:17+05:30",
  "expires_at": null
}

7. Error Responses

HTTP Code JSON Description
400 {"error":"missing url parameter"} URL missing
422 {"error":"invalid url"} URL invalid
409 {"error":"alias already taken"} Alias exists
500 {"error":"server error"} Server issue

8. Usage Examples

cURL – Auto Alias:

curl -G "https://www.shorturls.pro/dev/api.php" \
 --data-urlencode "url=https://google.com"

cURL – Custom Alias:

curl -G "https://www.shorturls.pro/dev/api.php" \
 --data-urlencode "url=https://google.com" \
 --data-urlencode "alias=mygoogles"

JavaScript:

fetch('https://www.shorturls.pro/dev/api.php?url=' + encodeURIComponent('https://google.com'))
  .then(r => r.json())
  .then(console.log);

PHP:

<?php
$api = 'https://www.shorturls.pro/dev/api.php?url=' . urlencode('https://google.com');
$json = file_get_contents($api);
$data = json_decode($json, true);
print_r($data);
?>

9. Field Description

Field Type Description
id integer Record ID
alias string Generated/custom alias
short_url string Shortened URL
long_url string Original URL
created_at datetime Created timestamp
Contact Us | Policy | Terms | Report URL | About Us

© 2026 | shorturls.pro, sorts.to & sorts.live - all rights reserved.

Lasumeet Room Services (Opc) Pvt. Ltd.