Skip to content

Update an organization webhook

PATCH
/orgs/{org}/hooks/{hook_id}

Updates a webhook configured in an organization. When you update a webhook, the secret will be overwritten. 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 an organization”.

You must be an organization owner to use this endpoint.

OAuth app tokens and personal access tokens (classic) need admin:org_hook scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps.

API method documentation

org
required
string

The organization name. The name is not case sensitive.

hook_id
required
integer

The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.

Media type application/json
object
config

Key/value pairs to provide settings for this webhook.

object
url
required

The URL to which the payloads will be delivered.

string format: uri
content_type

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

string
secret

If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.

string
insecure_ssl
One of:

Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.

string
events

Determines what events the hook is triggered for.

Array<string>
default: push
active

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

boolean
default: true
name
string
Examples
Example default
{
"active": true,
"events": [
"pull_request"
]
}

Response

Media type application/json
Org Hook

Org Hook

object
id
required
integer
url
required
string format: uri
ping_url
required
string format: uri
deliveries_url
string format: uri
name
required
string
events
required
Array<string>
active
required
boolean
config
required
object
url
string
insecure_ssl
string
content_type
string
secret
string
updated_at
required
string format: date-time
created_at
required
string format: date-time
type
required
string
Examples
Example default
{
"id": 1,
"url": "https://api.github.com/orgs/octocat/hooks/1",
"ping_url": "https://api.github.com/orgs/octocat/hooks/1/pings",
"deliveries_url": "https://api.github.com/repos/octocat/Hello-World/hooks/12345678/deliveries",
"name": "web",
"events": [
"pull_request"
],
"active": true,
"config": {
"url": "http://example.com",
"content_type": "json"
},
"updated_at": "2011-09-06T20:39:23Z",
"created_at": "2011-09-06T17:26:27Z",
"type": "Organization"
}

Resource not found

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Validation failed, or the endpoint has been spammed.

Media type application/json
Validation Error

Validation Error

object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
nullable
Example generated
{
"message": "example",
"documentation_url": "example",
"errors": [
{
"resource": "example",
"field": "example",
"message": "example",
"code": "example",
"index": 1,
"value": [
"example"
]
}
]
}