# rollWebhookSecret

Gives a webhook endpoint of the current account a new `signingSecret` and returns the webhook. `signingSecret` is `null` in the result without the `credentials:read` permission. For 24 hours after the roll, each delivery holds two `v2` signatures: the new secret first, then the old one. Change the secret on the receiver in this time. A second roll in these 24 hours stops the oldest secret at once, so roll again only when a secret is exposed. A webhook without a `signingSecret` gets its first one, with no old secret. An unknown id fails with the error `Webhook not found`. A roll can fail when another roll of the same webhook runs at the same time: then try again. Arguments: - `id`: ID of the webhook, from `webhooks`.

```
rollWebhookSecret(

  id: ID!

): Webhook!
```

### Arguments[​](#arguments "Direct link to Arguments")

#### [`rollWebhookSecret.id`](#id) ● [`ID!`](https://docs.monei.com/apis/graphql/types/scalars/id.md) non-null scalar[​](#id "Direct link to id")

### Type[​](#type "Direct link to Type")

#### [`Webhook`](https://docs.monei.com/apis/graphql/types/objects/webhook.md) object[​](#webhook- "Direct link to webhook-")

Endpoint that receives MONEI events as HTTP POST requests with a JSON body. The dashboard shows endpoints on Settings > Webhooks. The body is the event: `id`, `type`, `livemode`, `accountId`, `objectType`, `objectId`, `createdAt` (Unix seconds) and `object`. MONEI signs each attempt in the `MONEI-Signature` header, such as `t=<unix seconds>,v1=<signature>,v2=<signature>`. Each signature is the hex HMAC-SHA256 of `<t>.<body>`. An element can be absent and the header can hold more elements, so read each element by its key and do not match the full header.

* `v1` is made with the account API key. When the account has no API key, it is made with the legacy `secret` of the webhook. With neither, the header has no `v1`.
* `v2` is made with the `signingSecret` of the webhook, the full `whsec_...` string. For 24 hours after `rollWebhookSecret`, the header holds two `v2` elements: the new secret first, then the old one. A webhook without a `signingSecret` sends no `v2`. The `webhook.test` request of `createWebhook` and `updateWebhook` is signed the same way, but its `v1` is made only with the account API key. Only a 2xx answer counts as delivered. MONEI does not follow redirects, and waits 60 seconds at most for an answer. MONEI does not send to a URL that resolves to a private or local address. A failed live delivery is retried with growing delays, up to 18 attempts over about 3 days. A test-mode delivery gets 3 attempts. A URL on a tunnelling or request-inspection host (ngrok, webhook.site) gets 1 attempt. MONEI emails the account admin when a live endpoint starts to fail, and disables the endpoint only after it fails without a break for 7 days.
