Set up webhooks to receive real-time notifications about server events.
Webhooks allow you to receive real-time HTTP notifications when events occur on your servers.
POST /v1/webhooks
Content-Type: application/json
{
"url": "https://yourapp.com/webhooks/cdhosting",
"events": ["server.started", "server.stopped", "server.error"],
"secret": "your_webhook_secret"
}
POST /v1/webhooks
Content-Type: application/json
{
"url": "https://yourapp.com/webhooks/cdhosting",
"events": ["server.started", "server.stopped", "server.error"],
"secret": "your_webhook_secret"
}
| Event | Description |
|---|---|
| server.created | New server provisioned |
| server.started | Server powered on |
| server.stopped | Server powered off |
| server.rebooted | Server rebooted |
| server.error | Server encountered an error |
| server.backup.completed | Backup finished |
| billing.payment.succeeded | Payment processed |
| billing.payment.failed | Payment failed |
| billing.subscription.cancelled | Subscription cancelled |
{
"id": "evt_abc123",
"type": "server.started",
"created_at": "2025-01-15T10:30:00Z",
"data": {
"server_id": "srv_abc123",
"name": "production-web-01",
"status": "running",
"ip": "192.168.1.100"
}
}
{
"id": "evt_abc123",
"type": "server.started",
"created_at": "2025-01-15T10:30:00Z",
"data": {
"server_id": "srv_abc123",
"name": "production-web-01",
"status": "running",
"ip": "192.168.1.100"
}
}
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
Failed webhook deliveries are retried with exponential backoff:
After 5 failed attempts, the webhook is disabled and you'll receive an email notification.