# Change an endpoint

> Page: https://docs.flung.dev/reference/api/patch-v1-webhook-endpoints-id. Index of every page: https://docs.flung.dev/llms.txt

Its URL, its events, or whether it is enabled.

`PATCH /v1/webhook-endpoints/{id}`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Change an endpoint. |
| What does it need? | An API key or an OAuth access token. |
| What does it take? | A JSON body with the fields below, and `id` in the path. |
| What does it return? | Status 200 with a body of type [`WebhookEndpoint`](https://docs.flung.dev/reference/api/schemas.md#webhookendpoint). |
| In the SDK? | `flung.webhookEndpoints.update()` |
| What can go wrong? | `401` Missing, unknown, revoked or expired API key; `404` No such endpoint in this workspace; `422` The request failed validation; `429` Too many requests for this credential; wait for `retry-after` seconds. Every failure has the same [error shape](https://docs.flung.dev/reference/api/errors.md). |

## What it does

Its URL, its events, or whether it is enabled. The signing secret stays; rotate it separately.

## Example

**curl**

```bash
curl -X PATCH 'https://api.flung.dev/v1/webhook-endpoints/whe_aaaaaaaaaaaaaaaaaaaaaaaa' \
  --header "Authorization: Bearer $FLUNG_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

**TypeScript**

```ts
import { Flung } from '@flung.dev/sdk'

const flung = new Flung({ apiKey: process.env.FLUNG_API_KEY! })
const result = await flung.webhookEndpoints.update({
  id: 'whe_aaaaaaaaaaaaaaaaaaaaaaaa',
})
```

**fetch**

```js
const response = await fetch('https://api.flung.dev/v1/webhook-endpoints/whe_aaaaaaaaaaaaaaaaaaaaaaaa', {
  method: 'PATCH',
  headers: {
    'Authorization': `Bearer ${process.env.FLUNG_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
})
if (!response.ok) throw new Error((await response.json()).error.message)
const result = await response.json()
```

A successful answer looks like this:

```json
{
  "id": "whe_aaaaaaaaaaaaaaaaaaaaaaaa",
  "url": "string",
  "events": [
    "string"
  ],
  "enabled": true,
  "createdAt": "2026-11-01T09:00:00.000Z"
}
```

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | yes |  |

## Request body

The body has the type an object, with the fields below.

| Field | Type | Required | Description |
|---|---|---|---|
| `url` | `string` | no | at most 2048 characters. |
| `events` | `WebhookEvent[]` | no |  |
| `enabled` | `boolean` | no | false pauses deliveries; events in the meantime are not sent. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | The endpoint. | [`WebhookEndpoint`](https://docs.flung.dev/reference/api/schemas.md#webhookendpoint) |
| 401 | Missing, unknown, revoked or expired API key. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |
| 404 | No such endpoint in this workspace. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |
| 422 | The request failed validation. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |
| 429 | Too many requests for this credential; wait for `retry-after` seconds. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |

## Response body

A 200 answer has the type [`WebhookEndpoint`](https://docs.flung.dev/reference/api/schemas.md#webhookendpoint).

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | yes |  |
| `url` | `string` | yes |  |
| `events` | `string[]` | yes |  |
| `enabled` | `boolean` | yes |  |
| `createdAt` | `string` | yes |  |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.flung.dev/reference/api.md) | Every endpoint |
| [Schemas](https://docs.flung.dev/reference/api/schemas.md) | Every request and response type |
| [Errors](https://docs.flung.dev/reference/api/errors.md) | Every error code and what to do about it |
