GitHub v3 REST API

Create an organization webhook

Here’s how you can create a hook that posts payloads in JSON format:

post
{protocol}://{hostname}/api/v3/orgs/{org}/hooks

Path Parameters

orgstringrequired

Body

application/json
namestringrequired

Must be passed as “web”.

configobjectrequired

Key/value pairs to provide settings for this webhook. These are defined below.

Show Child Parameters
eventsarray[string]

Determines what events the hook is triggered for.

Default:push

activeboolean

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

Default:true

Response

application/json

Response

Org Hook

Org Hook

idintegerrequired

Example:1

urlstring(uri)required

Example:https://api.github.com/orgs/octocat/hooks/1

ping_urlstring(uri)required

Example:https://api.github.com/orgs/octocat/hooks/1/pings

namestringrequired

Example:web

eventsarray[string]required

Example:["push","pull_request"]

activebooleanrequired

Example:true

configobjectrequired
Show Child Parameters
updated_atstring(date-time)required

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

created_atstring(date-time)required

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

typestringrequired
post/orgs/{org}/hooks

Body

{ "name": "web", "active": true, "events": [ "push", "pull_request" ], "config": { "url": "http://example.com/webhook", "content_type": "json" } }
 
application/json

Get an organization webhook

Returns a webhook configured in an organization. To get only the webhook config properties, see “Get a webhook configuration for an organization.”

get
{protocol}://{hostname}/api/v3/orgs/{org}/hooks/{hook_id}

Path Parameters

orgstringrequired
hook_idintegerrequired

Response

application/json

Response

Org Hook

Org Hook

idintegerrequired

Example:1

urlstring(uri)required

Example:https://api.github.com/orgs/octocat/hooks/1

ping_urlstring(uri)required

Example:https://api.github.com/orgs/octocat/hooks/1/pings

namestringrequired

Example:web

eventsarray[string]required

Example:["push","pull_request"]

activebooleanrequired

Example:true

configobjectrequired
Show Child Parameters
updated_atstring(date-time)required

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

created_atstring(date-time)required

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

typestringrequired
get/orgs/{org}/hooks/{hook_id}
 
application/json

Update an organization webhook

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.”

patch
{protocol}://{hostname}/api/v3/orgs/{org}/hooks/{hook_id}

Path Parameters

orgstringrequired
hook_idintegerrequired

Body

application/json
configobject

Key/value pairs to provide settings for this webhook. These are defined below.

Show Child Parameters
eventsarray[string]

Determines what events the hook is triggered for.

Default:push

activeboolean

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

Default:true

namestring

Example:"web"

Response

application/json

Response

Org Hook

Org Hook

idintegerrequired

Example:1

urlstring(uri)required

Example:https://api.github.com/orgs/octocat/hooks/1

ping_urlstring(uri)required

Example:https://api.github.com/orgs/octocat/hooks/1/pings

namestringrequired

Example:web

eventsarray[string]required

Example:["push","pull_request"]

activebooleanrequired

Example:true

configobjectrequired
Show Child Parameters
updated_atstring(date-time)required

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

created_atstring(date-time)required

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

typestringrequired
patch/orgs/{org}/hooks/{hook_id}

Body

{ "active": true, "events": [ "pull_request" ] }
 
application/json

Delete an organization webhook

delete
{protocol}://{hostname}/api/v3/orgs/{org}/hooks/{hook_id}

Path Parameters

orgstringrequired
hook_idintegerrequired

Response

Response

delete/orgs/{org}/hooks/{hook_id}
 

Get a webhook configuration for an organization

Returns the webhook configuration for an organization. To get more information about the webhook, including the active state and events, use “Get an organization webhook .”

Access tokens must have the admin:org_hook scope, and GitHub Apps must have the organization_hooks:read permission.

get
{protocol}://{hostname}/api/v3/orgs/{org}/hooks/{hook_id}/config

Path Parameters

orgstringrequired
hook_idintegerrequired

Response

200 application/json

Response

Webhook Configuration

Configuration object of the webhook

urlstring(uri)

The URL to which the payloads will be delivered.

Example:https://example.com/webhook

content_typestring

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

Example:"json"

secretstring

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

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

insecure_sslOne Of
Variant 1string

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.

Example:"0"

get/orgs/{org}/hooks/{hook_id}/config
 
200 application/json