Skip to content

TOIL Request Cancelled Webhook

This event tells an integration that a time-off-in-lieu request has been withdrawn. It is useful for removing a pending item from a calendar, payroll or HR workflow, reversing a provisional balance, and notifying the approver that no decision is now needed. The webhook owner needs the toil:read scope.

When this event fires

A delivery is sent when the user who earned the TOIL cancels it, or when someone who manages that user cancels it on their behalf. That distinction matters for audit notes: record who initiated the change from your own workflow context, because the payload identifies the affected TOIL and, when the change came through an API key, the apiClient that made it.

Before acting on the payload, confirm the event type is toil.cancelled, confirm the TOIL status reflects the cancellation, and check whether a status reason was supplied. A reason is only present when the webhook owner also holds the leaves:read-reason scope; without that scope the field is null and should not be treated as an empty reason.

Handler checklist

Checklist for a safe handler:

  • Verify VT-Signature over the raw request body before parsing or trusting any field, and accept the previous-secret signature during the 24-hour rotation window.
  • Read VT-Event-Type to confirm toil.cancelled and compare it with type in the body.
  • Deduplicate using VT-Event-Id, which matches the body id and stays the same for the same change.
  • Use VT-Delivery-Id to trace one delivery across retries and VT-Delivery-Attempt, starting at 1, to see how many attempts have been made.
  • Confirm VT-Webhook-Id so the delivery is applied to the correct webhook subscription.
  • Return a successful 2XX response only after the cancellation has been recorded or safely queued, so retries are not triggered for work already done.

Payload map

The JSON body uses API version 2 and carries the event id, type, creation timestamp, company id, the affected TOIL resource in data, and an optional apiClient object. The data object follows the same shape returned by the matching GET endpoint for a TOIL request.

Fields worth mapping first are the TOIL id, user id, approver id, leave type id, start and end dates, full-day flag, location and department captured when the request was sent, status, reason, status reason, approval date and creation timestamp. Part-day requests may also include start and end hours and minutes, and a duration in working days. Extra fields may be present, so handlers should ignore unknown properties rather than failing on them.

Worked example

A practical example: an employee requests TOIL for a Friday, the approver sees it as pending, and then the employee withdraws it. Your integration receives toil.cancelled, finds the pending item by the TOIL id in data, marks it cancelled, releases any provisional balance, and sends a short notice to the approver. If the same delivery is retried, the identical event id lets the handler recognise the duplicate and skip the second update instead of sending the notice twice.

Cancellation is not denial, deletion or expiry

Do not confuse cancellation with neighbouring TOIL events. A denial records an approver decision and may carry a denial reason. A deletion removes the request entirely and its data carries only the deleted request's IDs, so there is no full TOIL resource to process. An expiry means no decision was made in time. Routing each event type to a separate handler keeps balances, notifications and audit history accurate.

Frequently asked questions

Who can trigger a TOIL cancellation notification?

It fires when the request owner withdraws the request, or when a manager acting for them does so. The webhook owner must hold the toil:read scope to receive it.

How should duplicate deliveries be handled?

Use the event ID from the VT-Event-Id header, which matches id in the body. It is deterministic for the same change, so a repeated delivery can be recognised and skipped. VT-Delivery-Id and VT-Delivery-Attempt describe the delivery itself and its retry count, not the underlying change.

How is cancellation different from denial or deletion?

Cancellation is a withdrawal by the user or their manager. Denial is a decision by an approver, location admin or admin, and deletion removes the request with only its IDs in data. Check the event type and the TOIL status in the payload rather than treating every closed request the same way.

What checks and scopes matter before processing the payload?

Verify VT-Signature against the raw body and timestamp, allow for a second signature entry for 24 hours after a secret rotation, and require the leaves:read-reason scope if you need the reason or status-reason text, which is otherwise null.

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