Bulk Create Short Link

POST /api/v1/import-short-link

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

importData Array Required
Default: -
Array of objects containing short link data
brandedDomain string Required
Default: null
Domain to be used for short links
tags string No
Default: -
Common tags to be applied to all links

ImportData Body Schema

destinationUrl string Required
Default: -
Target URL for the short link
slashTag string No
Default: Auto-generated
Custom path for the short URL
title string No
Default: Auto-fetched
Title for the short link
tags string No
Default: ''
Comma-separated tags specific to this link
faviconUrl string No
Default: ''
URL for the favicon image
expirationDate string No
Default: #ERROR!
Expiration date for the link
utm_source string No
Default: ''
UTM source parameter
utm_medium string No
Default: ''
UTM medium parameter
utm_campaign string No
Default: ''
UTM campaign parameter
utm_term string No
Default: ''
UTM term parameter
utm_content string No
Default: ''
UTM content parameter
utm_id string No
Default: ''
UTM ID parameter
LANGUAGE
REQUEST
 curl --location 'https://divsly-backend.vercel.app/api/v1/import-short-link' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
  "importData": [
	{
  	"destinationUrl": "https://example.com/page1",
  	"slashTag": "custom-page1",
  	"title": "Example Page 1",
  	"tags": "promo,summer",
  	"utm_source": "bulk",
  	"utm_medium": "import",
  	"utm_campaign": "summer2024"
	},
	{
  	"destinationUrl": "https://example.com/page2",
  	"slashTag": "custom-page2",
  	"title": "Example Page 2",
  	"tags": "winter,promo"
	}
  ],
  "brandedDomain": "your-domain.com",
  "tags": "global-tag,bulk-import"
}'

API REQUEST
 const bulkImportLinks = (importPayload) => {
  return new Promise((resolve, reject) => {
	fetch('https://divsly-backend.vercel.app/api/v1/import-short-link', {
  	method: 'POST',
  	headers: {
    	'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    	'Content-Type': 'application/json'
  	},
  	body: JSON.stringify(importPayload)
	})
  	.then(response => response.json())
  	.then(data => resolve(data))
  	.catch(error => reject(error));
  });
};

const payload = {
  importData: [
	{
  	destinationUrl: "https://example.com/page1",
  	slashTag: "custom-page1",
  	title: "Example Page 1",
  	tags: "promo,summer",
  	utm_source: "bulk",
  	utm_medium: "import",
  	utm_campaign: "summer2024"
	},
	{
  	destinationUrl: "https://example.com/page2",
  	slashTag: "custom-page2",
  	title: "Example Page 2",
  	tags: "winter,promo"
	}
  ],
  brandedDomain: "your-domain.com",
  tags: "global-tag,bulk-import"
};

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

const bulkImportLinks = (importPayload) => {
  return new Promise((resolve, reject) => {
	axios.post(
  	'https://divsly-backend.vercel.app/api/v1/import-short-link',
  	importPayload,
  	{
    	headers: {
      	'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    	}
  	}
	)
  	.then(response => resolve(response.data))
  	.catch(error => reject(error.response?.data || error.message));
  });
};

const payload = {
  importData: [
	{
  	destinationUrl: "https://example.com/page1",
  	slashTag: "custom-page1",
  	title: "Example Page 1",
  	tags: "promo,summer",
  	utm_source: "bulk",
  	utm_medium: "import",
  	utm_campaign: "summer2024"
	},
	{
  	destinationUrl: "https://example.com/page2",
  	slashTag: "custom-page2",
  	title: "Example Page 2",
  	tags: "winter,promo"
	}
  ],
  brandedDomain: "your-domain.com",
  tags: "global-tag,bulk-import"
};

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

API REQUEST
 $curl = curl_init();

$payload = [
	"importData" => [
    	[
        	"destinationUrl" => "https://example.com/page1",
        	"slashTag" => "custom-page1",
        	"title" => "Example Page 1",
        	"tags" => "promo,summer",
        	"utm_source" => "bulk",
        	"utm_medium" => "import",
        	"utm_campaign" => "summer2024"
    	],
    	[
        	"destinationUrl" => "https://example.com/page2",
        	"slashTag" => "custom-page2",
        	"title" => "Example Page 2",
        	"tags" => "winter,promo"
    	]
	],
	"brandedDomain" => "your-domain.com",
	"tags" => "global-tag,bulk-import"
];

curl_setopt_array($curl, [
  CURLOPT_URL => "https://divsly-backend.vercel.app/api/v1/import-short-link",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_SSL_VERIFYPEER => false,  // Disable SSL peer verification
  CURLOPT_SSL_VERIFYHOST => false,
  CURLOPT_POSTFIELDS => json_encode($payload),
  CURLOPT_HTTPHEADER => [
	"Authorization: Bearer YOUR_ACCESS_TOKEN",
	"Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
API REQUEST
 import requests
import json

def bulk_import_links():
	url = "https://divsly-backend.vercel.app/api/v1/import-short-link"
	headers = {
    	"Authorization": "Bearer YOUR_ACCESS_TOKEN",
    	"Content-Type": "application/json"
	}
    
	payload = {
    	"importData": [
        	{
            	"destinationUrl": "https://example.com/page1",
            	"slashTag": "custom-page1",
            	"title": "Example Page 1",
            	"tags": "promo,summer",
            	"utm_source": "bulk",
            	"utm_medium": "import",
            	"utm_campaign": "summer2024"
        	},
        	{
            	"destinationUrl": "https://example.com/page2",
            	"slashTag": "custom-page2",
            	"title": "Example Page 2",
            	"tags": "winter,promo"
        	}
    	],
    	"brandedDomain": "your-domain.com",
    	"tags": "global-tag,bulk-import"
	}
    
	try:
    	response = requests.post(url, headers=headers, json=payload)
    	response.raise_for_status()
    	return response.json()
	except requests.exceptions.RequestException as e:
    	print(f"Error: {e}")
    	return None

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!"
}

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

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