# Generate a webhook signing secret

POST

/v1/webhook-endpoints/generate-secret

```sh
curl --request POST \
  --url https://example.com/v1/webhook-endpoints/generate-secret \
  --header 'Authorization: Bearer <token>'
```

Returns a new strong secret (`whsec_` + base64 of 32 random bytes). Nothing is stored: put it in your secrets, then register the endpoint with its name. Sent with an `Idempotency-Key`, a retry gets `409 idempotency-key-replay-withheld`, not the secret again.

## Authorizations

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

## Responses

### 200

A new secret.

application/json

object

**secret**

required

A new signing secret (`whsec_` + base64 of 32 random bytes). Not stored anywhere: put it in your secrets (`.env` in development, the secrets store in production) and reference it by name.

string

##### Examplegenerated

```json
{
  "secret": "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"
  }
}
```

### 409

A retry with the Idempotency-Key of a request that succeeded: the secret isn’t kept (`idempotency-key-replay-withheld`).

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"
  }
}
```

## See also

- [Error code `idempotency-key-replay-withheld`](https://docs.kindgi.com/v0.1.10/reference/errors.md#idempotency-key-replay-withheld)
- [Every error code](https://docs.kindgi.com/v0.1.10/reference/errors.md)
