> ## 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.

# Crea webhook

> Registra un URL che riceve eventi webhook

Registra un URL HTTPS che riceve gli [eventi webhook](https://docs.anivahealth.com/it/concepts/webhooks.md). La tua chiave API è proprietaria del
webhook. Riceve un evento solo per gli oggetti che la tua chiave può leggere. Una chiave API può possedere al massimo 5
webhook.

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

## Richiesta

### Parametri del body

**url** `string` *required*

URL HTTPS sulla porta 443 con un host pubblico e senza credenziali. Aniva non segue i reindirizzamenti.

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

[Tipi di evento](https://docs.anivahealth.com/it/concepts/webhooks.md#eventi) da ricevere, almeno uno. `["*"]` indica tutti i tipi.
`ping` non può essere incluso.

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

Da 1 a 5 indirizzi a cui Aniva invia un'email quando le consegne continuano a fallire.

**description** `string`

Testo libero per tuo riferimento, al massimo 500 caratteri.

## Risposta

In caso di successo, l'API restituisce `201 Created` con il webhook e il suo secret.

**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, ad esempio un URL errato, un tipo di evento sconosciuto, `alert_emails` non validi o una chiave API che non può possedere un webhook. |
| `401` | Chiave API non valida. |
| `403` | Nessuna chiave API, oppure chiave API senza lo scope `webhooks_manage`. |
| `409` | La tua chiave API possiede già 5 webhook. |
| `500` | Errore interno del server. |

```bash cURL theme={null}
curl --request POST \
  --url https://anivahealth.com/api/v1/webhooks \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "url": "https://partner.example.com/webhooks/aniva",
    "enabled_events": [
      "appointment.confirmed",
      "appointment.results.completed",
      "home_kit_order.results.completed"
    ],
    "alert_emails": [
      "ops@partner.example.com"
    ],
    "description": "Production"
  }'
```

```json 201 theme={null}
{
  "secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw8L0qsE2bkS4=",
  "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": null,
  "created_at": "2026-10-15T08:00:00.000Z",
  "updated_at": "2026-10-15T08:00:00.000Z"
}
```

```json 400 theme={null}
{
  "error": "url must use https"
}
```

```json 409 theme={null}
{
  "error": "An API key can own at most 5 webhooks"
}
```


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