GitHub v3 REST API

List repository webhooks

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

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired

Response

application/json

Response

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
 
application/json

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}