This endpoint is for creating a custom domain
curl -X POST \
'https://divsly-backend.vercel.app/api/v1/custom-domain' \
-H 'Authorization: Bearer YOUR_JWT_TOKEN_HERE' \
-H 'Content-Type: application/json' \
-d '{
"domain": "example.com",
"subDomain": "blog",
"spare": "No"
}'
const createCustomDomain = (domainData) => {
return new Promise((resolve, reject) => {
fetch('https://divsly-backend.vercel.app/api/v1/custom-domain', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
domain: domainData.domain,
subDomain: domainData.subDomain,
spare: domainData.spare
})
})
.then(response => response.json())
.then(data => resolve(data))
.catch(error => reject(error));
});
};
const axios = require('axios');
const createCustomDomain = (domainData) => {
return new Promise((resolve, reject) => {
axios({
method: 'post',
url: 'https://divsly-backend.vercel.app/api/v1/custom-domain',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE',
'Content-Type': 'application/json'
},
data: {
domain: domainData.domain,
subDomain: domainData.subDomain,
spare: domainData.spare
}
})
.then(response => resolve(response.data))
.catch(error => reject(error.response.data));
});
};
$data = array(
'domain' => 'example.com',
'subDomain' => 'blog',
'spare' => 'No'
);
$ch = curl_init('https://divsly-backend.vercel.app/api/v1/custom-domain');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer YOUR_JWT_TOKEN_HERE',
'Content-Type: application/json'
));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
import requests
import json
url = 'https://divsly-backend.vercel.app/api/v1/custom-domain'
headers = {
'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE',
'Content-Type': 'application/json'
}
data = {
'domain': 'example.com',
'subDomain': 'blog',
'spare': 'No'
}
try:
response = requests.post(
url,
headers=headers,
json=data
)
response.raise_for_status()
print(response.json())
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
{
"status": 200,
"message": "Custom Domain Added Successfully .",
"data": {
"id": 34,
"userId": 89,
"domain": "https://testdomain.com",
"spare": "Yes",
"subDomain": null,
"domainUrl": "https://testdomain.com",
"status": "Pending",
"createdAt": "2025-04-02T03:47:37.430Z",
"updatedAt": "2025-04-02T03:47:37.430Z"
}
}
{
"message": "Unauthorized!"
}
{
"message": "Custom Domain Limit Exceeded for your current plan. Please upgrade!!"
}
{
"success": false,
"error": “Error creating Custom domain”
}