Skip to content

Update a webhook

A webhook's destination URL, subscribed event list and description can be changed after creation. This method sends a partial update: you include only the fields you want to change, and any field you omit keeps its current value. The response returns the updated webhook object with a 200 status.

Method, route and authorization

The operation is a PATCH request to /v2/webhooks/{id}. The path parameter id is a required string containing the webhook ID. The request must carry a bearer token and the webhooks:write scope. The API key is sent as Authorization: Bearer vt_live_<secret>. How keys are created, which scopes exist and how the key owner's role limits them are covered in the Authentication and Scopes sections of the developer documentation.

Request body fields

The body is application/json and must contain at least one of the three optional fields. Sending an empty body is not a valid update. The field rules are:

Field map

Use this map to decide what to send and what to expect back.

Events are replaced, not merged

When events is included, it replaces the entire event list. The same URL and event checks applied at creation apply here. If you want to add one event to an existing subscription, read the current list first, append the new event and send the complete list back. The event type webhook.test is sent only by test deliveries and cannot be subscribed to.

Status changes and ignored headers

Status cannot be changed through this method. Use POST /v2/webhooks/{id}/pause and POST /v2/webhooks/{id}/resume for that. The Idempotency-Key and X-On-Behalf-Of headers are ignored on this request.

Example: replacing the event list

The captured example sends a PATCH to a webhook ID with a body containing three events: leave.approved, leave.cancelled and leave.deleted. The response returns the webhook object with its current url, description, events, status, ownerId, secretPrefix, lastDelivery and timestamps. The signing secret itself is never returned here.

Error codes and what they mean

The method can return the following errors. The distinction matters: a 400 means the request content is wrong, a 403 means the key or owner lacks permission, a 404 means the ID does not match a webhook, and a 409 means the webhook is revoked and cannot be changed.

Decision checklist before sending

  1. Confirm the key has webhooks:write. 2. Decide whether you are changing url, events, description or a combination. 3. If changing events, build the full replacement list rather than a single addition. 4. If changing url, confirm it is HTTPS. 5. If changing description, keep it at or under 200 characters. 6. If the webhook is paused and you want it active, use the resume endpoint, not this PATCH. 7. If the webhook is revoked, delete it and create a new one instead of updating.
Request body field map
FieldRequiredType / formatRuleError on violation
urlNostring, uriMust be an HTTPS URL400 WEBHOOK_URL_INVALID
eventsNoarray<WebhookEventType>, min 1 itemFull replacement list; same checks as create400 WEBHOOK_EVENTS_INVALID or 403 WEBHOOK_EVENTS_NOT_ALLOWED
descriptionNostring, max 200 charactersMay be empty400 VALIDATION_ERROR

At least one of these fields must be present in the request body.

Error responses
StatusCodeMeaning
400VALIDATION_ERRORA body field failed validation; details.fields lists the problems
400INVALID_REQUEST_BODYThe request body could not be parsed or is structurally invalid
400WEBHOOK_URL_INVALIDThe url is not an HTTPS URL
400WEBHOOK_EVENTS_INVALIDThe events list failed the same checks as on create
403WEBHOOK_EVENTS_NOT_ALLOWEDThe key owner is not allowed to subscribe to one or more of the requested events
403FORBIDDENThe key owner no longer exists
404WEBHOOK_NOT_FOUNDNo webhook matches the supplied id
409WEBHOOK_REVOKEDThe webhook is revoked and cannot be changed

The 401 and 429 responses are shared across the API and are not specific to this method.

Frequently asked questions

Can I set a non-HTTPS URL?

No. The url field must be an HTTPS URL. Any other URL fails with 400 WEBHOOK_URL_INVALID.

Does sending events add to the existing list or replace it?

It replaces the full list. To add one event, read the current list, append the new event and send the complete list back.

Can I pause or resume a webhook through this method?

No. Status cannot be sent here. Use POST /v2/webhooks/{id}/pause and POST /v2/webhooks/{id}/resume.

What if the webhook is revoked?

A revoked webhook cannot be changed. The method returns 409 WEBHOOK_REVOKED. Delete the webhook and create a new one.

Is the Idempotency-Key header honored?

No. The Idempotency-Key and X-On-Behalf-Of headers are ignored on this request.

curl -X PATCH "$API_BASE_URL/v2/webhooks/wh_3f1c2b9e-8a47-4d5e-9c61-2b7f0e4a1d93" \
  -H "Authorization: Bearer " \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      "leave.approved",
      "leave.cancelled",
      "leave.deleted"
    ]
  }'
{
  "data": {
    "webhookId": "wh_3f1c2b9e-8a47-4d5e-9c61-2b7f0e4a1d93",
    "url": "https://example.com/vacation-tracker/webhooks",
    "description": "Example post details.",
    "events": [
      "leave.approved",
      "leave.cancelled"
    ],
    "status": "active",
    "pausedReason": null,
    "pausedAt": null,
    "revokedAt": null,
    "revocationReason": null,
    "ownerId": "user-63b17e97-d38b-4586-8498-bb4f5d2e2c14",
    "secretPrefix": "whsec_AbCd",
    "lastDelivery": {
      "deliveryId": "dlv_1790157600000_8a47c61e2b7f4d5e9c613f1c2b9e1d93",
      "eventName": "leave.approved",
      "status": "SUCCEEDED",
      "responseStatus": 200,
      "at": "2026-09-23T10:00:00.000Z"
    },
    "createdAt": "2026-09-01T08:00:00.000Z",
    "updatedAt": "2026-09-23T10:00:00.000Z"
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "name": "ValidationError",
    "description": "Example post details.",
    "resolution": "Fix the fields listed in details.fields and send the request again.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
    "details": {
      "fields": [
        {
          "path": "startDate",
          "message": "\"startDate\" is required"
        }
      ]
    }
  }
}
{
  "error": {
    "code": "UNAUTHORIZED",
    "name": "Unauthorized",
    "description": "Example post details.",
    "resolution": "Send a valid API key in the Authorization header as Bearer followed by the full vt_live_ key.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
  }
}
{
  "error": {
    "code": "INSUFFICIENT_SCOPE",
    "name": "InsufficientScope",
    "description": "Example post details.",
    "resolution": "Add the scopes listed in details.requiredScopes to the key in the OnlyLeave dashboard.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
    "details": {
      "requiredScopes": [
        "leaves:write"
      ]
    }
  }
}
{
  "error": {
    "code": "WEBHOOK_NOT_FOUND",
    "name": "Webhook not found",
    "description": "Example post details.",
    "resolution": "Check the webhook ID.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
  }
}
{
  "error": {
    "code": "WEBHOOK_REVOKED",
    "name": "Webhook revoked",
    "description": "Example post details.",
    "resolution": "Delete the webhook and create a new one.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
  }
}
{
  "error": {
    "code": "RATE_LIMITED",
    "name": "RateLimited",
    "description": "Example post details.",
    "resolution": "Wait a few seconds and retry, using the same Idempotency-Key for writes.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
  }
}
{
  "error": {
    "code": "INTERNAL_ERROR",
    "name": "InternalError",
    "description": "Example post details.",
    "resolution": "Retry later, and if it keeps happening, contact OnlyLeave support and quote the requestId.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
  }
}

id

FieldTypeRequiredDescriptionConstraints
idstringYeswebhook ID.

body

FieldTypeRequiredDescriptionConstraints
bodyobjectYes1 <= properties
body.urlstringNoan HTTPS URL. Other URLs fail with 400 WEBHOOK_URL_INVALID.Format: uri
body.eventsarray<WebhookEventType>Nothe full replacement list of event types. The same checks as on create apply.1 <= items
body.events[]stringthe event type. webhook.test is sent only by test deliveries and cannot be subscribed to.Allowed values: $4d
body.descriptionstringNoa description to help you recognize the webhook, up to 200 characters; may be emptylength <= 200

response

FieldTypeRequiredDescriptionConstraints
responseobject
response.dataobjectNo
response.data.webhookIdstringYeswebhook ID
response.data.urlstringYesthe HTTPS URL deliveries are sent toFormat: uri
response.data.descriptionstring | nullNoa description to help you recognize the webhook
response.data.description[variant1]stringa description to help you recognize the webhook
response.data.description[variant2]nulla description to help you recognize the webhook
response.data.eventsarray<WebhookEventType>Yesthe event types sent to this webhook
response.data.events[]stringthe event type. webhook.test is sent only by test deliveries and cannot be subscribed to.Allowed values: $7d
response.data.statusstringYesactive webhooks receive events; paused and revoked webhooks do notAllowed values: "active" | "paused" | "revoked"
response.data.pausedReasonstring | nullNowhy the webhook is paused. manual means it was paused with the API or the dashboard, delivery-failures means every delivery failed for 72 hours, endpoint-gone means your endpoint returned 410.Allowed values: "manual" | "delivery-failures" | "endpoint-gone" | null
response.data.pausedReason[variant1]stringwhy the webhook is paused. manual means it was paused with the API or the dashboard, delivery-failures means every delivery failed for 72 hours, endpoint-gone means your endpoint returned 410.Allowed values: "manual" | "delivery-failures" | "endpoint-gone" | null
response.data.pausedReason[variant2]nullwhy the webhook is paused. manual means it was paused with the API or the dashboard, delivery-failures means every delivery failed for 72 hours, endpoint-gone means your endpoint returned 410."manual" | "delivery-failures" | "endpoint-gone" | null
response.data.pausedAtstring | nullNoa timestamp in the ISO 8601 format, set while the webhook is pauseddate-time
response.data.pausedAt[variant1]stringa timestamp in the ISO 8601 format, set while the webhook is pauseddate-time
response.data.pausedAt[variant2]nulla timestamp in the ISO 8601 format, set while the webhook is pauseddate-time
response.data.revokedAtstring | nullNoa timestamp in the ISO 8601 format, set when the webhook is revokeddate-time
response.data.revokedAt[variant1]stringa timestamp in the ISO 8601 format, set when the webhook is revokeddate-time
response.data.revokedAt[variant2]nulla timestamp in the ISO 8601 format, set when the webhook is revokeddate-time
response.data.revocationReasonstring | nullNowhy the webhook was revoked"manual" | "owner_permissions_reduced" | "owner_deactivated" | "owner_deleted" | null
response.data.revocationReason[variant1]stringwhy the webhook was revoked"manual" | "owner_permissions_reduced" | "owner_deactivated" | "owner_deleted" | null
response.data.revocationReason[variant2]nullwhy the webhook was revoked"manual" | "owner_permissions_reduced" | "owner_deactivated" | "owner_deleted" | null
response.data.ownerIdstringYesthe ID of the user who owns the webhook. Events are filtered by this user's current permissions.
response.data.secretPrefixstringYesthe first 10 characters of the signing secret, to help you tell secrets apart
response.data.lastDeliveryWebhookLastDelivery | nullNothe most recent delivery, null before the first delivery
response.data.lastDelivery[variant1]objectthe most recent delivery, null before the first delivery
response.data.lastDelivery[variant1].deliveryIdstringYesdelivery ID, the same as the VT-Delivery-Id header
response.data.lastDelivery[variant1].eventNamestringYesthe event type. webhook.test is sent only by test deliveries and cannot be subscribed to.Allowed values: $7d
response.data.lastDelivery[variant1].statusstringYesdelivery status. SKIPPED means the webhook was paused, revoked or deleted before the delivery was sent."PENDING" | "RETRYING" | "SUCCEEDED" | "FAILED" | "SKIPPED"
response.data.lastDelivery[variant1].responseStatusintegerNothe HTTP status your endpoint returned on the latest attempt, absent when no response was received
response.data.lastDelivery[variant1].atstringYesa timestamp in the ISO 8601 format of the latest attemptdate-time
response.data.lastDelivery[variant2]nullthe most recent delivery, null before the first delivery
response.data.createdAtstringYesa timestamp in the ISO 8601 formatdate-time
response.data.updatedAtstringYesa timestamp in the ISO 8601 formatdate-time

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo

response

FieldTypeRequiredDescriptionConstraints
responseobjectError envelope returned by every endpoint, including authentication and rate limit errors. error.code is one of the codes in x-error-catalog .
response.errorobjectYes
response.error.codestringYesstable machine-readable error code
response.error.namestringYesshort human-readable error name
response.error.descriptionstringYeswhat went wrong
response.error.resolutionstringYeshow to fix the problem
response.error.requestIdstringYesrequest ID, include it when contacting support
response.error.detailsobjectNooptional additional information specific to the error code
response.error.details.[key: string]anyNo