Register a webhook
| Field | Type | Required | Description |
|---|---|---|---|
url | string (URI) | Yes | HTTPS endpoint TruLayer posts events to. Must satisfy the URL requirements below. |
secret | string | Yes | Minimum 16 characters. Used to compute the X-TruLayer-Signature header on every delivery. |
events | string[] | No | Event types to subscribe to. Defaults to ["failure.detected"]. |
enabled | boolean | No | Whether deliveries are active. Defaults to true. |
201 Created with the new Webhook object.
URL requirements
TruLayer validates the URL at creation time. The request returns422 if any of these checks fail:
| Error key | Meaning |
|---|---|
webhook.url.not_https | The URL scheme is not https. HTTP URLs are not accepted. |
webhook.url.private_ip | The URL hostname resolves to a private, loopback, or link-local IP address. This protects against SSRF. |
webhook.url.unresolvable | The URL hostname could not be resolved via DNS at registration time. |
422 response:
Verify a webhook before enabling it
UsePOST /v1/webhooks/:id/test to send a synthetic ping event to your endpoint and inspect the response, without waiting for a real event to fire.
200 OK:
| Field | Type | Description |
|---|---|---|
status | integer | The HTTP status code your endpoint returned. 0 means TruLayer could not reach the endpoint (DNS failure, refused connection, TLS error, or timeout). |
body | string | The first 4 KB of the response body your endpoint returned. Useful for debugging rejection messages. |
Auth and plan requirements
POST /v1/webhooks/:id/test requires:
- Bearer token authentication (same as all other
/v1/endpoints) - Pro plan or above — Starter plan tenants receive
403 - Member or Owner role — Viewer role receives
403
Error responses
| Status | Meaning |
|---|---|
404 | Webhook not found, or belongs to a different tenant |
403 | Insufficient plan or role |
422 | The webhook URL failed validation (see URL requirements) |
Signature verification
Every delivery — live or synthetic — includes anX-TruLayer-Signature header. Verify it before processing the payload.
The header value is sha256=<hex>, where the hex string is the HMAC-SHA256 of the raw request body using the secret you provided at registration time.
Event types
| Event | Fired when |
|---|---|
failure.detected | A failure is detected in your traces (matches a failure rule) |
ping | A synthetic test delivery via POST /v1/webhooks/:id/test |