Handling the leave-type.deleted webhook event
A leave-type.deleted delivery tells your endpoint that a leave type has been removed. The body is deliberately small: it identifies the event, the company, and the deleted resource by ID, without the full leave type record. This page maps the headers and body fields you receive, explains how retries and duplicate deliveries are distinguished, and shows where this event sits relative to leave-type.updated and leave-policy.enabled.
What triggers this event
The event fires when a leave type is deleted. The subscribing webhook owner needs the leave-types:read scope. Because the resource is gone, the payload does not repeat its name, color, or calendar settings; those belong to creation and update events. Treat the delivery as a deletion notice keyed by ID, and remove or archive your local copy of that leave type rather than expecting a full record.
Headers that arrive with every delivery
Each delivery carries a fixed set of headers. VT-Signature is built as t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">. When a secret has been rotated within the last 24 hours, the header also includes a second v1 entry computed with the outgoing secret, so receivers can validate against either key during that window. VT-Webhook-Id identifies which webhook the delivery belongs to. VT-Event-Id matches the body's id and is the field to use when skipping duplicates. VT-Event-Type matches the body's type. VT-Delivery-Id stays the same across retries of one delivery, while VT-Delivery-Attempt counts up from 1. The User-Agent value is defined by the source contract module and is not restated here.
Body fields and the deleted-resource shape
The JSON body contains id, type, apiVersion, createdAt, companyId, data, and an optional apiClient. The type value for this event is leave-type.deleted, and apiVersion is "2". createdAt is an ISO 8601 date-time. data follows the deleted-resource shape: it always includes the deleted resource's id, and may include userId, locationId, and additional keys. apiClient appears only when the change came through the API and, when present, carries keyId, an optional name, and ownerId.
Field and control map
Use this table to see which values are required, which are conditional, and what each one is for.
Choosing between the leave-type events
Three leave-type-related events are easy to confuse. Use leave-type.created when a new type appears. Use leave-type.updated when a type's name, color, status, or calendar settings change; that handler needs leave-types:read as well. Use leave-type.deleted only for removal. Separately, leave-policy.enabled covers a leave type being enabled for a location or its active policy changing there, and requires leave-policies:read. If your integration maintains a per-location policy table, listen for the policy event rather than inferring policy changes from leave-type.deleted.
Deduplication and retry checklist
A short checklist for the receive path: (1) verify VT-Signature against the raw body before parsing; (2) read VT-Event-Id and compare it with the body's id; (3) store processed event IDs so a retry with the same ID is skipped; (4) use VT-Delivery-Id to group attempts of one delivery and VT-Delivery-Attempt to see which attempt you are on; (5) confirm VT-Event-Type equals leave-type.deleted before routing to the deletion handler; (6) return a 2XX response once the event is durably recorded.
Worked example: a retried deletion delivery
Suppose your endpoint receives a leave-type.deleted body with id "evt_abc" and header VT-Event-Id "evt_abc". Your handler deletes the local leave type and records "evt_abc" as processed. A network timeout causes the sender to retry. The retry arrives with the same VT-Event-Id and the same VT-Delivery-Id, but VT-Delivery-Attempt is now 2. Because "evt_abc" is already in your processed set, you acknowledge the retry without running the deletion again. If instead a second, distinct deletion arrives, it has a different VT-Event-Id and is processed normally.
| Field | Location | Required | Purpose |
|---|---|---|---|
| VT-Signature | Header | Yes | Timestamp plus v1 HMAC-SHA256 entries over the timestamp and raw body; a second v1 entry appears for 24 hours after a secret rotation. Exact format is defined in the signature contract module. |
| VT-Webhook-Id | Header | Yes | Identifies the webhook the delivery is for. |
| VT-Event-Id | Header | Yes | Event ID; matches body id; use to skip duplicates. |
| VT-Event-Type | Header | Yes | Event type; matches body type. |
| VT-Delivery-Id | Header | Yes | Unique per delivery; stable across retries of the same delivery. |
| VT-Delivery-Attempt | Header | Yes | Attempt number, starting at 1; range 1 <= value. |
| User-Agent | Header | Yes | Value is defined by the source contract module and is not restated here. |
| id | Body | Yes | Event ID; deterministic for the same change; random for webhook.test. |
| type | Body | Yes | Event type; leave-type.deleted for this event. |
| apiVersion | Body | Yes | Data-shape version; value "2". |
| createdAt | Body | Yes | ISO 8601 date-time of event creation. |
| companyId | Body | Yes | ID of the company. |
| data | Body | Yes | Deleted-resource shape; always includes id, may include userId and locationId. |
| apiClient | Body | No | Present only for API-originated changes; carries keyId, optional name, ownerId. |
Required/optional status reflects the documented contract; the data object may include additional keys beyond id, userId, and locationId.
Frequently asked questions
Does the leave-type.deleted payload include the leave type's name or settings?
No. The deleted-resource shape carries the deleted resource's id and may include userId and locationId, but not the full leave type record. Name, color, status, and calendar settings belong to leave-type.updated.
Which scope does the webhook owner need for this event?
The owner needs leave-types:read.
How do I tell a retry from a new deletion?
Compare VT-Event-Id. Retries of the same delivery keep the same VT-Event-Id and VT-Delivery-Id, while VT-Delivery-Attempt increases. A distinct deletion has a different VT-Event-Id.
What does apiClient mean in the body?
It appears only when the change was made through the API. When present, it contains keyId, an optional name, and ownerId.
How is leave-type.deleted different from leave-policy.enabled?
leave-type.deleted signals removal of a leave type and requires leave-types:read. leave-policy.enabled signals that a leave type was enabled for a location or its active policy changed there, and requires leave-policies:read.
VT-Signature
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| VT-Signature | string | Yes | t= ,v1= . "> . For 24 hours after a secret rotation it carries a second v1 entry signed with the previous secret. See Signature verification at the top of this document. |
VT-Webhook-Id
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| VT-Webhook-Id | string | Yes | the ID of the webhook the delivery is for. |
VT-Event-Id
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| VT-Event-Id | string | Yes | the event ID, the same as id in the body. Use it to skip duplicate deliveries. |
VT-Event-Type
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| VT-Event-Type | string | Yes | the event type, the same as type in the body. | Allowed values: $3b |
VT-Delivery-Id
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| VT-Delivery-Id | string | Yes | the delivery ID, unique per delivery and kept across retries of the same delivery. |
VT-Delivery-Attempt
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| VT-Delivery-Attempt | integer | Yes | the attempt number of this delivery, starting at 1. | 1 <= value |