Sample - GitHub REST API
PATCH/orgs/{org}/hooks/{hook_id}

Update an organization webhook

Updates a webhook configured in an organization. Supply the webhook fields you want to change, and include config.url whenever config is provided because the URL is required within that object. Updating the webhook overwrites its secret; provide the existing secret to retain it or provide a new secret to replace it.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters · 4 body fields
orgstringrequired
The organization name. The value is not case-sensitive.
hook_idintegerrequired
The unique numeric identifier of the webhook, available in the `X-GitHub-Hook-ID` header of a webhook delivery.

Webhook update fields. All top-level fields are optional, but config.url is required when config is supplied.

configobjectoptional
Key/value pairs to provide settings for this webhook.
eventsarray<string>optional
Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for.
Default:["push"]
activebooleanoptional
Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications.
Default:true
namestringoptional
The webhook name.

3 status codes
200Returns the updated organization webhook, including its identifier, delivery URLs, name, subscribed events, active state, configuration, timestamps, and type.
idintegerrequired
urlstringrequired
ping_urlstringrequired
deliveries_urlstringoptional
namestringrequired
eventsarray<string>required
activebooleanrequired
configobjectrequired
updated_atstringrequired
created_atstringrequired
typestringrequired
404Returned when the specified organization webhook does not exist.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when the request fails validation or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 404 is returned when the organization webhook identified by hook_id cannot be found. A 422 is returned when the payload fails validation or the endpoint has been spammed. If you provide config, its url must be a valid URI; content_type supports json and form, and events defaults to push while active defaults to true when omitted.