# Update webhook subscription

**Documentation:** /reference/api-reference/webhooks/patchWebhookSubscriptionsById

Updates a webhook subscription. At least one field must be provided.

---

## PATCH `/api/v3/webhook_subscriptions/{id}`

**Endpoint:** `https://backend.composio.dev/api/v3/webhook_subscriptions/{id}`

**Summary:** Update webhook subscription

Updates a webhook subscription. At least one field must be provided.

### Authentication

**ApiKeyAuth** - API Key in `header` header `x-api-key` OR **UserApiKeyAuth** - API Key in `header` header `x-user-api-key`

### Path Parameters

- `id` (string (webhookSubscriptionId)) *(required)*: Webhook subscription ID

### Request Body

**Schema:**

- `webhook_url` (string (uri)): HTTPS URL to receive webhook events
- `enabled_events` (array<string>): Array of event types to subscribe to
- `version` (enum: "V1" | "V2" | "V3"): Webhook payload version

**Example:**

```json
{
  "webhook_url": "https://example.com",
  "enabled_events": [
    "string"
  ],
  "version": "V1"
}
```

### Responses

#### 200 - Webhook subscription updated

**Response Schema:**

- `id` (string (webhookSubscriptionId)) *(required)*: Unique subscription ID
- `webhook_url` (string) *(required)*: Webhook destination URL
- `version` (enum: "V1" | "V2" | "V3") *(required)*: Webhook payload version
- `enabled_events` (array<string>) *(required)*: Subscribed event types
- `secret` (string) *(required)*: Masked signing secret (full secret only on create/rotate)
- `created_at` (string) *(required)*: ISO 8601 timestamp
- `updated_at` (string) *(required)*: ISO 8601 timestamp

**Example Response:**

```json
{
  "id": "string",
  "webhook_url": "string",
  "version": "V1",
  "enabled_events": [
    "string"
  ],
  "secret": "string",
  "created_at": "string",
  "updated_at": "string"
}
```

#### 400 - Invalid request

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 401 - Unauthorized

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 404 - Subscription not found

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 500 - Internal server error

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

### Example cURL Request

```bash
curl -X PATCH "https://backend.composio.dev/api/v3/webhook_subscriptions/string" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook_url": "https://example.com",
    "enabled_events": [
      "string"
    ],
    "version": "V1"
  }'
```