> Documentation index for AI agents: https://docs.pagerduty.com/llms.txt

# Create a webhook subscription

`POST https://api.pagerduty.com/webhook_subscriptions`

Creates a new webhook subscription.

For more information on webhook subscriptions and how they are used to configure v3 webhooks
see the [Webhooks v3 Developer Documentation](https://docs.pagerduty.com/developer/webhooks-overview).

Scoped OAuth requires: `webhook_subscriptions.write`

## Authorization

- **api_key** (apiKey) — `Authorization` header. The API Key with format `Token token=<API_KEY>`

## Header parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Accept` | string | yes | The `Accept` header is used as a versioning header. Default: `application/vnd.pagerduty+json;version=2`. |

## Request body (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `webhook_subscription` | object | yes |  |
| `webhook_subscription.id` | string |  | Read-only. |
| `webhook_subscription.type` | string | yes | The type indicating the schema of the object. One of: `webhook_subscription`. Default: `webhook_subscription`. |
| `webhook_subscription.active` | boolean |  | Determines whether this subscription will produce webhook events. Default: `true`. |
| `webhook_subscription.delivery_method` | object | yes |  |
| `webhook_subscription.delivery_method.id` | string |  | Read-only. |
| `webhook_subscription.delivery_method.secret` | string \| null |  | The secret used to sign webhook payloads. Only provided on the initial create response. Read-only. |
| `webhook_subscription.delivery_method.temporarily_disabled` | boolean |  | Whether or not this webhook subscription is temporarily disabled. Becomes `true` if the delivery method URL is repeatedly rejected by the server. |
| `webhook_subscription.delivery_method.type` | string | yes | Indicates the type of the delivery method. One of: `http_delivery_method`. Default: `http_delivery_method`. |
| `webhook_subscription.delivery_method.url` | string (url) | yes | The destination URL for webhook delivery. |
| `webhook_subscription.delivery_method.custom_headers` | array of object |  | Optional headers to be set on this webhook subscription when sent. The header values are redacted in GET requests, but are not redacted on the webhook when delivered to the webhook's endpoint. |
| `webhook_subscription.delivery_method.custom_headers[].name` | string |  | The header name. |
| `webhook_subscription.delivery_method.custom_headers[].value` | string |  | The header value. |
| `webhook_subscription.description` | string |  | A short description of the webhook subscription. |
| `webhook_subscription.events` | array of string | yes | The set of outbound event types the webhook will receive. Min items: 1. Items must be unique. |
| `webhook_subscription.filter` | object | yes |  |
| `webhook_subscription.filter.id` | string |  | The id of the object being used as the filter. This field is required for all filter types except account_reference. |
| `webhook_subscription.filter.type` | string | yes | The type of object being used as the filter. One of: `account_reference`, `service_reference`, `team_reference`. |
| `webhook_subscription.oauth_client` | object |  | OAuth client details. This field is populated in responses when oauth_client_id is set. Read-only. |
| `webhook_subscription.oauth_client.id` | string | yes | The ID of the OAuth client. |
| `webhook_subscription.oauth_client.type` | string | yes | The type of object being referenced. One of: `oauth_client_reference`. Default: `oauth_client_reference`. |
| `webhook_subscription.oauth_client.summary` | string |  | A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. Read-only. |

Example: Example

```json
{
  "webhook_subscription": {
    "delivery_method": {
      "type": "http_delivery_method",
      "url": "https://example.com/receive_a_pagerduty_webhook",
      "custom_headers": [
        {
          "name": "header-name",
          "value": "header-value"
        }
      ]
    },
    "description": "Sends PagerDuty v3 webhook events somewhere interesting.",
    "events": [
      "incident.acknowledged",
      "incident.annotated",
      "incident.delegated",
      "incident.escalated",
      "incident.priority_updated",
      "incident.reassigned",
      "incident.reopened",
      "incident.resolved",
      "incident.responder.added",
      "incident.responder.replied",
      "incident.triggered",
      "incident.unacknowledged"
    ],
    "filter": {
      "id": "P393ZNQ",
      "type": "service_reference"
    },
    "oauth_client_id": "AGMEB7F7YJYELCPG4Y5YWMYGXE",
    "type": "webhook_subscription"
  }
}
```

## Response 200

The webhook subscription that was created.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `webhook_subscription` | object | yes | Same fields as `webhook_subscription` above. |

Example: Example

```json
{
  "webhook_subscription": {
    "delivery_method": {
      "id": "PF9KMXH",
      "secret": null,
      "temporarily_disabled": false,
      "type": "http_delivery_method",
      "url": "https://example.com/receive_a_pagerduty_webhook",
      "custom_headers": [
        {
          "name": "your-header-name",
          "value": "-- redacted --"
        }
      ]
    },
    "description": "Sends PagerDuty v3 webhook events somewhere interesting.",
    "events": [
      "incident.acknowledged",
      "incident.annotated",
      "incident.delegated",
      "incident.escalated",
      "incident.priority_updated",
      "incident.reassigned",
      "incident.reopened",
      "incident.resolved",
      "incident.responder.added",
      "incident.responder.replied",
      "incident.triggered",
      "incident.unacknowledged"
    ],
    "filter": {
      "id": "P393ZNQ",
      "type": "service_reference"
    },
    "oauth_client": {
      "id": "AGLRZQ2PGR5B7EQ52DTT4ZJERY",
      "type": "oauth_client_reference",
      "summary": "PagerDuty Webhook Integration"
    },
    "id": "PY1OL64",
    "type": "webhook_subscription",
    "active": true
  }
}
```

## Response 400

Caller provided invalid arguments. Please review the response for error
details. Retrying with the same arguments will *not* work.

## Response 401

Caller did not supply credentials or did not provide the correct
credentials.

If you are using an API key, it may be invalid or your Authorization header may be malformed.

## Response 403

Caller is not authorized to view the requested resource.

While your authentication is valid, the authenticated user or token does not have permission to perform this action.

## Developer Agreement

Your access to and use of the PagerDuty Developer Services is governed by the [PagerDuty Developer Agreement](https://docs.pagerduty.com/developer/pagerduty-developer-agreement).
