Create a Short Link

POST /api/v1/short-link

Common errors include:

  • "400 Bad Request" for an invalid request body, blocked destination URL, or an existing slug.
  • "429 Too Many Requests" when the shortlink limit for the current plan has been reached.

Creates a new short link for the authenticated user. This endpoint requires a Bearer token and an available shortlink quota, and supports optional title, tags, expiration, password protection, UTM parameters, QR generation, link-in-bio, and public link settings.

Request

Method : POST
Content-Type : Application/json

Request Body Schema

destinationUrl string Required
The destination URL to redirect to.
brandedDomain string Required
The branded domain for the short link, for example "sl.gy".
slashTag string Required
Custom slug for the short link. Alphanumeric characters, hyphens, and emojis are allowed.
title string
Title of the short link. If omitted, it may be auto-fetched from the destination URL.
tags string
Comma-separated tags for organizing links.
expirationDate string
Optional expiration date in ISO 8601 format.
password string
Password used to protect the link.
passwordProtectionEnabledboolean
Whether password protection is enabled for the link.
utm_source string
UTM source parameter.
utm_medium string
UTM medium parameter.
utm_campaign string
UTM campaign parameter.
utm_term string
UTM term parameter.
utm_content string
UTM content parameter.
utm_id string
UTM ID parameter.
isQrGeneratedboolean
Whether to generate a QR code for the link.
isLinkInBioboolean
Whether this link should be treated as a link-in-bio page.
publicboolean
Default: false
Whether this is a public link. Public links do not require auth and expire in 1 hour.
LANGUAGE
REQUEST
 curl -X POST 'https://apis.divsly.com/api/v1/short-link' \
	-H 'Content-Type: application/json' \
	-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
	-d '{
	"destinationUrl": "https://example.com/long-url",
	"brandedDomain": "custom.domain",
	"slashTag": "my-custom-slug",
	"utm_source": "twitter",
	"utm_medium": "social",
	"utm_campaign": "summer_2024",
	"public": false,
	"password": "optional_password",
	"isQrGenerated": true,
	"qrSettings": {
		"color": "#000000",
		"bgColor": "#ffffff",
		"pattern": "classy",
		"corner": "square"
	}
	}'
API REQUEST
 const createShortlink = (linkData) => {
  return new Promise((resolve, reject) => {
	fetch('https://divsly-backend.vercel.app/api/v1/shortlinks', {
	method: 'POST',
	headers: {
		'Content-Type': 'application/json',
		'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
	},
	body: JSON.stringify({
		destinationUrl: linkData.destinationUrl,
		brandedDomain: linkData.brandedDomain,
		slashTag: linkData.slashTag,
		utm_source: linkData.utm_source,
		utm_medium: linkData.utm_medium,
		utm_campaign: linkData.utm_campaign,
		public: linkData.public,
		password: linkData.password,
		isQrGenerated: linkData.isQrGenerated,
		qrSettings: linkData.qrSettings
	})
		})
		.then(response => response.json())
		.then(data => resolve(data))
		.catch(error => reject(error));
	});
	};


	const linkData = {
	destinationUrl: 'https://example.com/long-url',
	brandedDomain: 'custom.domain',
	slashTag: 'my-custom-slug',
	utm_source: 'twitter',
	utm_medium: 'social',
	utm_campaign: 'summer_2024',
	public: false,
	password: 'optional_password',
	isQrGenerated: true,
	qrSettings: {
		color: '#000000',
		bgColor: '#ffffff',
		pattern: 'classy',
		corner: 'square'
	}
	};

	createShortlink(linkData)
	.then(data => console.log(data))
	.catch(error => console.error('Error:', error));				  
API REQUEST
 const axios = require('axios');

	const createShortlink = (linkData) => {
	  return new Promise((resolve, reject) => {
	  axios({
		method: 'post',
		url: 'https://divsly-backend.vercel.app/api/v1/shortlinks',
		headers: {
		'Content-Type': 'application/json',
		'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
		},
		data: {
		destinationUrl: linkData.destinationUrl,
		brandedDomain: linkData.brandedDomain,
		slashTag: linkData.slashTag,
		utm_source: linkData.utm_source,
		utm_medium: linkData.utm_medium,
		utm_campaign: linkData.utm_campaign,
		public: linkData.public,
		password: linkData.password,
		isQrGenerated: linkData.isQrGenerated,
		qrSettings: linkData.qrSettings
		}
	})
		.then(response => resolve(response.data))
		.catch(error => reject(error.response?.data || error));
	});
	};
	
	
  const linkData = {
	destinationUrl: 'https://example.com/long-url',
	brandedDomain: 'custom.domain',
	slashTag: 'my-custom-slug',
	utm_source: 'twitter',
	utm_medium: 'social',
	utm_campaign: 'summer_2024',
	public: false,
	password: 'optional_password',
	isQrGenerated: true,
	qrSettings: {
	color: '#000000',
	bgColor: '#ffffff',
	pattern: 'classy',
	corner: 'square'
	}
};
	
  createShortlink(linkData)
    .then(data => console.log(data))
	.catch(error => console.error('Error:', error));
					
API REQUEST
 // PHP
	$ch = curl_init();

  $payload = array(
	'destinationUrl' => 'https://example.com/long-url',
	'brandedDomain' => 'custom.domain',
	'slashTag' => 'my-custom-slug',
	'utm_source' => 'twitter',
	'utm_medium' => 'social',
	'utm_campaign' => 'summer_2024',
	'public' => false,
	'password' => 'optional_password',
	'isQrGenerated' => true,
	'qrSettings' => array(
		'color' => '#000000',
		'bgColor' => '#ffffff',
		'pattern' => 'classy',
		'corner' => 'square'
	)
	);

  curl_setopt_array($ch, array(
	CURLOPT_URL => 'https://divsly-backend.vercel.app/api/v1/shortlinks',
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_POST => true,
		CURLOPT_SSL_VERIFYPEER => false,  // Disable SSL peer verification
		CURLOPT_SSL_VERIFYHOST => false,
	CURLOPT_POSTFIELDS => json_encode($payload),
	CURLOPT_HTTPHEADER => array(
		'Content-Type: application/json',
		'Authorization: Bearer YOUR_ACCESS_TOKEN'
	)
));

	$response = curl_exec($ch);
	$data = json_decode($response, true);
	curl_close($ch);						
API REQUEST
 import requests
	import json
	
	url = "https://divsly-backend.vercel.app/api/v1/shortlinks"
	headers = {
		"Content-Type": "application/json",
		"Authorization": "Bearer YOUR_ACCESS_TOKEN"
	}
  payload = {
	"destinationUrl": "https://example.com/long-url",
	"brandedDomain": "custom.domain",
	"slashTag": "my-custom-slug",
	"utm_source": "twitter",
	"utm_medium": "social",
	"utm_campaign": "summer_2024",
	"public": False,
	"password": "optional_password",
	"isQrGenerated": True,
	"qrSettings": {
		"color": "#000000",
		"bgColor": "#ffffff",
		"pattern": "classy",
		"corner": "square"
	}
	}
	
	response = requests.post(url, headers=headers, json=payload)
	data = response.json()						
RESPONSE
  {
    "success": true,
    "message": "Short Link Created Successfully.",
    "data": {
        "id": 1162,
        "type": "shortlink",
        "type2": null,
        "userId": 92,
        "clicks": 0,
        "lbClicks": 0,
        "scans": 0,
        "destinationUrl": "https://jsdev.org/",
        "faviconUrl": "",
        "title": "JS dev",
        "titleLabel": "js dev",
        "btnLabel": "Click Here",
        "brandedDomain": "kut.lt",
        "slashTag": "tw9e1",
        "edit": 0,
        "utm_id": null,
        "utm_content": null,
        "utm_term": null,
        "utm_campaign": null,
        "utm_medium": null,
        "utm_source": null,
        "preset": null,
        "bgColor": null,
        "color": null,
        "pattern": null,
        "corner": null,
        "logo": null,
        "qr": null,
        "qrLogoId": null,
        "tags": "",
        "linkInBioId": null,
        "uniqueTagId": 1221,
        "isActive": true,
        "isStarred": false,
        "expirationDate": "2025-06-25T04:30:15.979Z",
        "createdAt": "2025-03-27T04:30:25.542Z",
        "updatedAt": "2025-03-27T04:30:25.542Z",
        "fieldData": null,
        "frame": null,
        "isadminblocked": false,
        "isEdit": false,
        "password": null,
        "passwordProtectionEnabled": false,
        "primary": null,
        "qrType": null,
        "secondary": null,
        "text": null,
        "textColor": null
    }
    }
    
        
  {
        "message": "Unauthorized!"
    }
    
        
  {
    error: true,
    data: {
        message: 'Qr Code Limit Exceeded for your current plan. Please upgrade!',
    },
}

    
   {
    error: true,
    data: {
        message: `Link Limit Exceeded for your current plan. Please upgrade!`,
    },
}

        
   {
    error: true,
    data: {
        message: 'Bio Page Limit Exceeded for your current plan. Please upgrade!',
    },
}

        
  {
    error: true,
    data: {
        message: `Link Limit Exceeded for your current plan. Please upgrade!`,
    },
}