Delete a Short Link

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

Common errors include:

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

The deleteShortLink function deletes a short link by its id

Request

Method : DEETE
Content-Type : Application/json

Request Body Schema

id string/number Required
ID of the short link to be deleted.
LANGUAGE
REQUEST
 curl -X DELETE 'https://divsly-backend.vercel.app/api/v1/short-link/123'
  \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'

API REQUEST
 const deleteShortLink = (id) => {
  return new Promise((resolve, reject) => {
    fetch(`https://divsly-backend.vercel.app/api/v1/short-link/${id}`, {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
      }
    })
      .then(response => response.json())
      .then(data => resolve(data))
      .catch(error => reject(error));
  });
};

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

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

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

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

API REQUEST
 function deleteShortLink($id) {
    $url = "https://divsly-backend.vercel.app/api/v1/short-link/" . $id;

    $curl = curl_init();

    curl_setopt_array($curl, [
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_SSL_VERIFYPEER => false,  
    CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_HTTPHEADER => [
            "Authorization: Bearer YOUR_ACCESS_TOKEN"
        ],
    ]);

    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
        echo "Error: " . $err;
    } else {
        echo $response;
    }
}

// Usage
deleteShortLink(123);
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
  {
  "message": "Short Links Delete successfully",
  "success": true,
  "result": {
    "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!"
    }