Skip to content

department.created webhook event

The department.created event fires when a new department is created. The webhook owner must hold the departments:read scope. This page maps the delivery headers, the body shape, and the checks a receiver should run before acting on the payload.

Trigger and scope

The event is sent when a department is created. The webhook owner needs the departments:read scope. The body type is DepartmentWebhookEvent, and its data object mirrors the fields of GET /v2/departments/{id} except for parent and approvers. The data object carries id, name, isDefault, createdAt, and any additional string-keyed fields.

Delivery headers

Each delivery includes a fixed set of required headers. VT-Signature carries a timestamp plus one or more v1 HMAC-SHA256 values computed over the string formed by the timestamp, a period, and the raw request body. When a signing secret is rotated, the header may also contain a second v1 value signed with the previous secret for a limited period, allowing verification against either secret during that window (the owner's rotation window is represented by the placeholder for that setting). VT-Webhook-Id names the webhook that produced the delivery. VT-Event-Id is the same value as the body's id and serves as the deduplication key. VT-Event-Type is the same value as the body's type. VT-Delivery-Id is unique to a delivery and remains unchanged when that delivery is retried. VT-Delivery-Attempt is an integer that begins at 1. The User-Agent value is supplied by the owner as a contract literal (represented by the owner's User-Agent placeholder) and should be confirmed before publication.

Body shape

The body is JSON with required fields id, type, apiVersion, createdAt, companyId, and data, plus an optional apiClient. id is deterministic for the same change, so the same change always produces the same ID; webhook.test events get a random ID. type is the event type and cannot be subscribed to as webhook.test. apiVersion is the data shape version and is "2" for this event. createdAt is an ISO 8601 timestamp. companyId is the company ID. data is the affected department resource. apiClient is present only when the change was made through the API and carries keyId, optional name, and ownerId.

Receiver checklist

  1. Verify VT-Signature against the raw body before parsing. 2. Compare VT-Event-Id with the body id and skip the delivery if that ID has already been processed. 3. Use VT-Delivery-Id to group retries of the same delivery and VT-Delivery-Attempt to see which attempt is being handled. 4. Read data.id, data.name, data.isDefault, and data.createdAt to update local department state. 5. Treat apiClient as optional and only present for API-originated changes.

Field and control map

Header fields: VT-Signature (required, string), VT-Webhook-Id (required, string), VT-Event-Id (required, string), VT-Event-Type (required, string), VT-Delivery-Id (required, string), VT-Delivery-Attempt (required, integer, 1 <= value), User-Agent (required, string, owner-supplied contract literal represented by the owner's User-Agent placeholder). Body fields: id (required, string), type (required, string, one of the values in the department.created and department.updated set), apiVersion (required, string, the value 2), createdAt (required, string, date-time), companyId (required, string), data (required, object with id, name, isDefault, createdAt, and additional string-keyed fields), apiClient (optional, object with keyId, name, ownerId).

Worked example

Suppose a department named Engineering is created. The delivery arrives with VT-Event-Id equal to the body id, VT-Delivery-Attempt 1, a User-Agent value supplied by the owner as a contract literal (represented by the owner's User-Agent placeholder), and a VT-Signature in the form t=<unix seconds>,v1=<hex HMAC-SHA256 of the timestamp, a period, and the raw body>. The receiver recomputes the HMAC over the timestamp and raw body, compares it to the v1 entry, and then checks whether the event ID has already been processed. If it has not, the receiver reads data.id, data.name, data.isDefault, and data.createdAt and stores the new department. A retry of the same delivery keeps the same VT-Delivery-Id but increments VT-Delivery-Attempt.

Failure distinctions

A signature mismatch means the HMAC did not match the v1 entry; reject the delivery and do not process the body. A duplicate delivery means the same VT-Event-Id or body id has already been processed; skip it. A retry is a new attempt of the same VT-Delivery-Id with a higher VT-Delivery-Attempt; process it only if the event ID has not been handled. A missing apiClient means the change did not originate from the API, not that the payload is invalid.

Delivery headers
HeaderTypeRequiredMeaning
VT-SignaturestringYest=<unix seconds>,v1=<hex HMAC-SHA256 of the timestamp, a period, and the raw body>; a second v1 entry may be present for 24 hours after a secret rotation (the owner's rotation window is represented by the placeholder for that setting)
VT-Webhook-IdstringYesID of the webhook the delivery is for
VT-Event-IdstringYesEvent ID, same as body id; use to skip duplicates
VT-Event-TypestringYesEvent type, same as body type
VT-Delivery-IdstringYesDelivery ID, unique per delivery and kept across retries
VT-Delivery-AttemptintegerYesAttempt number, starting at 1; range 1 <= value
User-AgentstringYesOwner-supplied contract literal represented by the owner's User-Agent placeholder

Header values are exact contract fields; do not alter casing or types.

DepartmentWebhookEvent body fields
FieldTypeRequiredMeaning
idstringYesEvent ID, same as VT-Event-Id; deterministic for the same change; webhook.test events get a random ID
typestringYesEvent type; value in "department.created" | "department.updated"; webhook.test cannot be subscribed to
apiVersionstringYesAPI version of the data shape; value in "2"
createdAtstringYesISO 8601 timestamp of when the event was created; format date-time
companyIdstringYesID of the company
dataobjectYesAffected resource; same shape as GET /v2/departments/{id} without parent and approvers; contains id, name, isDefault, createdAt, and additional string-keyed fields
apiClientobjectNoAPI key that made the change; present only when the change was made through the API; contains keyId, optional name, ownerId

data fields: id (department ID), name (department name), isDefault (boolean, whether this is the company's default department), createdAt (ISO 8601 timestamp).

Frequently asked questions

Which scope does the webhook owner need for department.created?

The webhook owner needs the departments:read scope.

How do I avoid processing the same department.created event twice?

Use VT-Event-Id, which matches the body id. The id is deterministic for the same change, so the same change always produces the same ID. Skip a delivery if that ID has already been processed.

What is the difference between VT-Delivery-Id and VT-Delivery-Attempt?

VT-Delivery-Id is unique per delivery and stays the same across retries of the same delivery. VT-Delivery-Attempt is the attempt number of that delivery, starting at 1.

Why is apiClient missing from some payloads?

apiClient is present only when the change was made through the API. If the change came from another source, the field is absent.

What happens to VT-Signature after a secret rotation?

During a secret rotation, VT-Signature can include a second v1 entry computed with the previous secret. That dual-entry form is expected to remain available for 24 hours after the rotation, so a receiver can accept a delivery when either the current or the previous secret produces a matching HMAC. Treat the exact window as a configurable operational setting (currently represented by the placeholder for the owner's rotation window) rather than a fixed guarantee until the owner confirms it.

Where do I send questions about this event?

Questions about this webhook event can be directed to the owner's support contact (represented by the owner's support contact placeholder).

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