leave.denied: the leave-denied webhook event
A leave.denied delivery tells your endpoint that an approver, a location admin or an admin has rejected a leave request. This page lists the headers your handler must read, the shape of the JSON body, and the scope the webhook owner needs. It also explains how a denial differs from a cancellation and where the denial reason appears.
What triggers a leave.denied delivery
A leave.denied event is produced when an approver, location admin or admin denies a leave. The webhook owner needs the leaves:read scope. If your integration also reads the reason text, it needs leaves:read-reason as well; without that scope the reason fields arrive as null.
Headers to read before the body
Every delivery carries a fixed set of headers. Read them before parsing the body, because they let you verify authenticity, route the event and skip retries you have already processed.
Payload fields and when they appear
The body is a JSON object with the event envelope and a data object that mirrors the matching GET endpoint. Some fields are conditional: approverId is present only when the leave request is approved, and the part-day hour and minute fields are returned only when isFullDayLeave is false. The reason and statusReason fields depend on the leaves:read-reason scope.
Denial, cancellation and approval: how to tell them apart
Three events can look similar at a glance, so route on type and status rather than on the presence of a reason string.
A worked example
Suppose a two-level department has a leave that the first-level approver has already passed. The leave is still OPEN with approvedLevel set to FIRST while it waits for the second-level approver. If that second approver denies it, the event type is leave.denied, status becomes DENIED, and statusReason carries the denial text when the leaves:read-reason scope is granted. If the employee withdraws the request instead, the event is leave.cancelled, not leave.denied.
Implementation checklist derived from the contract
The following checks follow from the documented fields and scopes. 1. The webhook owner needs leaves:read; reason text additionally requires leaves:read-reason. 2. VT-Signature is defined over the raw body, so verify it before parsing JSON. 3. VT-Event-Id matches the body id and is deterministic for the same change, so it can be used to skip repeats. 4. VT-Delivery-Id is kept across retries of one delivery, and VT-Delivery-Attempt counts attempts from 1. 5. Branch on type and status; a non-null statusReason alone does not identify a denial. 6. A null reason field can mean either no reason was given or the leaves:read-reason scope is absent.
| Header | Type | Required | Meaning |
|---|---|---|---|
| VT-Signature | string | Yes | t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">. For 24 hours after a secret rotation it carries a second v1 entry signed with the previous secret. |
| VT-Webhook-Id | string | Yes | the ID of the webhook the delivery is for. |
| VT-Event-Id | string | Yes | the event ID, the same as id in the body. Use it to skip duplicate deliveries. |
| VT-Event-Type | string | Yes | the event type, the same as type in the body. |
| VT-Delivery-Id | string | Yes | the delivery ID, unique per delivery and kept across retries of the same delivery. |
| VT-Delivery-Attempt | integer | Yes | the attempt number of this delivery, starting at 1. Range 1 <= value. |
| User-Agent | string | Yes | The User-Agent string identifies the sending webhook service and its version; treat it as informational only and never use it for authentication or routing decisions. |
Header names, types and descriptions are fixed contract values. Do not rename or re-case them.
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string | Yes | event ID, the same as the VT-Event-Id header. Deterministic, so the same change always has the same ID; use it to skip duplicates. webhook.test events get a random ID. |
| type | string | Yes | the event type. webhook.test is sent only by test deliveries and cannot be subscribed to. |
| apiVersion | string | Yes | the API version of the data shape. Value in "2". |
| createdAt | string | Yes | a timestamp in the ISO 8601 format of when the event was created. |
| companyId | string | Yes | the ID of the company. |
| data | object | Yes | the affected resource, in the same shape the matching GET endpoint returns. |
| apiClient | object | No | the API key that made the change, present only when the change was made through the API. |
| data.id | string | Yes | leave ID |
| data.userId | string | Yes | an ID of the user on leave |
| data.approverId | string | No | an ID of the approver, only when the leave request is approved; absent otherwise |
| data.autoApproved | boolean | No | is the leave request automatically approved or not |
| data.durationCalendarDays | number | Yes | the duration of a leave in calendar days |
| data.durationWorkingDays | number | Yes | the duration of a leave in working/business days |
| data.startDate | string | Yes | date in YYYY-MM-DD format |
| data.endDate | string | Yes | date in YYYY-MM-DD format |
| data.isFullDayLeave | boolean | Yes | true if the leave is a full day leave (1 or multiple days), or false if it is a part day leave (half day or hourly) |
| data.startHour | number | No | start hour in the user's time zone (in 24h format) for the part day leave, returned only when isFullDayLeave is false |
| data.endHour | number | No | end hour in the user's time zone (in 24h format) for the part day leave, returned only when isFullDayLeave is false |
| data.startMinute | number | No | start minutes in the user's time zone for the part day leave, returned only when isFullDayLeave is false |
| data.endMinute | number | No | end minutes in the user's time zone for the part day leave, returned only when isFullDayLeave is false |
| data.leaveTypeId | string | Yes | the ID of the leave type of the leave |
| data.locationId | string | Yes | the ID of the user's location when the leave request was sent |
| data.departmentId | string | Yes | the ID of the user's department when the leave request was sent |
| data.status | string | Yes | leave request status. Value in "APPROVED" | "OPEN" | "DENIED" | "CANCELLED" | "EXPIRED" | "DELETED" |
| data.reason | string | null | Yes | the reason the user gave for the leave, an empty string when none was given. Requires the leaves:read-reason scope; without it the value is null. |
| data.statusReason | string | null | Yes | the reason given when the leave was denied or cancelled, null when none was given. Requires the leaves:read-reason scope; without it the value is null. |
| data.approvedLevel | string | null | Yes | the approval level reached in a department with multi-level approval, null otherwise. An OPEN leave with approvedLevel FIRST is waiting for the second-level approver. Value in "FIRST" | "SECOND" | "THIRD" | null |
| data.createdAt | string | Yes | a timestamp in the ISO 8601 format |
| data.user | object | No | the user on leave (only when expand includes user) |
| data.approver | object | No | the approver, including location and department (only when expand includes approver) |
| data.leaveType | object | No | the leave type (only when expand includes leaveType) |
Field names, types and enum values are fixed contract values. Optional fields appear only under the stated conditions.
| Event | Trigger | Resulting status | Reason field |
|---|---|---|---|
| leave.denied | an approver, location admin or admin denies a leave | DENIED | statusReason is the reason given when the leave was denied or cancelled, null when none was given; requires leaves:read-reason |
| leave.cancelled | the user or someone who manages them cancels the leave | CANCELLED | statusReason is the reason given when the leave was denied or cancelled, null when none was given; requires leaves:read-reason |
| leave.approved | an approver, location admin or admin approves a leave | APPROVED | not applicable |
Branch on type and status together; do not infer a denial from a non-null statusReason alone.
Frequently asked questions
Does a leave.denied delivery always include a denial reason?
Not necessarily. statusReason holds the text given when the leave was denied, but it is null when no reason was given. It is also null when the webhook owner lacks the leaves:read-reason scope, even if a reason exists.
How do I avoid processing the same denial twice?
Compare the VT-Event-Id header with the id in the body. They match, and the ID is deterministic for the same change, so a repeat of the same event carries the same value. Keep a short-lived record of handled IDs and skip matches.
What changes during a secret rotation?
For 24 hours after a rotation, VT-Signature carries a second v1 entry signed with the previous secret. The signature-verification section at the top of the document defines how to validate it; follow that rule rather than assuming one here.
Is a denied leave the same as a cancelled one?
No. A denial comes from an approver, location admin or admin and produces leave.denied with status DENIED. A cancellation comes from the user or someone who manages them and produces leave.cancelled with status CANCELLED.
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 |