> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anivahealth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ruota segreto

> Sostituisci il segreto di firma di un webhook

Crea un nuovo segreto di firma per un webhook. Il vecchio segreto continua a firmare per 24 ore, fino a
`previous_secret_expires_at`. Una seconda rotazione entro questo intervallo disattiva subito il segreto più vecchio.

> [!NOTE]
>
> Richiede lo scope `webhooks_manage`.

## Richiesta

### Parametri di percorso

**id** `string` *required*

Identificatore del webhook (UUID).

### Parametri del body

Il corpo è facoltativo.

**revoke\_current\_secret\_now** `boolean` (default: false)

`true` disattiva subito il segreto attuale, ad esempio dopo una fuga di dati.

## Risposta

In caso di successo, l'API restituisce `200 OK` con il webhook e il suo nuovo segreto.

**secret** `string` *required*

Il secret di firma, `whsec_` più base64. Aniva lo mostra solo in questa risposta. Vedi [Verifica la
firma](https://docs.anivahealth.com/it/concepts/webhooks.md#verifica-la-firma).

**id** `string` *required*

Identificatore del webhook (UUID).

**url** `string` *required*

L'URL HTTPS a cui Aniva invia gli eventi.

**description** `string`

Testo libero per tuo riferimento. Può essere `null`.

**enabled\_events** `string[]` *required*

[Tipi di evento](https://docs.anivahealth.com/it/concepts/webhooks.md#eventi) che questo webhook riceve. `*` indica tutti i tipi.

**alert\_emails** `string[]` *required*

Indirizzi a cui Aniva invia un'email quando le consegne continuano a fallire.

**status** `string` *required*

`enabled` o `disabled`.

**disabled\_at** `string`

Istante ISO 8601 UTC in cui il webhook è stato disabilitato. `null` mentre è abilitato.

**disabled\_reason** `string`

Motivo per cui il webhook è stato disabilitato. Vedi [Avvisi di errore](https://docs.anivahealth.com/it/concepts/webhooks.md#avvisi-di-errore). `null`
mentre è abilitato.

**failing\_since** `string`

Istante ISO 8601 UTC in cui è iniziata la serie di errori attuale. `null` quando l'ultima consegna è riuscita.

**previous\_secret\_expires\_at** `string`

Istante ISO 8601 UTC in cui il secret precedente smette di firmare. `null` quando non è in corso alcuna rotazione.

**created\_at** `string` *required*

Istante ISO 8601 UTC in cui il webhook è stato creato.

**updated\_at** `string` *required*

Istante ISO 8601 UTC dell'ultima modifica.

## Risposte di errore

| Stato | Descrizione |
| - | - |
| `400` | Richiesta non valida. Vedi il messaggio `error`. |
| `401` | Chiave API non valida. |
| `403` | Nessuna chiave API, oppure chiave API senza lo scope `webhooks_manage`. |
| `404` | Webhook non trovato, oppure appartiene a un'altra chiave API. |
| `500` | Errore interno del server. |

```bash cURL theme={null}
curl --request POST \
  --url https://anivahealth.com/api/v1/webhooks/4a6c8e0f-2b4d-4f6a-8c0e-2a4c6e8f0b1d/rotate-secret \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "revoke_current_secret_now": false
  }'
```

```json 200 theme={null}
{
  "id": "4a6c8e0f-2b4d-4f6a-8c0e-2a4c6e8f0b1d",
  "url": "https://partner.example.com/webhooks/aniva",
  "description": "Production",
  "enabled_events": [
    "appointment.confirmed",
    "appointment.results.completed",
    "home_kit_order.results.completed"
  ],
  "alert_emails": ["ops@partner.example.com"],
  "status": "enabled",
  "disabled_at": null,
  "disabled_reason": null,
  "failing_since": null,
  "previous_secret_expires_at": "2026-10-17T10:00:00.000Z",
  "created_at": "2026-10-15T08:00:00.000Z",
  "updated_at": "2026-10-16T10:00:00.000Z",
  "secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw8L0qsE2bkS4="
}
```

```json 404 theme={null}
{
  "error": "Webhook not found"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.