Skip to main content

Update a repository webhook

Updates a webhook configured in a repository. If you previously had a `secret` set, you must provide the same `secret` or set a new `secret` or the secret will be removed. If you are only updating individual webhook `config` properties, use "[Update a webhook configuration for a repository](/rest/reference/repos#update-a-webhook-configuration-for-a-repository)."

PATCH/repos/{owner}/{repo}/hooks/{hook_id}
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Path Parameters
owner string
required
repo string
required
hook_id integer
required
Body Params
required
application/jsonobject
active boolean
optional

Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications.

add_events array[string]
optional

Determines a list of events to be added to the list of events that the Hook triggers for.

config object
optional

Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/[email protected]/rest/reference/repos#create-hook-config-params).

address string
optional

Example: "[email protected]"

content_type webhook-config-content-type string
optional

The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`.

Example: "json"

insecure_ssl webhook-config-insecure-ssl
optional
room string
optional

Example: "The Serious Room"

secret webhook-config-secret string
optional

If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/[email protected]/webhooks/event-payloads/#delivery-headers).

Example: "********"

url webhook-config-url string<uri>
required

The URL to which the payloads will be delivered.

Example: https://example.com/webhook

events array[string]
optional

Determines what [events](https://docs.github.com/[email protected]/webhooks/event-payloads) the hook is triggered for. This replaces the entire array of events.

remove_events array[string]
optional

Determines a list of events to be removed from the list of events that the Hook triggers for.

Responses

application/json Webhook object

Response

active boolean
required

Determines whether the hook is actually triggered on pushes.

Example: true

config object
required
content_type webhook-config-content-type string
optional

The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`.

Example: "json"

digest string
optional

Example: "sha256"

email string
optional

Example: "[email protected]"

insecure_ssl webhook-config-insecure-ssl
optional
password string
optional

Example: "foo"

room string
optional

Example: "roomer"

secret webhook-config-secret string
optional

If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/[email protected]/webhooks/event-payloads/#delivery-headers).

Example: "********"

subdomain string
optional

Example: "foo"

token string
optional

Example: "abc"

url webhook-config-url string<uri>
optional

The URL to which the payloads will be delivered.

Example: https://example.com/webhook

created_at string<date-time>
required

Example: 2011-09-06T17:26:27Z

events array[string]
required

Determines what events the hook is triggered for. Default: ['push'].

Example:
[
  "push",
  "pull_request"
]
id integer
required

Unique identifier of the webhook.

Example: 42

last_response Hook Response object
required
code integer
requirednullable
message string
requirednullable
status string
requirednullable
name string
required

The name of a valid service, use 'web' for a webhook.

Example: web

ping_url string<uri>
required

Example: https://api.github.com/repos/octocat/Hello-World/hooks/1/pings

test_url string<uri>
required

Example: https://api.github.com/repos/octocat/Hello-World/hooks/1/test

type string
required
updated_at string<date-time>
required

Example: 2011-09-06T20:39:23Z

url string<uri>
required

Example: https://api.github.com/repos/octocat/Hello-World/hooks/1

application/json Basic Error object

Resource not found

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json Validation Error object

Validation failed

documentation_url string
required
errors array[object]
optional
items object
code string
required
field string
optional
index integer
optional
message string
optional
resource string
optional
value
optional
message string
required