---
title: "Update a webhook"
method: PATCH
path: "/v1/webhooks/{id}"
tags: ["Webhooks"]
---

# Update a webhook

`PATCH /v1/webhooks/{id}`

## Request

- Base URL: `https://api.samva.dev`
- URL: `https://api.samva.dev/v1/webhooks/{id}`
- Auth: API key in header `x-api-key`

Updates a webhook's name, URL, subscribed events, channels, custom headers, mailbox scope, or status and returns the updated endpoint. A change to `mailboxIds` or `namespaceId` is checked as the endpoint will stand afterward: every mailbox must belong to the namespace when both are set.

## Path parameters

- `id` string, required

## Request body

- UpdateWebhookPayload
  - `name` string, nullable
  - `url` string, nullable
  - `eventTypes` string[], nullable
  - `channels` string[], nullable
  - `mailboxIds` MailboxId[], nullable
  - `namespaceId` string
  - `headers` object, nullable
  - `status` 'active' | 'disabled', nullable

## Response `200`

WebhookEndpoint

- WebhookEndpoint
  - `id` string, required
  - `name` string, required
  - `url` string, required
  - `eventTypes` string[], required
  - `channels` string[], nullable, required
  - `mailboxIds` MailboxId[], nullable, required
  - `namespaceId` string, required
  - `status` 'active' | 'disabled', required
  - `hasCustomHeaders` boolean, required
  - `failureStartedAt` string, nullable, required
  - `lastSucceededAt` string, nullable, required
  - `createdAt` string, required
  - `updatedAt` string, required

## Other responses

- `401`: UnauthorizedError
- `403`: ForbiddenError
- `404`: ResourceNotFoundError
- `409`: ConflictError
- `422`: ValidationError
- `500`: InternalError
- `504`: GatewayTimeoutError

---

[API](https://skmtc.dev/samva/apis/samva-api.md) · [All operations](https://skmtc.dev/samva/apis/samva-api/llms.txt) · [OpenAPI document](https://skmtc.dev/samva/apis/samva-api/revisions/a99408542cc3?raw)
