# Update a webhook subscription — API reference

> Replaces a webhook subscription's receiver URL, event types and active state.

Source: https://upfour.io/docs/api/webhook-subscriptions/update-a-webhook-subscription

[Developers](https://upfour.io/docs/api.md)/[Webhook subscriptions](https://upfour.io/docs/api/webhook-subscriptions.md)

Replaces a webhook subscription's receiver URL, event types and active state.

PUT https://app.upfour.io/v1/webhook-subscriptions/{subscriptionID}

scope webhook.write beta returns 200

## Parameters

| Field | Type | Description |
| --- | --- | --- |
| `subscriptionID` required | uuid | path parameter |

## Body

`application/json` required 3 fields

eventsstring[] (required)

Event types to deliver, at least one; blanks and duplicates are dropped. The service does not check the names, an event that is never published simply never arrives. Published: monitor.created, monitor.updated, monitor.deleted, monitor.status_changed, monitor.degraded_changed, monitor.unstable, monitors.bulk_updated, incident.opened, incident.acknowledged, incident.resolved, incident.reopened, incident.escalated, incident.propagated, incident.partially_recovered, heartbeat.missed, heartbeat.recovered, status_page.update_published, status_page.report_published, webhook.test.

urlstring (uri) (required)

http or https URL of the receiver. A host that resolves to a private or otherwise blocked address range is refused.

All other fields1 fields

activeboolean · nullable

Defaults to true, also on update: a PUT without active switches a disabled subscription back on.

## Returns

A successful request returns `200` with application/json.

Response fields 1 top-level fields

| Field | Type | Description |
| --- | --- | --- |
| `data` | WebhookSubscription | |
| WebhookSubscription · 10 fields FieldTypeDescription `active` boolean `created_at` string (date-time) `events` string[]  · nullable `failure_count` integer `id` uuid `org_id` uuid `updated_at` string (date-time) `url` string `disabled_at` string (date-time) Set while the subscription is switched off, by active: false or by the delivery worker after repeated failures. `last_delivery_at` string (date-time) | | |

## Errors

Only the errors this operation can return. Every error uses the [same envelope](https://upfour.io/docs/api/responses.md).

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | [bad_request](https://upfour.io/docs/api/errors#code-bad_request) | The request is malformed or fails validation. |
| 403 | [permission_denied](https://upfour.io/docs/api/errors#code-permission_denied) | The credentials do not permit this action. |

Every call can also return `unauthorized` (401), `rate_limit_exceeded` (429) or `internal_error` (500 / 502). See [Responses and errors](https://upfour.io/docs/api/responses.md).

[PreviousCreate a webhook subscription](https://upfour.io/docs/api/webhook-subscriptions/create-a-webhook-subscription.md) [NextDelete a webhook subscription](https://upfour.io/docs/api/webhook-subscriptions/delete-a-webhook-subscription.md)

## Request

### cURL

```bash
curl -s -X PUT "https://app.upfour.io/v1/webhook-subscriptions/00000000-0000-4000-8000-000000000001" \
  -H "Authorization: Bearer $UP4_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "active": true,
    "events": [
      "incident.opened",
      "incident.resolved"
    ],
    "url": "https://example.com/hooks/up4"
  }'
```

### JavaScript

```javascript
const res = await fetch("https://app.upfour.io/v1/webhook-subscriptions/00000000-0000-4000-8000-000000000001", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.UP4_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    active: true,
    events: ["incident.opened", "incident.resolved"],
    url: "https://example.com/hooks/up4",
  }),
});
console.log(res.status, await res.json());
```

### Python

```python
import os
import requests

res = requests.put(
    "https://app.upfour.io/v1/webhook-subscriptions/00000000-0000-4000-8000-000000000001",
    headers={"Authorization": f"Bearer {os.environ['UP4_API_KEY']}"},
    json={
        "active": True,
        "events": ["incident.opened", "incident.resolved"],
        "url": "https://example.com/hooks/up4",
    },
)
print(res.status_code, res.json())
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	payload := strings.NewReader(`{
  "active": true,
  "events": [
    "incident.opened",
    "incident.resolved"
  ],
  "url": "https://example.com/hooks/up4"
}`)
	req, _ := http.NewRequest("PUT", "https://app.upfour.io/v1/webhook-subscriptions/00000000-0000-4000-8000-000000000001", payload)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("UP4_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	out, _ := io.ReadAll(res.Body)
	fmt.Println(res.StatusCode, string(out))
}
```

### PHP

```php
<?php
$payload = <<<'JSON'
{
  "active": true,
  "events": [
    "incident.opened",
    "incident.resolved"
  ],
  "url": "https://example.com/hooks/up4"
}
JSON;

$ch = curl_init("https://app.upfour.io/v1/webhook-subscriptions/00000000-0000-4000-8000-000000000001");
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("UP4_API_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), " ", $response, "\n";
curl_close($ch);
```

## Response

### 200

```json
{
  "data": {
    "active": true,
    "created_at": "2026-10-27T09:00:00Z",
    "events": [
      "incident.opened",
      "incident.resolved"
    ],
    "failure_count": 0,
    "id": "00000000-0000-4000-8000-000000000001",
    "org_id": "00000000-0000-4000-8000-000000000002",
    "updated_at": "2026-10-27T09:00:00Z",
    "url": "https://example.com/hooks/up4"
  }
}
```

### 400

```json
{
  "error": {
    "code": "bad_request",
    "message": "The request is malformed or fails validation.",
    "request_id": "req_…"
  }
}
```

### 403

```json
{
  "error": {
    "code": "permission_denied",
    "message": "The credentials do not permit this action.",
    "request_id": "req_…"
  }
}
```
