leave.added webhook: approved leave added or auto-approved
This event covers two paths to an approved leave: manual creation by an approver or admin, and automatic approval when the leave policy does not need approval. The webhook owner requires leaves:read.
What this event means
Treat this event as the point at which a leave enters the system already approved. It is not the pending-request event: a request that still needs approval belongs to leave.requested, and later edits to an existing open or approved leave belong to leave.updated. Distinguishing these paths prevents a handler from treating every new leave record as newly approved for the same reason.
Delivery handling checklist
Before processing the payload, verify the signature header against the raw body and timestamp, then read the delivery headers. VT-Event-Id matches the body id and is the deduplication key. VT-Delivery-Id identifies one delivery across its retries, and VT-Delivery-Attempt starts at 1 and increments. VT-Webhook-Id identifies the webhook, and VT-Event-Type matches the body type. Check the event type first so unrelated deliveries do not reach leave-specific logic.
Reading the payload
The JSON body carries id, type, apiVersion, createdAt, companyId and data, with an optional apiClient when the change originated through an API key. For this event, data describes the leave: its user, dates and durations, full-day or part-day timing, leave type, location, department, status, approval level and creation time. approverId and autoApproved help explain how approval happened, but approverId is present only for an approved request and autoApproved indicates whether approval was automatic. Expanded user, approver and leaveType objects are optional and depend on expand.
Using autoApproved in practice
A practical handler can branch on autoApproved: when true, record the leave as policy-approved without expecting a human approver action; when false, expect the manual approver or admin path. In both cases, store the event ID before applying side effects, then use the leave ID in data to update downstream calendars or reports. If the same event ID arrives again, acknowledge it without repeating those side effects.
| Check | What to confirm |
|---|---|
| Signature | Verify VT-Signature over the raw body before trusting the payload. |
| Event identity | Compare VT-Event-Id with body id and skip an event ID already processed. |
| Delivery identity | Use VT-Delivery-Id to correlate retries and VT-Delivery-Attempt to see the attempt number. |
| Scope | Confirm the webhook owner has leaves:read; reason fields also need leaves:read-reason. |
| Approval path | Read autoApproved and approverId to distinguish automatic approval from manual addition. |
Narrative handling checklist only; the immutable header and body contracts are supplied separately in protected modules.
Frequently asked questions
When is the leave.added webhook sent?
It fires in two situations: an approver or admin creates a leave that is already approved, or a request is approved automatically because the applicable leave policy does not require approval. The webhook owner needs leaves:read.
How should duplicate deliveries be handled?
Use the deterministic event ID, also supplied in the VT-Event-Id header, to recognise a repeat delivery and skip processing it again. The delivery ID is separate: it stays the same across retries of one delivery, while the attempt number increases.
What does the data object contain?
The data object uses the same shape as the matching GET endpoint for the affected leave. Optional expanded objects, such as user, approver or leaveType, appear only when requested through expand. The reason fields require the leaves:read-reason scope and are null without it.
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 |