Skip to content

TOIL request approved webhook (toil.approved)

When a TOIL request moves to approved, your system can react immediately instead of polling. approved delivery: who must hold which scope, which headers identify and authenticate the delivery, and which fields in the JSON body describe the approved TOIL.

When this event fires and who can receive it

Subscribe only if your integration needs to act on approval — for example updating balances, notifying the employee, or syncing a calendar. The owner of the webhook needs the toil:read scope. Approval can come from an approver, a location admin, or an admin; the event itself does not tell you which role acted, so read the approver and status fields in the payload rather than inferring the actor.

Headers: authenticate, identify, deduplicate

Verify VT-Signature against the raw body before parsing. VT-Event-Id mirrors the body's id and is deterministic for the same change, making it the right key to skip duplicates. VT-Delivery-Id identifies one delivery across its retries, and VT-Delivery-Attempt tells you which try you are on. VT-Event-Type mirrors the body's type, so cross-check the two. A practical handler order is: verify signature, check VT-Event-Type is toil.approved, deduplicate on VT-Event-Id, then process data.

Body: reading the approved TOIL payload

The body is application/json with apiVersion "2" and an ISO 8601 createdAt timestamp. The data object matches the shape returned by the matching GET endpoint for the TOIL resource. For an approval, expect status APPROVED and an approvalDate timestamp; approverId is populated once approved. Dates use YYYY-MM-DD. Part-day TOIL sets isFullDayLeave to false and includes start and end hour and minute fields in the user's time zone; durationWorkingDays converts part-day hours using an 8-hour day regardless of the user's working hours. locationId and departmentId reflect where the user was when the request was sent, not necessarily their current assignment.

Reason fields and the apiClient object

Two reason fields need care. The user's reason for the TOIL and the reason given on denial or cancellation both require the leaves:read-reason scope, which covers leaves and TOIL alike; without that scope the values arrive as null, so do not treat null as an empty reason. The optional apiClient object appears only when the change was made through the API and identifies the key that made it. If you need the reason text, request the scope up front rather than handling nulls as a fallback.

Distinguishing approval from neighbouring TOIL events

Do not confuse this event with its neighbours. toil.requested means a request is awaiting a decision; toil.added covers approved TOIL being added or auto-approved; toil.updated covers edits such as dates, times, leave type, or reason; toil.denied is the refusal counterpart. Only toil.approved signals a granted request with an approval timestamp. Filtering on VT-Event-Type or body type before processing keeps these flows separate.

Required delivery headers at a glance
HeaderPurposeHandling note
VT-SignatureAuthenticates the delivery over the raw bodyVerify first; accept a second v1 during the 24-hour rotation window
VT-Webhook-IdIdentifies the webhook this delivery belongs toUse to route or log per webhook
VT-Event-IdSame value as body idDeduplication key for the event
VT-Event-TypeSame value as body typeFilter for toil.approved before processing
VT-Delivery-IdUnique per delivery, stable across retriesCorrelate retries of the same delivery
VT-Delivery-AttemptAttempt number starting at 1Track retry progress

All listed headers are required on every delivery.

Body fields to check on approval
Body fieldWhat it tells youWatch out for
id / typeEvent identity and event kindtype is toil.approved for this page
apiVersion / createdAtData shape version and event timeapiVersion is "2"; createdAt is ISO 8601
data.statusTOIL request statusAPPROVED on this event
data.approvalDateWhen approval happenedNull until approved
data.approverIdWho approvedNull until approved
data.isFullDayLeaveFull-day vs part-day TOILPart-day adds hour/minute fields
data.reason / data.statusReasonUser reason and decision reasonNull without leaves:read-reason scope
apiClientAPI key that made the changePresent only for API-made changes

Fields marked optional in the contract may be absent or null.

Frequently asked questions

What triggers the toil.approved webhook?

This delivery fires when an approver, a location admin, or an admin grants a TOIL request. The webhook owner must hold the toil:read scope to receive it.

How should duplicate deliveries be handled?

Treat VT-Event-Id, which matches the body's id field, as the deduplication key. VT-Delivery-Id stays the same across retries of one delivery, while VT-Delivery-Attempt counts attempts starting at 1, so you can distinguish a repeated delivery from a new event.

What must be checked before trusting the payload?

Check VT-Signature first, using the raw request body exactly as received. During the 24 hours after a secret rotation, a second v1 value signed with the previous secret may be present, so accept either valid signature during that window.

VT-Signature

FieldTypeRequiredDescriptionConstraints
VT-SignaturestringYest= ,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

FieldTypeRequiredDescriptionConstraints
VT-Webhook-IdstringYesthe ID of the webhook the delivery is for.

VT-Event-Id

FieldTypeRequiredDescriptionConstraints
VT-Event-IdstringYesthe event ID, the same as id in the body. Use it to skip duplicate deliveries.

VT-Event-Type

FieldTypeRequiredDescriptionConstraints
VT-Event-TypestringYesthe event type, the same as type in the body.Allowed values: $3b

VT-Delivery-Id

FieldTypeRequiredDescriptionConstraints
VT-Delivery-IdstringYesthe delivery ID, unique per delivery and kept across retries of the same delivery.

VT-Delivery-Attempt

FieldTypeRequiredDescriptionConstraints
VT-Delivery-AttemptintegerYesthe attempt number of this delivery, starting at 1.1 <= value