Skip to main content
POST
/
webhook
/
cloudflare
/
domain-status
Cloudflare domain status webhook
curl --request POST \
  --url https://api.royalti.io/webhook/cloudflare/domain-status \
  --header 'Content-Type: application/json' \
  --data '
{
  "event": "ssl.validation_completed",
  "timestamp": "2024-06-16T12:00:00Z",
  "data": {
    "hostname_id": "cf_hostname_abc123xyz",
    "hostname": "studio.artist-label.com",
    "custom_hostname_status": "active",
    "ssl_status": "active",
    "validation_errors": [
      {
        "message": "<string>"
      }
    ]
  }
}
'
import requests

url = "https://api.royalti.io/webhook/cloudflare/domain-status"

payload = {
"event": "ssl.validation_completed",
"timestamp": "2024-06-16T12:00:00Z",
"data": {
"hostname_id": "cf_hostname_abc123xyz",
"hostname": "studio.artist-label.com",
"custom_hostname_status": "active",
"ssl_status": "active",
"validation_errors": [{ "message": "<string>" }]
}
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
event: 'ssl.validation_completed',
timestamp: '2024-06-16T12:00:00Z',
data: {
hostname_id: 'cf_hostname_abc123xyz',
hostname: 'studio.artist-label.com',
custom_hostname_status: 'active',
ssl_status: 'active',
validation_errors: [{message: '<string>'}]
}
})
};

fetch('https://api.royalti.io/webhook/cloudflare/domain-status', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.royalti.io/webhook/cloudflare/domain-status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event' => 'ssl.validation_completed',
'timestamp' => '2024-06-16T12:00:00Z',
'data' => [
'hostname_id' => 'cf_hostname_abc123xyz',
'hostname' => 'studio.artist-label.com',
'custom_hostname_status' => 'active',
'ssl_status' => 'active',
'validation_errors' => [
[
'message' => '<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.royalti.io/webhook/cloudflare/domain-status"

payload := strings.NewReader("{\n \"event\": \"ssl.validation_completed\",\n \"timestamp\": \"2024-06-16T12:00:00Z\",\n \"data\": {\n \"hostname_id\": \"cf_hostname_abc123xyz\",\n \"hostname\": \"studio.artist-label.com\",\n \"custom_hostname_status\": \"active\",\n \"ssl_status\": \"active\",\n \"validation_errors\": [\n {\n \"message\": \"<string>\"\n }\n ]\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.royalti.io/webhook/cloudflare/domain-status")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"ssl.validation_completed\",\n \"timestamp\": \"2024-06-16T12:00:00Z\",\n \"data\": {\n \"hostname_id\": \"cf_hostname_abc123xyz\",\n \"hostname\": \"studio.artist-label.com\",\n \"custom_hostname_status\": \"active\",\n \"ssl_status\": \"active\",\n \"validation_errors\": [\n {\n \"message\": \"<string>\"\n }\n ]\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.royalti.io/webhook/cloudflare/domain-status")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"ssl.validation_completed\",\n \"timestamp\": \"2024-06-16T12:00:00Z\",\n \"data\": {\n \"hostname_id\": \"cf_hostname_abc123xyz\",\n \"hostname\": \"studio.artist-label.com\",\n \"custom_hostname_status\": \"active\",\n \"ssl_status\": \"active\",\n \"validation_errors\": [\n {\n \"message\": \"<string>\"\n }\n ]\n }\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "Webhook processed successfully"
}
{
"success": false,
"message": "Invalid webhook signature"
}
{
"success": false,
"message": "Tenant not found"
}
{
"success": false,
"message": "Failed to process webhook"
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

Authentication: Requires cf-webhook-auth header with HMAC-SHA256 signature. Supported Event Types:
  • custom_hostname.created - Custom hostname created
  • custom_hostname.deleted - Custom hostname deleted
  • ssl.validation_completed - SSL certificate validated successfully
  • ssl.validation_failed - SSL certificate validation failed
  • ssl.renewed - SSL certificate renewed
  • ssl.renewal_failed - SSL certificate renewal failed
Workflow:
  1. Verifies HMAC signature using timing-safe comparison
  2. Finds tenant by hostname ID through CloudflareDomain table
  3. Updates domain status and SSL status in database
  4. Emits real-time Socket.io events to tenant room
  5. Sends email notifications (if configured)

Code Examples

const response = await fetch('https://api.royalti.io/webhook/cloudflare/domain-status', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "event": "ssl.validation_completed",
    "timestamp": "2024-06-16T12:00:00Z",
    "data": {
      "hostname_id": "cf_hostname_abc123xyz",
      "hostname": "studio.artist-label.com",
      "custom_hostname_status": "active",
      "ssl_status": "active",
      "validation_errors": [
        {
          "message": "sample-message"
        }
      ]
    }
  })
});

const data = await response.json();
console.log(data);
import requests

response = requests.post(
  'https://api.royalti.io/webhook/cloudflare/domain-status',
  headers={
    'Authorization': f'Bearer {token}'
  },
  json={"event":"ssl.validation_completed","timestamp":"2024-06-16T12:00:00Z","data":{"hostname_id":"cf_hostname_abc123xyz","hostname":"studio.artist-label.com","custom_hostname_status":"active","ssl_status":"active","validation_errors":[{"message":"sample-message"}]}}
)

data = response.json()
print(data)
curl -X POST https://api.royalti.io/webhook/cloudflare/domain-status \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"event":"ssl.validation_completed","timestamp":"2024-06-16T12:00:00Z","data":{"hostname_id":"cf_hostname_abc123xyz","hostname":"studio.artist-label.com","custom_hostname_status":"active","ssl_status":"active","validation_errors":[{"message":"sample-message"}]}}'

Body

application/json
event
enum<string>
required

Event type identifier

Available options:
custom_hostname.created,
custom_hostname.deleted,
ssl.validation_completed,
ssl.validation_failed,
ssl.renewed,
ssl.renewal_failed
Example:

"ssl.validation_completed"

timestamp
string<date-time>
required

ISO 8601 timestamp when event occurred

Example:

"2024-06-16T12:00:00Z"

data
object
required

Response

Webhook processed successfully

success
boolean
Example:

true

message
string
Example:

"Webhook processed successfully"