Create a Webhook

POST/api/webhooks

Headers

FieldTypeDescription
authtoken String Authentication token, generated from admin area

Parameters

FieldTypeDescription
name String Webhook name.
url String Target URL (SSRF-checked: https/http public hosts only).
events String Comma list of event names, or "*" for all. See GET api/webhooks/events.
secret String optional HMAC secret. Deliveries then carry X-Perfex-Signature: t=,v1=.
timeout Number optional Request timeout in seconds (1-120).

default: 30

retry_count Number optional Retries in queued mode (0-10).

default: 3

headers String optional JSON object of custom headers.
curl -X POST "https://yoursite.com/api/webhooks" \
  -H "authtoken: YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "...", "url": "...", "events": "..." }'

Success-Response:

HTTP/1.1 200 OK
{
  "status": true,
  "message": "Webhook created successfully",
  "record_id": 3,
  "data": {
    "id": "3",
    "name": "Order sync",
    "url": "https://hooks.example.com/perfex",
    "events": ["invoice_created", "invoice_paid"],
    "active": "1",
    "headers": { "X-Env": "prod" },
    "timeout": "30",
    "retry_count": "3",
    "last_triggered": null,
    "success_count": "0",
    "failure_count": "0",
    "date_created": "2026-02-14 09:12:44",
    "date_updated": "2026-02-14 09:12:44",
    "has_secret": true
  }
}

Validation-Error:

HTTP/1.1 422 Unprocessable Entity
{
  "status": false,
  "error": "validation_failed",
  "message": "Webhook validation failed",
  "errors": {
    "url": "The url field is required.",
    "events": "Unknown events: invoice.paid. See GET api/webhooks/events for the catalog."
  }
}
MethodPOST
Path/api/webhooks
GroupWebhooks
Sincev3.0.0
Defined inmodules/api/controllers/Webhooks.php