# Create a global webhook

From **GitHub v3 REST API**.

`POST /admin/hooks`

Create a global webhook

## Parameters

### `accept`

- Location: header
- Required: true
- Type: `string`
- Default: `application/vnd.github.superpro-preview+json`

This API is under preview and subject to change.

## Request body

- Required: true
### `application/json`

- Type: `object`

```json
{
  "config": {
    "content_type": "json",
    "secret": "secret",
    "url": "https://example.com/webhook"
  },
  "events": [
    "organization",
    "user"
  ],
  "name": "web"
}
```

```json
{"properties":{"active":{"default":true,"description":"Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications.","type":"boolean"},"config":{"description":"Key/value pairs to provide settings for this webhook.","properties":{"content_type":{"description":"The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`.","type":"string"},"insecure_ssl":{"description":"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.**","type":"string"},"secret":{"description":"If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value in the [`X-Hub-Signature`](https://docs.github.com/enterprise-server@3.0/webhooks/event-payloads/#delivery-headers) header.","type":"string"},"url":{"description":"The URL to which the payloads will be delivered.","type":"string"}},"required":["url"],"type":"object"},"events":{"description":"The [events](https://docs.github.com/enterprise-server@3.0/webhooks/event-payloads) that trigger this webhook. A global webhook can be triggered by `user` and `organization` events. Default: `user` and `organization`.","items":{"type":"string"},"type":"array"},"name":{"description":"Must be passed as \"web\".","type":"string"}},"required":["name","config"],"type":"object"}
```

## Responses

### `201`

Response

### `application/json`

- Type: `object`

```json
{
  "active": true,
  "config": {
    "content_type": "json",
    "insecure_ssl": "0",
    "secret": "********",
    "url": "https://example.com"
  },
  "created_at": "2017-12-07T00:14:59Z",
  "events": [
    "organization",
    "user"
  ],
  "id": 1,
  "name": "web",
  "ping_url": "https://api.github.com/admin/hooks/1/pings",
  "type": "Global",
  "updated_at": "2017-12-07T00:14:59Z",
  "url": "https://api.github.com/admin/hooks/1"
}
```

```json
{"properties":{"active":{"type":"boolean"},"config":{"properties":{"content_type":{"type":"string"},"insecure_ssl":{"type":"string"},"secret":{"type":"string"},"url":{"type":"string"}},"type":"object"},"created_at":{"type":"string"},"events":{"items":{"type":"string"},"type":"array"},"id":{"type":"integer"},"name":{"type":"string"},"ping_url":{"type":"string"},"type":{"type":"string"},"updated_at":{"type":"string"},"url":{"type":"string"}},"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url {protocol}://{hostname}/api/v3/admin/hooks \
  --header 'content-type: application/json' \
  --data '{
  "config": {
    "content_type": "json",
    "secret": "secret",
    "url": "https://example.com/webhook"
  },
  "events": [
    "organization",
    "user"
  ],
  "name": "web"
}'
```
