v50

latestOpenAPI 3.0.3MITraw.githubusercontent.com2023-07-147873273.9 MB
repos

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/repos/{owner}/{repo}/hooks

Path parameters

ownerstring required

The account owner of the repository. The name is not case sensitive.

repostring required

The name of the repository without the .git extension. The name is not case sensitive.

Request body

namestring

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

eventsstring[]

Determines what events the hook is triggered for.

activeboolean

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

Example request

{
  "config": {
    "url": "https://example.com/webhook",
    "content_type": "\"json\"",
    "secret": "\"********\"",
    "insecure_ssl": "\"0\"",
    "token": "\"abc\"",
    "digest": "\"sha256\""
  }
}

Response

Response

typestring required
idinteger required

Unique identifier of the webhook.

namestring required

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

activeboolean required

Determines whether the hook is actually triggered on pushes.

eventsstring[] required

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

updated_atstring date-time required
created_atstring date-time required
urlstring uri required
test_urlstring uri required
ping_urlstring uri required
deliveries_urlstring uri

Example response

{
  "id": 42,
  "name": "web",
  "active": true,
  "events": [
    "push",
    "pull_request"
  ],
  "config": {
    "email": "\"foo@bar.com\"",
    "password": "\"foo\"",
    "room": "\"roomer\"",
    "subdomain": "\"foo\"",
    "url": "https://example.com/webhook",
    "insecure_ssl": "\"0\"",
    "content_type": "\"json\"",
    "digest": "\"sha256\"",
    "secret": "\"********\"",
    "token": "\"abc\""
  },
  "updated_at": "2011-09-06T20:39:23Z",
  "created_at": "2011-09-06T17:26:27Z",
  "url": "https://api.github.com/repos/octocat/Hello-World/hooks/1",
  "test_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/test",
  "ping_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings",
  "deliveries_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/deliveries"
}