# Конечные точки REST API для глобальных веб-перехватчиков

Используйте REST API для управления глобальными веб-перехватчиками для вашего предприятия.

## Сведения о глобальных веб-перехватчиках

Эти конечные точки доступны [только администраторам сайта, прошедшим](/ru/enterprise-server@3.22/rest/authentication/authenticating-to-the-rest-api) проверку подлинности, обычные пользователи получат `404` ответ. Сведения о настройке глобальных веб-перехватчиков см. в разделе [Сведения о глобальных веб-перехватчиках](/ru/enterprise-server@3.22/admin/monitoring-activity-in-your-enterprise/exploring-user-activity-in-your-enterprise/managing-global-webhooks).

Глобальные веб-перехватчики автоматически устанавливаются в вашей организации. Глобальные веб-перехватчики можно использовать для автоматического мониторинга, реагирования или применения правил для пользователей, организаций, команд и репозиториев на предприятии.

Глобальные веб-перехватчики могут подписаться на такие типы событий, как [организация](/ru/enterprise-server@3.22/webhooks/webhook-events-and-payloads#organization), [пользователь](/ru/enterprise-server@3.22/webhooks/webhook-events-and-payloads#user), [репозиторий](/ru/enterprise-server@3.22/webhooks/webhook-events-and-payloads#repository), [команда](/ru/enterprise-server@3.22/webhooks/webhook-events-and-payloads#team), [член](/ru/enterprise-server@3.22/webhooks/webhook-events-and-payloads#member), [членство](/ru/enterprise-server@3.22/webhooks/webhook-events-and-payloads#membership), [вилка](/ru/enterprise-server@3.22/webhooks/webhook-events-and-payloads#fork) и [проверка связи](/ru/enterprise-server@3.22/webhooks/about-webhooks#ping-event).

> \[!NOTE]
> Эти конечные точки поддерживают проверку подлинности только с помощью personal access token (classic). Дополнительные сведения см. в разделе [Управление личными маркерами доступа](/ru/enterprise-server@3.22/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic).

> \[!NOTE]
> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.

## List global webhooks

```
GET /admin/hooks
```

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`per_page`** (integer)
  The number of results per page (max 100). For more information, see "Using pagination in the REST API."
  Default: `30`

* **`page`** (integer)
  The page number of the results to fetch. For more information, see "Using pagination in the REST API."
  Default: `1`

### HTTP response status codes

* **200** - OK

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/admin/hooks
```

**Response schema (Status: 200):**

Array of objects:

* `type`: string
* `id`: integer
* `name`: string
* `active`: boolean
* `events`: array of string
* `config`: object:
  * `url`: string
  * `content_type`: string
  * `insecure_ssl`: string
  * `secret`: string
* `updated_at`: string
* `created_at`: string
* `url`: string
* `ping_url`: string

## Create a global webhook

```
POST /admin/hooks
```

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Body parameters

* **`name`** (string) (required)
  Must be passed as "web".

* **`config`** (object) (required)
  Key/value pairs to provide settings for this webhook.
  * **`url`** (string) (required)
    The URL to which the payloads will be delivered.
  * **`content_type`** (string)
    The media type used to serialize the payloads. Supported values include json and form. The default is form.
  * **`secret`** (string)
    If provided, the secret will be used as the key to generate the HMAC hex digest value in the X-Hub-Signature header.
  * **`insecure_ssl`** (string)
    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.

* **`events`** (array of strings)
  The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.

* **`active`** (boolean)
  Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.
  Default: `true`

### HTTP response status codes

* **201** - Created

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X POST \
  http(s)://HOSTNAME/api/v3/admin/hooks \
  -d '{
  "name": "web",
  "events": [
    "organization",
    "user"
  ],
  "config": {
    "url": "https://example.com/webhook",
    "content_type": "json",
    "secret": "secret"
  }
}'
```

**Response schema (Status: 201):**

* `type`: string
* `id`: integer
* `name`: string
* `active`: boolean
* `events`: array of string
* `config`: object:
  * `url`: string
  * `content_type`: string
  * `insecure_ssl`: string
  * `secret`: string
* `updated_at`: string
* `created_at`: string
* `url`: string
* `ping_url`: string

## Get a global webhook

```
GET /admin/hooks/{hook_id}
```

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`hook_id`** (integer) (required)
  The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.

### HTTP response status codes

* **200** - OK

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID
```

**Response schema (Status: 200):**

Same response schema as [Create a global webhook](#create-a-global-webhook).

## Update a global webhook

```
PATCH /admin/hooks/{hook_id}
```

Parameters that are not provided will be overwritten with the default value or removed if no default exists.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`hook_id`** (integer) (required)
  The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.

#### Body parameters

* **`config`** (object)
  Key/value pairs to provide settings for this webhook.
  * **`url`** (string) (required)
    The URL to which the payloads will be delivered.
  * **`content_type`** (string)
    The media type used to serialize the payloads. Supported values include json and form. The default is form.
  * **`secret`** (string)
    If provided, the secret will be used as the key to generate the HMAC hex digest value in the X-Hub-Signature header.
  * **`insecure_ssl`** (string)
    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.

* **`events`** (array of strings)
  The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.

* **`active`** (boolean)
  Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.
  Default: `true`

### HTTP response status codes

* **200** - OK

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X PATCH \
  http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID \
  -d '{
  "events": [
    "organization"
  ],
  "config": {
    "url": "https://example.com/webhook"
  }
}'
```

**Response schema (Status: 200):**

* `type`: string
* `id`: integer
* `name`: string
* `active`: boolean
* `events`: array of string
* `config`: object:
  * `url`: string
  * `content_type`: string
  * `insecure_ssl`: string
* `updated_at`: string
* `created_at`: string
* `url`: string
* `ping_url`: string

## Delete a global webhook

```
DELETE /admin/hooks/{hook_id}
```

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`hook_id`** (integer) (required)
  The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.

### HTTP response status codes

* **204** - No Content

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X DELETE \
  http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID
```

**Response schema (Status: 204):**

## Ping a global webhook

```
POST /admin/hooks/{hook_id}/pings
```

This will trigger a ping event to be sent to the webhook.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`hook_id`** (integer) (required)
  The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.

### HTTP response status codes

* **204** - No Content

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X POST \
  http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID/pings
```

**Response schema (Status: 204):**