Delete a Short Link

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

Common errors include:

  • "401 Unauthorized" when a valid Bearer token is not provided.
  • "500 Internal Server Error" if the delete request cannot be completed.

Soft deletes a short link for the authenticated user using its path id.

Request

Method : DELETE
Content-Type : Application/json

URL Parameters Schema

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

API REQUEST
 const deleteShortLink = (id) => {
  return new Promise((resolve, reject) => {
    fetch(`https://apis.divsly.com/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://apis.divsly.com/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://apis.divsly.com/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://apis.divsly.com/api/v1/short-link/12345"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.delete(url, headers=headers)
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!"
    }