# Update a webhook endpoint

PATCH

/v1/webhook-endpoints/{endpointId}

```sh
curl --request PATCH \
  --url https://example.com/v1/webhook-endpoints/example \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "url": "https://example.com", "events": [ "run.finished" ], "filter": { "projectId": "example", "flowIds": [ "example" ], "includeDryRuns": true }, "secretRef": { "envName": "example", "name": "example" }, "description": "example" }'
```

To rotate the signing secret, rotate the secret in your secrets store (`POST /v1/secrets/{name}/rotate`); point `secretRef` at another secret to switch.

## Authorizations

- **[bearerAuth](https://docs.kindgi.com/v0.8.0/reference/api.md#bearerauth)**

## Parameters

### Path Parameters

**endpointId**

required

string

The webhook endpoint id.

### Header Parameters

**Idempotency-Key**

string

\>= 1 characters

Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the workspace is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per `docs/API-ROUTE-CONVENTIONS.md` §3.1). A retry sent while the first request still runs is answered `409 idempotency-key-in-flight` with `Retry-After`, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets `409 idempotency-key-replay-withheld`, with the first request’s status and when it succeeded (from 0.1.5). A request whose key store can’t be read before it runs is answered `503 idempotency-store-unavailable` with `Retry-After`: nothing ran, so retry with the same key (from 0.3.0).

## Request Bodyrequired

application/json

Fields to change; absent fields are kept. `filter` is replaced as a whole.

object

**url**

string format: uri

<= 2048 characters

**events**

Array\<string>

\>= 1 items

Allowed values: run.finished improve-run.finished approval.requested

**filter**

Which events reach the endpoint. Every field narrows; absent fields do not. `run.finished` is sent for top-level runs only, not replays.

object

**projectId**

Only runs in this project.

string

\>= 1 characters

**flowIds**

Only runs of these flows (any version).

Array\<string>

\>= 1 items <= 100 items

**includeDryRuns**

Dry runs are left out unless this is `true`.

boolean

**secretRef**

A secret by name in the deployment’s secrets store, resolved at tenant scope (the same shape as a provider’s `secret_ref`). The value is `whsec_` + base64 of at least 24 random bytes (or that base64 alone); the store keeps it, the endpoint keeps only this reference.

object

**envName**

required

string

/^\[a-z]\[a-z0-9-]{0,62}$/

**name**

required

string

\>= 1 characters <= 256 characters

**description**

`null` clears it.

string | null

<= 500 characters

## Responses

### 200

The updated endpoint.

application/json

object

**endpointId**

required

string

**url**

required

string format: uri

**events**

required

Array\<string>

Allowed values: run.finished improve-run.finished approval.requested

**filter**

required

Which events reach the endpoint. Every field narrows; absent fields do not. `run.finished` is sent for top-level runs only, not replays.

object

**projectId**

Only runs in this project.

string

\>= 1 characters

**flowIds**

Only runs of these flows (any version).

Array\<string>

\>= 1 items <= 100 items

**includeDryRuns**

Dry runs are left out unless this is `true`.

boolean

**description**

required

string | null

**secretRef**

required

A secret by name in the deployment’s secrets store, resolved at tenant scope (the same shape as a provider’s `secret_ref`). The value is `whsec_` + base64 of at least 24 random bytes (or that base64 alone); the store keeps it, the endpoint keeps only this reference.

object

**envName**

required

string

/^\[a-z]\[a-z0-9-]{0,62}$/

**name**

required

string

\>= 1 characters <= 256 characters

**createdAt**

required

string format: date-time

**updatedAt**

required

string format: date-time

##### Example

```json
{
  "events": [
    "run.finished"
  ]
}
```

### 400

Malformed body or unknown field; the deployment refuses the URL (`webhook-url-refused`); the referenced secret does not exist or is too weak, it’s a model provider’s key (`provider-key-refused`), or it’s under the reserved `kindgi.` prefix (`reserved-name-prefix`). Or `connection-key-refused`: a secret it names is the account key of a texts connection app registration (`details.secret`, `details.appId`), which only that registration names. Use a key of its own: a new API key from the provider, stored under its own name. A copy of this one under another name reaches the same account. Or `identity-provider-key-refused`: a secret it names is an identity provider’s secret, an OIDC client secret or a SAML signing or decryption key (`details.secret`, `details.identityProviderId`), which only sign-in names. If one app registration serves both, give it a second secret of its own (a second client secret), store that under its own name and use that name.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 401

Missing / malformed / expired / revoked bearer token.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 403

Not a tenant admin (`permission-denied`). Without an authorization store, a tenant admin is the deployment’s API token, an admin key, or a console signed in with either.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 404

No endpoint with that id, or `filter.projectId` names no project.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 409

Idempotency-Key was reused with a different body, or resource-state conflict. Or `env-not-served`: this runtime keeps every value under the env it serves (whoami’s `servedEnv`, with `refusesOtherEnvs`), and the secret reference names another. Name it under `details.servedEnv`. Nothing is stored. Or `idempotency-key-in-flight` (with `Retry-After`): a request with the same `Idempotency-Key` still runs, so this one wasn’t run; send it again after `Retry-After` to get that request’s answer.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

#### Headers

**Retry-After**

integer

\>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

### 413

The request body is over the API’s limit (`request-too-large`; `details.maxBytes` says how much).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 429

`rate-limit-exceeded` with `details.limit: "api-requests"`, on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; `Retry-After` says when to send it again.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

#### Headers

**Retry-After**

integer

\>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

### 500

Server error (unmapped domain code or framework crash).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 503

The `Idempotency-Key` store (`idempotency-store-unavailable`) or the authorization store (`authz-backend-unavailable`) couldn’t be reached before the request ran, or the database was too busy for its authorization check (`database-busy`), so nothing was changed; `Retry-After` (whole seconds) says when to try again with the same key. Or `tenant-state-unavailable` (with `Retry-After`), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

#### Headers

**Retry-After**

integer

\>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

## See also

- [`GET /v1/webhook-endpoints/{endpointId}`: Fetch a webhook endpoint](https://docs.kindgi.com/v0.8.0/reference/api/operations/webhookendpointsget.md)
- [`POST /v1/webhook-endpoints/{endpointId}/unregister`: Unregister a webhook endpoint (soft delete)](https://docs.kindgi.com/v0.8.0/reference/api/operations/webhookendpointsunregister.md)
- [`GET /v1/webhook-endpoints/{endpointId}/deliveries`: List a webhook endpoint's deliveries](https://docs.kindgi.com/v0.8.0/reference/api/operations/webhookendpointslistdeliveries.md)
- [`POST /v1/webhook-endpoints/{endpointId}/deliveries/{deliveryId}/redeliver`: Redeliver an event](https://docs.kindgi.com/v0.8.0/reference/api/operations/webhookendpointsredeliver.md)
- [Error code `authz-backend-unavailable`](https://docs.kindgi.com/v0.8.0/reference/errors.md#authz-backend-unavailable)
- [Error code `connection-key-refused`](https://docs.kindgi.com/v0.8.0/reference/errors.md#connection-key-refused)
- [Error code `database-busy`](https://docs.kindgi.com/v0.8.0/reference/errors.md#database-busy)
- [Error code `env-not-served`](https://docs.kindgi.com/v0.8.0/reference/errors.md#env-not-served)
- [Error code `idempotency-key-in-flight`](https://docs.kindgi.com/v0.8.0/reference/errors.md#idempotency-key-in-flight)
- [Error code `idempotency-store-unavailable`](https://docs.kindgi.com/v0.8.0/reference/errors.md#idempotency-store-unavailable)
- [Error code `identity-provider-key-refused`](https://docs.kindgi.com/v0.8.0/reference/errors.md#identity-provider-key-refused)
- [Error code `permission-denied`](https://docs.kindgi.com/v0.8.0/reference/errors.md#permission-denied)
- [Error code `provider-key-refused`](https://docs.kindgi.com/v0.8.0/reference/errors.md#provider-key-refused)
- [Error code `rate-limit-exceeded`](https://docs.kindgi.com/v0.8.0/reference/errors.md#rate-limit-exceeded)
- [Error code `request-too-large`](https://docs.kindgi.com/v0.8.0/reference/errors.md#request-too-large)
- [Error code `reserved-name-prefix`](https://docs.kindgi.com/v0.8.0/reference/errors.md#reserved-name-prefix)
- [Error code `tenant-state-unavailable`](https://docs.kindgi.com/v0.8.0/reference/errors.md#tenant-state-unavailable)
- [Error code `webhook-url-refused`](https://docs.kindgi.com/v0.8.0/reference/errors.md#webhook-url-refused)
- [Every error code](https://docs.kindgi.com/v0.8.0/reference/errors.md)
