Delete Custom Domain

DELETE /api/v1/custom-domain

Common errors include:

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

This endpoint is for creating a custom domain

Request

Method : DELETE
Content-Type : Application/json

URL Parameters Schema

id number
Default: N/A
Domain ID to delete (passed as URL parameter)
LANGUAGE
REQUEST
 curl -X DELETE \
  'https://divsly-backend.vercel.app/api/v1/custom-domain/123' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN_HERE'

API REQUEST
 const deleteCustomDomain = (domainId) => {
  return new Promise((resolve, reject) => {
	fetch(`https://divsly-backend.vercel.app/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://divsly-backend.vercel.app/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://divsly-backend.vercel.app/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://divsly-backend.vercel.app/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”
}