Bulk Delete Short Link

POST /api/v1/bulk-delete

Common errors include:

  • "Bad Request" if body parameters are not passed
  • "DNS_CONFIGURATION_ERROR" if custom domain DNS is misconfigured.

The getShortLinks gets all the short links and returns the reponse to users

Request

Method : POST
Content-Type : Application/json

Request Body Schema

bulkLinks array Required
Default: -
Array of objects containing link IDs to be deleted
bulkLinks[].id number Required
Default: -
ID of the link to be deleted
bulkLinks[].type string No
Default: -
Type of link (QR, BIO_LINK, QR_N_BIO_PAGE, or shortlink)
LANGUAGE
REQUEST
 curl -X POST \
  'https://divsly-backend.vercel.app/api/v1/shortlinks/bulk-delete' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
	"bulkLinks": [
  	{
    	"id": 123,
    	"type": "shortlink"
  	},
  	{
    	"id": 456,
    	"type": "QR"
  	}
	]
  }'

API REQUEST
 const bulkDelete = (links) => {
  return new Promise((resolve, reject) => {
	fetch('https://divsly-backend.vercel.app/api/v1/shortlinks/bulk-delete', {
  	method: 'POST',
  	headers: {
    	'Authorization': 'Bearer YOUR_JWT_TOKEN',
    	'Content-Type': 'application/json'
  	},
  	body: JSON.stringify({
    	bulkLinks: links
  	})
	})
  	.then(response => response.json())
  	.then(data => resolve(data))
  	.catch(error => reject(error));
  });
};

const linksToDelete = [
  {
	id: 123,
	type: "shortlink"
  },
  {
	id: 456,
	type: "QR"
  }
];

bulkDelete(linksToDelete)
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

API REQUEST
 const axios = require('axios');

const bulkDelete = (links) => {
  return new Promise((resolve, reject) => {
	axios({
  	method: 'post',
  	url: 'https://divsly-backend.vercel.app/api/v1/shortlinks/bulk-delete',
  	headers: {
    	'Authorization': 'Bearer YOUR_JWT_TOKEN',
    	'Content-Type': 'application/json'
  	},
  	data: {
    	bulkLinks: links
  	}
	})
  	.then(response => resolve(response.data))
  	.catch(error => reject(error.response?.data || error));
  });
};

const linksToDelete = [
  {
	id: 123,
	type: "shortlink"
  },
  {
	id: 456,
	type: "QR"
  }
];

bulkDelete(linksToDelete)
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
API REQUEST
 $url = "https://divsly-backend.vercel.app/api/v1/shortlinks/bulk-delete";
$data = array(
	'bulkLinks' => array(
    	array(
        	'id' => 123,
        	'type' => 'shortlink'
    	),
    	array(
        	'id' => 456,
        	'type' => 'QR'
    	)
	)
);

$headers = array(
	'Authorization: Bearer YOUR_JWT_TOKEN',
	'Content-Type: application/json'
);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
?>
API REQUEST
 import requests
import json

url = "https://divsly-backend.vercel.app/api/v1/shortlinks/bulk-delete"
headers = {
	"Authorization": "Bearer YOUR_JWT_TOKEN",
	"Content-Type": "application/json"
}
payload = {
	"bulkLinks": [
    	{
        	"id": 123,
        	"type": "shortlink"
    	},
    	{
        	"id": 456,
        	"type": "QR"
    	}
	]
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
RESPONSE
  {
  "success": true,
  "erroredData": [],
  "message": "Query executed successfully!",
  "resultData": [
	{
  	"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": 0,
  	"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": "promo,summer",
  	"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-27T05:52:49.718Z",
  	"fieldData": null,
  	"frame": null,
  	"isadminblocked": false,
  	"isEdit": false,
  	"password": null,
  	"passwordProtectionEnabled": false,
  	"primary": null,
  	"qrType": null,
  	"secondary": null,
  	"text": null,
  	"textColor": null
	},
	{
  	"id": 1166,
  	"type": "shortlink",
  	"type2": null,
  	"userId": 92,
  	"clicks": 0,
  	"lbClicks": 0,
  	"scans": 0,
  	"destinationUrl": "https://example.com/page2",
  	"faviconUrl": "",
  	"title": "Example Page 2",
  	"titleLabel": "example page 2",
  	"btnLabel": null,
  	"brandedDomain": "your-domain.com",
  	"slashTag": "hs5c9",
  	"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": "winter,promo",
  	"linkInBioId": null,
  	"uniqueTagId": 1225,
  	"isActive": true,
  	"isStarred": false,
  	"expirationDate": "2025-06-25T05:53:00.271Z",
  	"createdAt": "2025-03-27T05:53:00.273Z",
  	"updatedAt": "2025-03-27T05:53:00.273Z",
  	"fieldData": null,
  	"frame": null,
  	"isadminblocked": false,
  	"isEdit": false,
  	"password": null,
  	"passwordProtectionEnabled": false,
  	"primary": null,
  	"qrType": null,
  	"secondary": null,
  	"text": null,
  	"textColor": null
	}
  ]
}
        
 {
	"message": "Unauthorized!"
}


     { success: false, error: “Bulk deletion failed }