Outgoing webhooks
This page explains the webhooks MoorCP Shared sends to your systems: the available events, payload format, how to verify signatures, the retry schedule, and redelivery. With webhooks, billing or monitoring does not need to poll GET /v1/jobs/{id} to learn that an account is active, a suspend worked, or a backup failed.
Who can manage webhooks
| Creator | Events received | URL rules |
|---|---|---|
| Admin (admin staff or admin API key) | All events | http or https, without user:password |
| Billing key | Only events for accounts with the same billingOwner (jobs and account alerts). Events without an account, such as server alerts, are not sent. | Must be https to a public address. Localhost, private IPs, link-local (169.254.169.254), and *.internal are refused. The destination IP is checked again on every connection, redirects and proxies are not followed, and delivery errors do not reveal the address or port that was tried. |
Webhooks owned by a billing key can only be viewed, changed, deleted, tested, and redelivered by the same owner. Staff other than admins cannot manage webhooks.
Events
Events come from two sources.
Finished jobs
Each job below fires <kind>.succeeded or <kind>.failed when it finishes for good:
| Group | Job kinds |
|---|---|
| Accounts | account.provision, account.suspend, account.unsuspend, account.terminate, account.change_package, account.purge, account.move |
| Websites and SSL | website.provision, website.delete, ssl.issue, ssl.install |
| Backup | backup.run, backup.restore, backup.check, backup.restore_test, backup.external (client external backup rule), backup.archive_restore (restore from a portable archive in the account home) |
| Databases | db.export, db.import |
| Apps | app.install, app.wp_update, app.wp_restore, app.wp_clone |
| Migration | migration.cpanel_import, migration.wave_account, migration.wave_sync, migration.wave_cutover |
| Servers | server.switch_webserver |
| Files and Git | files.archive, files.extract, git.deploy |
Examples: account.provision.succeeded, backup.run.failed.
A job that staff cancel, stop, or kill (POST /v1/jobs/{id}/cancel) also fires <kind>.failed, with status set to cancelled. A job that was left running by a panel restart is closed after 3 minutes without a heartbeat and fires <kind>.failed with the error code cp.job_abandoned. Check status and errorCode in the payload if you need to tell these cases apart.
INFO
A job that is queued again after a temporary failure does not fire an event yet. The event is only sent when the job succeeds or fails for good.
Alerts
| Event | When |
|---|---|
alert.opened | A new alert appears |
alert.escalated | An alert goes from warning to critical |
alert.resolved | The alert condition is gone |
The full catalog is always available at GET /v1/webhooks/events.
Subscription patterns
The events field accepts:
| Pattern | Example | Matches |
|---|---|---|
| Exact type | account.provision.succeeded | One type |
| Prefix | account.* | All account events |
| Suffix | *.failed | All failures |
| Everything | * | All events |
Patterns that match no type are refused.
Creating a webhook
From the GUI
- Open Settings › Integrations & webhooks.
- Click New webhook.
- Enter a name and URL, and pick event groups. Other types can be typed in Other event types, separated by commas.
- Save. Copy the signing secret that appears, then click I've saved it. The secret is shown only once.
From the API
curl -sS -X POST https://panel.example.com:8443/v1/webhooks \
-H "X-API-Key: API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "billing", "url": "https://billing.example.com/moorcp/hook", "events": ["account.*", "*.failed"]}'The response contains a secret starting with whsec_. Store it on the receiver, because it cannot be shown again.
Request format
Every event is sent as a JSON POST:
{
"id": "EVENT_ID",
"type": "account.provision.succeeded",
"occurredAt": "2026-11-01T10:00:00Z",
"data": {
"jobId": "JOB_ID",
"kind": "account.provision",
"status": "succeeded",
"serverId": "SERVER_ID",
"account": {
"id": "ACCOUNT_ID",
"username": "jane",
"serverId": "SERVER_ID",
"status": "active",
"billingClientId": "1001",
"billingServiceId": "svc-10042"
},
"requestedBy": "billing-api:mybilling",
"attempt": 1,
"finishedAt": "2026-11-01T10:00:00Z"
}
}- Failed job events add
errorCodeanderrorMessage. - The job result is not sent, because it can contain sensitive data. Get it with
GET /v1/jobs/{jobId}. - Alert events contain
alertId,kind,severity,message,objectType,objectId,firstAt, andresolvedAt. Theaccountfield is set when the alert's object is an account. - Text in the payload (for example
message,errorMessage) is in Indonesian.
Headers
| Header | Content |
|---|---|
X-MoorCP-Event | Event type |
X-MoorCP-Event-Id | Event ID. The same for every attempt and redelivery. |
X-MoorCP-Delivery | Delivery ID. Different for every redelivery. |
X-MoorCP-Timestamp | Unix seconds when the request was signed |
X-MoorCP-Signature | sha256= + hex(HMAC-SHA256(secret, timestamp + "." + body)) |
Verifying the signature
The receiver should:
- recompute the signature from the raw body (before JSON parsing), and compare it in constant time;
- reject timestamps older than 5 minutes, to prevent replay;
- filter duplicates by
X-MoorCP-Event-Id; - answer 2xx as fast as possible, then process the event in the background.
WARNING
Do not compute the signature from JSON that was parsed and encoded again. Field order or whitespace can change, and the signature will not match.
PHP
<?php
$secret = getenv('MOORCP_WEBHOOK_SECRET');
$body = file_get_contents('php://input');
$ts = $_SERVER['HTTP_X_MOORCP_TIMESTAMP'] ?? '';
$sig = $_SERVER['HTTP_X_MOORCP_SIGNATURE'] ?? '';
$expected = 'sha256=' . hash_hmac('sha256', $ts . '.' . $body, $secret);
if (!hash_equals($expected, $sig) || abs(time() - (int)$ts) > 300) {
http_response_code(401);
exit;
}
$event = json_decode($body, true);
// Store $event['id'] to filter duplicates, then process.
http_response_code(204);Node.js (Express)
import crypto from 'node:crypto'
import express from 'express'
const app = express()
const secret = process.env.MOORCP_WEBHOOK_SECRET
app.post('/moorcp/hook', express.raw({ type: 'application/json' }), (req, res) => {
const ts = req.get('X-MoorCP-Timestamp') ?? ''
const sig = req.get('X-MoorCP-Signature') ?? ''
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(ts + '.' + req.body)
.digest('hex')
const ok = sig.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected))
if (!ok || Math.abs(Date.now() / 1000 - Number(ts)) > 300) {
return res.sendStatus(401)
}
const event = JSON.parse(req.body)
// Filter duplicates with event.id, then process in the background.
res.sendStatus(204)
})Python (Flask)
import hashlib, hmac, os, time
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["MOORCP_WEBHOOK_SECRET"].encode()
@app.post("/moorcp/hook")
def hook():
ts = request.headers.get("X-MoorCP-Timestamp", "")
sig = request.headers.get("X-MoorCP-Signature", "")
body = request.get_data()
expected = "sha256=" + hmac.new(SECRET, ts.encode() + b"." + body, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, sig) or abs(time.time() - int(ts or 0)) > 300:
abort(401)
event = request.get_json()
# Filter duplicates with event["id"], then process.
return "", 204Delivery and retries
Events go into an outbox in the panel database, one row per webhook. A control plane restart does not lose events.
New events are sent right away. The worker also processes the queue every 5 seconds.
Request timeout is 10 seconds. Redirects are not followed.
A 2xx response means success. Other responses or network errors are retried after:
Attempt Delay since previous attempt 2 30 seconds 3 2 minutes 4 10 minutes 5 30 minutes 6 1 hour 7 3 hours 8 6 hours 8 attempts in total over about 10 hours. After that the delivery fails for good.
The latest status (
lastStatus,lastError,lastAt) shows in the webhook list.Disabling a webhook stops new events. Deliveries still pending fail with "webhook dimatikan" (webhook disabled).
Delivery history is kept for 30 days.
TIP
Because an event can arrive more than once (retry or redelivery), make the receiver idempotent: store the X-MoorCP-Event-Id values you processed and ignore them if they come again.
Test, redeliver, and secret rotation
| Action | GUI | API |
|---|---|---|
Send a webhook.test event | Send test | POST /v1/webhooks/{id}/test |
| View delivery history | Deliveries | GET /v1/webhooks/{id}/deliveries |
| Redeliver | Redeliver in the history | POST /v1/webhooks/{id}/deliveries/{delivery}/redeliver |
| Rotate secret | Rotate secret | POST /v1/webhooks/{id}/rotate-secret |
| Disable or enable | Disable / Enable | PUT /v1/webhooks/{id} with enabled |
| Delete | Delete | DELETE /v1/webhooks/{id} |
- The history shows the response code, error, payload, and number of attempts.
- Redelivery creates a new delivery with the same
X-MoorCP-Event-Id, so the receiver can recognize duplicates. - Rotating the secret invalidates the old secret immediately. Update the secret on the receiver right after rotating.
WARNING
After rotation, every request still signed with the old secret fails verification. Prepare the receiver to accept the new secret before you press Rotate secret.
Creating, changing, deleting, rotating secrets, and redelivering are recorded in the audit log. The secret never goes into the audit log.
Webhook API
| Method | Path | Purpose |
|---|---|---|
| GET | /v1/webhooks | List (without secrets) |
| GET | /v1/webhooks/events | Event catalog |
| POST | /v1/webhooks | Create; the response contains secret |
| GET, PUT, DELETE | /v1/webhooks/{id} | View, change (name, url, events, enabled), delete |
| POST | /v1/webhooks/{id}/rotate-secret | New secret |
| POST | /v1/webhooks/{id}/test | Queue a webhook.test event |
| GET | /v1/webhooks/{id}/deliveries | Delivery history |
| POST | /v1/webhooks/{id}/deliveries/{delivery}/redeliver | Redeliver |
