Update a Short Link

PUT /api/v1/short-link/:id

Common errors include:

  • "400 Bad Request" for an invalid request body or a blocked destination URL.
  • "404 Not Found" when the short link ID does not exist.

Updates an existing short link. This endpoint requires a Bearer token, an available link edit quota, and a short link id in the path. All request body fields are optional and only the provided values are updated.

Request

Method : PUT
Content-Type : Application/json

Request Body Schema

destinationUrl string
New destination URL.
id number Required
Path parameter for the short link ID.
slashTag string
New custom slug.
title string
New title for the short link.
tags string
Updated comma-separated tags.
expirationDate string
Default: null
New expiration date in ISO 8601 format, or null to remove it.
password string
New password, or an empty string to remove it.
passwordProtectionEnabled boolean
Toggle password protection.
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.
LANGUAGE
REQUEST
 curl -X PUT 'https://apis.divsly.com/api/v1/short-link/12345' \
-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://apis.divsly.com/api/v1/short-link/12345', {
  	method: 'PUT',
  	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: 'PUT',
  	url: 'https://apis.divsly.com/api/v1/short-link/12345',
  	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://apis.divsly.com/api/v1/short-link/12345',
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => 'PUT',
      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://apis.divsly.com/api/v1/short-link/12345"
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.put(url, headers=headers, json=payload)
data = response.json()
RESPONSE
 {
  "success": true,
  "message": "Short Link update Successfull.",
  "data": {
	"id": 1165,
	"type": "shortlink",
	"type2": null,
	"userId": 92,
	"clicks": 0,
	"lbClicks": 0,
	"scans": 0,
	"destinationUrl": "https://example.com/page1",
	"faviconUrl": "",
	"title": "Example Page 1",
	"titleLabel": "example page 1",
	"btnLabel": null,
	"brandedDomain": "your-domain.com",
	"slashTag": "9zqpq",
	"edit": 1,
	"utm_id": "",
	"utm_content": "",
	"utm_term": "",
	"utm_campaign": "summer2024",
	"utm_medium": "import",
	"utm_source": "bulk",
	"preset": null,
	"bgColor": null,
	"color": null,
	"pattern": null,
	"corner": null,
	"logo": null,
	"qr": null,
	"qrLogoId": null,
	"tags": "",
	"linkInBioId": null,
	"uniqueTagId": 1224,
	"isActive": true,
	"isStarred": false,
	"expirationDate": "2025-06-25T05:52:49.715Z",
	"createdAt": "2025-03-27T05:52:49.718Z",
	"updatedAt": "2025-03-27T06:04:00.736Z",
	"fieldData": null,
	"frame": null,
	"isadminblocked": false,
	"isEdit": false,
	"password": null,
	"passwordProtectionEnabled": false,
	"primary": null,
	"qrType": null,
	"secondary": null,
	"text": null,
	"textColor": null
  }
}

        
{
    success: false,
    message: 'Failed to create short link.',
    }
      
{
    "message": "Unauthorized!"
    }

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

        

   { success: false, error: error.message }