GitHub v3 REST API

Create a repository webhook

Repositories can have multiple webhooks installed. Each webhook should have a unique config. Multiple webhooks can
share the same config as long as those webhooks do not have any events that overlap.

post
http://HOSTNAME/api/v3/repos/{owner}/{repo}/hooks

Path Parameters

ownerstringrequired
repostringrequired

Body

application/json
* Additional properties are NOT allowed.
namestring

Use web to create a webhook. Default: web. This parameter only accepts the value web.

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

Response

application/json

Response

Webhook

Webhooks for repositories.

typestringrequired
idintegerrequired

Unique identifier of the webhook.

Example:42

namestringrequired

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

Example:web

activebooleanrequired

Determines whether the hook is actually triggered on pushes.

Example:true

eventsarray[string]required

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

Example:["push","pull_request"]

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

urlstring(uri)required

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

test_urlstring(uri)required

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

ping_urlstring(uri)required

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

last_responseobjectrequired
Show Child Parameters
post/repos/{owner}/{repo}/hooks

Body

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

Get a repository webhook

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

get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/hooks/{hook_id}

Path Parameters

ownerstringrequired
repostringrequired
hook_idintegerrequired

Response

application/json

Response

Webhook

Webhooks for repositories.

typestringrequired
idintegerrequired

Unique identifier of the webhook.

Example:42

namestringrequired

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

Example:web

activebooleanrequired

Determines whether the hook is actually triggered on pushes.

Example:true

eventsarray[string]required

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

Example:["push","pull_request"]

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

urlstring(uri)required

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

test_urlstring(uri)required

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

ping_urlstring(uri)required

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

last_responseobjectrequired
Show Child Parameters
get/repos/{owner}/{repo}/hooks/{hook_id}
 
application/json

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

patch
http://HOSTNAME/api/v3/repos/{owner}/{repo}/hooks/{hook_id}

Path Parameters

ownerstringrequired
repostringrequired
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. This replaces the entire array of events.

Default:push

add_eventsarray[string]

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

remove_eventsarray[string]

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

activeboolean

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

Default:true

Response

application/json

Response

Webhook

Webhooks for repositories.

typestringrequired
idintegerrequired

Unique identifier of the webhook.

Example:42

namestringrequired

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

Example:web

activebooleanrequired

Determines whether the hook is actually triggered on pushes.

Example:true

eventsarray[string]required

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

Example:["push","pull_request"]

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

urlstring(uri)required

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

test_urlstring(uri)required

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

ping_urlstring(uri)required

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

last_responseobjectrequired
Show Child Parameters
patch/repos/{owner}/{repo}/hooks/{hook_id}

Body

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

Delete a repository webhook

delete
http://HOSTNAME/api/v3/repos/{owner}/{repo}/hooks/{hook_id}

Path Parameters

ownerstringrequired
repostringrequired
hook_idintegerrequired

Response

Response

delete/repos/{owner}/{repo}/hooks/{hook_id}
 

Get a webhook configuration for a repository

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

Access tokens must have the read:repo_hook or repo scope, and GitHub Apps must have the repository_hooks:read permission.

get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/hooks/{hook_id}/config

Path Parameters

ownerstringrequired
repostringrequired
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/repos/{owner}/{repo}/hooks/{hook_id}/config
 
200 application/json