Skip to content

location.deleted webhook event

The location.deleted event tells your endpoint that a location has been removed. The event body does not repeat the location's settings; it identifies the deleted resource, and the users who belonged to that location are reassigned to the default location. That reassignment is reported separately through user.updated events, so a single deletion can produce a short burst of deliveries.

When the event fires

A delivery is sent when a location is deleted. The webhook owner must hold the locations:read scope. Because users of the deleted location move to the default location, expect one or more user.updated deliveries alongside the location.deleted delivery; treat them as related but distinct events rather than assuming the deletion payload carries the reassignment details.

Headers on every delivery

Each delivery carries the following headers. Required fields are marked with an asterisk in the reference contract.

Request body

The body is JSON. The type field is restricted to the deleted-event values, and for this event it is location.deleted. The data object follows the deleted-resource shape: it carries the ID of the deleted resource and, when known, the user ID and location ID it belonged to. The apiClient object appears only when the change was made through the API.

Deduplication and retries

Use VT-Event-Id (equal to the body's id) to skip duplicate deliveries of the same change. The id is deterministic, so the same change always produces the same ID; webhook.test events are the exception and get a random ID. VT-Delivery-Id is unique per delivery and stays the same across retries of that delivery, while VT-Delivery-Attempt counts attempts starting at 1. That combination lets you separate 'same event, new attempt' from 'same event, duplicate delivery'.

Signature verification

VT-Signature is structured as t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">. Build the signed string from the timestamp, a period, and the body exactly as received, then compare digests. For 24 hours after a secret rotation the header also carries a second v1 entry signed with the previous secret, so accept a match on either entry during that window. The full verification procedure lives in the signature verification section at the top of the API documentation.

Telling deletion apart from other location and user events

Three events can look adjacent in a log, so check the type before acting. location.updated reports a change to a location's settings or work week. location.deleted reports removal of the location. user.updated reports a change to a user's profile, location, department, role or work week, and is the event you will see when users are reassigned to the default location after a deletion. Only location.deleted carries the deleted-resource payload shape described above.

Worked example: one deletion, several deliveries

Suppose a location with several assigned users is deleted. Your endpoint receives a location.deleted delivery whose data.id is the deleted location's ID and whose type is location.deleted. Shortly after, deliveries arrive with type user.updated for each reassigned user, because their location changed to the default location. If your handler keys on VT-Event-Id, the location.deleted delivery is processed once even if the sender retries; the user.updated deliveries have their own IDs and are processed separately. If a retry of the location.deleted delivery arrives, VT-Delivery-Id matches the earlier attempt and VT-Delivery-Attempt is higher, so you can log the retry without repeating the deletion side effect.

Handler checklist

  1. Confirm the webhook owner holds locations:read before subscribing. 2. Verify VT-Signature against the raw body, accepting any matching v1 entry during the 24-hour rotation window. 3. Read type and reject anything that is not location.deleted in this handler. 4. Deduplicate on VT-Event-Id, not VT-Delivery-Id. 5. Read data.id as the deleted location's ID and treat data.userId and data.locationId as optional context. 6. Handle user.updated separately for reassigned users. 7. Do not rely on apiClient being present; it appears only for API-originated changes.
Delivery headers
HeaderRequiredMeaning
VT-Signatureyest=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">; a second v1 entry appears for 24 hours after a secret rotation
VT-Webhook-Idyesthe ID of the webhook the delivery is for
VT-Event-Idyesthe event ID, the same as id in the body; use it to skip duplicate deliveries
VT-Event-Typeyesthe event type, the same as type in the body
VT-Delivery-Idyesthe delivery ID, unique per delivery and kept across retries of the same delivery
VT-Delivery-Attemptyesthe attempt number of this delivery, starting at 1; range 1 <= value
User-Agentyesthe User-Agent string your integration should expect on deliveries; confirm the exact value against the current webhook documentation before matching on it

Header contract as published in the reference; requiredness reflects the reference contract, not runtime testing.

Body fields for location.deleted
FieldRequiredMeaning
idyesevent ID, the same as the VT-Event-Id header; deterministic, so the same change always has the same ID; webhook.test events get a random ID
typeyesthe event type; for this event, location.deleted
apiVersionyesthe API version of the data shape; value in "2"
createdAtyesa timestamp in the ISO 8601 format of when the event was created
companyIdyesthe ID of the company
datayesthe affected resource; deleted resources carry WebhookDeletedResourceData
data.idyesthe ID of the deleted resource
data.userIdnothe ID of the user the deleted resource belonged to, when known
data.locationIdnothe ID of the location the deleted resource belonged to, when known
apiClientnothe API key that made the change, present only when the change was made through the API
apiClient.keyIdyes (within apiClient)the ID of the API key
apiClient.namenothe key's integration name; absent when the key has none
apiClient.ownerIdyes (within apiClient)the ID of the user who owns the API key

Requiredness reflects the reference contract. data.userId and data.locationId are optional and present only when known.

Frequently asked questions

What does the data object contain for location.deleted?

It carries the deleted-resource shape: the ID of the deleted resource, plus the user ID and location ID it belonged to when those are known. It does not repeat the location's settings.

Why do I see user.updated events after a location.deleted delivery?

Users of the deleted location are moved to the default location, and that change is reported through user.updated events. They are separate deliveries with their own event IDs.

Which scope does the webhook owner need?

The owner needs locations:read.

Should I deduplicate on VT-Event-Id or VT-Delivery-Id?

Deduplicate on VT-Event-Id, which equals the body's id and is deterministic for the same change. VT-Delivery-Id is unique per delivery and stays constant across retries of that delivery, so it distinguishes retries rather than duplicate events.

How do I handle the signature during a secret rotation?

For 24 hours after a rotation, VT-Signature carries a second v1 entry signed with the previous secret. Verify against any v1 entry that matches during that window.

When is apiClient present?

Only when the change was made through the API. It identifies the API key that made the change, with keyId, an optional name, and ownerId.

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