# Update a webhook

### Update a webhook

`PATCH /api/v1/webhooks/{webhookId}`

Operation ID: `updateWebhook`

Change the URL, the headers, the event types, or several at once. Only the member who created the webhook can change it. The secret stays the same. Pending deliveries go out with the new URL and headers.

**Path parameters**

- `webhookId` (string · uuid, required): Webhook id

**Request body** (required)

- `url` (string · uri, optional): The new URL. A different URL removes all saved headers first.
- `headers` (object, optional): Changes only the headers named here: a value sets or replaces that header, null removes it. Headers not named stay, except when url changes: then only the headers sent here are kept.
- `eventTypes` (string | string[], optional): The new event types: "all" or a list. Pending deliveries of types no longer in the list are dropped; added types only get events from now on.

**200**: Webhook updated.

- `webhook` (object, required)
  - `id` (string · uuid, required)
  - `url` (string, required)
  - `headerNames` (string[], required): Names of the extra headers sent with every request.
  - `eventTypes` (string | string[], required): The [event types](https://needle.app/docs/webhooks#event-types) this webhook gets. "all" means every type, also types added later. A list stays as it is: types added later are not sent until you add them.
  - `lastAttemptAt` (string · date-time | null, required)
  - `lastError` (string | null, required): Why the last failed delivery failed, for example 401. Null once a delivery succeeds.
  - `createdAt` (string · date-time, required)
  - `createdBy` (string · uuid, required): The member who created the webhook. It receives the events they can see, and is deleted when they leave the workspace.
- `requestId` (string · uuid, required): Id of this request, for support and troubleshooting

**Errors**

- `400`: Bad request
- `401`: Unauthorized: missing or invalid API key
- `403`: Forbidden
- `404`: Not found
- `422`: Invalid request payload
