This version of GitHub Enterprise was discontinued on 2023-07-06. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.
Organization webhooks
Use the REST API to interact with webhooks in an organization.
About organization webhooks
Organization webhooks allow you to receive HTTP POST payloads whenever certain events happen in an organization. For more information, see "About webhooks."
Scopes and restrictions
All actions against organization webhooks require the authenticated user to be an admin of the organization being managed. Additionally, OAuth tokens require the admin:org_hook scope. For more information, see "Scopes for OAuth apps."
In order to protect sensitive data which may be present in webhook configurations, we also enforce the following access control rules:
- OAuth apps cannot list, view, or edit webhooks which they did not create.
- Users cannot list, view, or edit webhooks which were created by OAuth apps.
Receiving Webhooks
In order for GitHub Enterprise Server to send webhook payloads, your server needs to be accessible from the Internet. We also highly suggest using SSL so that we can send encrypted payloads over HTTPS.
For more best practices, see our guide.
Webhook headers
GitHub Enterprise Server will send along several HTTP headers to differentiate between event types and payload identifiers. See webhook headers for details.
List organization webhooks
Parameters for "List organization webhooks"
| Headers |
|---|
| Name, Type, Description |
accept string Setting to |
| Path parameters |
| Name, Type, Description |
org string RequiredThe organization name. The name is not case sensitive. |
| Query parameters |
| Name, Type, Description |
per_page integer The number of results per page (max 100). Default: |
page integer Page number of the results to fetch. Default: |
HTTP response status codes for "List organization webhooks"
| Status code | Description |
|---|---|
200 | OK |
404 | Resource not found |
Code samples for "List organization webhooks"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/orgs/ORG/hooksResponse
Status: 200[
{
"id": 1,
"url": "https://HOSTNAME/orgs/octocat/hooks/1",
"ping_url": "https://HOSTNAME/orgs/octocat/hooks/1/pings",
"deliveries_url": "https://HOSTNAME/orgs/octocat/hooks/1/deliveries",
"name": "web",
"events": [
"push",
"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"
}
]Create an organization webhook
Here's how you can create a hook that posts payloads in JSON format:
Parameters for "Create an organization webhook"
| Headers | |||||||
|---|---|---|---|---|---|---|---|
| Name, Type, Description | |||||||
accept string Setting to | |||||||
| Path parameters | |||||||
| Name, Type, Description | |||||||
org string RequiredThe organization name. The name is not case sensitive. | |||||||
| Body parameters | |||||||
| Name, Type, Description | |||||||
name string RequiredMust be passed as "web". | |||||||
config object RequiredKey/value pairs to provide settings for this webhook. These are defined below. | |||||||
Properties of |
| Name, Type, Description |
|---|
url string RequiredThe URL to which the payloads will be delivered. |
content_type string The media type used to serialize the payloads. Supported values include |
secret string If provided, the |
insecure_ssl string or number Determines whether the SSL certificate of the host for |
username string |
password string |