Delete Custom Domain

DELETE /api/v1/custom-domain

Common errors include:

  • "401 Unauthorized" if the bearer token is missing or invalid.
  • "500 Internal Server Error" if the custom domain could not be deleted.

Deletes a custom domain from the user's account.

Request

Method : DELETE
Content-Type : Application/json
Authentication : Bearer Token
Base URL : https://apis.divsly.com/api/v1

URL Parameters Schema

id number
Default: N/A
The ID of the domain
LANGUAGE
REQUEST
 curl -X DELETE \
  'https://apis.divsly.com/api/v1/custom-domain/123' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN_HERE'

API REQUEST
 const deleteCustomDomain = (domainId) => {
  return new Promise((resolve, reject) => {
	fetch(`https://apis.divsly.com/api/v1/custom-domain/${domainId}`, {
  	method: 'DELETE',
  	headers: {
    	'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE'
  	}
	})
  	.then(response => response.json())
  	.then(data => resolve(data))
  	.catch(error => reject(error));
  });
};
API REQUEST
 const axios = require('axios');

const deleteCustomDomain = (domainId) => {
  return new Promise((resolve, reject) => {
	axios({
  	method: 'delete',
  	url: `https://apis.divsly.com/api/v1/custom-domain/${domainId}`,
  	headers: {
    	'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE'
  	}
	})
  	.then(response => resolve(response.data))
  	.catch(error => reject(error.response.data));
  });
};
API REQUEST
 $ch = curl_init('https://apis.divsly.com/api/v1/custom-domain/123');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Authorization: Bearer YOUR_JWT_TOKEN_HERE'
    ));

    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    $result = json_decode($response, true);
    print_r($result);

API REQUEST
 import requests

  url = 'https://apis.divsly.com/api/v1/custom-domain/123'
   headers = {
	'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE'
}

  try:
	response = requests.delete(
    	url,
    	headers=headers
	)
	response.raise_for_status()
	print(response.json())
  except requests.exceptions.RequestException as e:
	print(f"Error: {e}")

RESPONSE
  {
  "status": 200,
  "message": "Custom Domain deleted Successfully.",
  "data": {
	"id": 35,
	"userId": 89,
	"domain": "https://testdomain.com",
	"spare": "Yes",
	"subDomain": null,
	"domainUrl": "https://testdomain.com",
	"status": "Pending",
	"createdAt": "2025-04-02T03:57:34.927Z",
	"updatedAt": "2025-04-02T03:57:34.927Z"
  }
}

   
  {
    "message": "Unauthorized!"
}

  {
  "success": false,
  "error": “Error deleting Custom Domain”
}