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

# Vytvoriť webhook

> Zaregistrovať URL adresu, ktorá prijíma udalosti webhooku

Zaregistruj HTTPS URL, ktorá prijíma [udalosti webhooku](https://docs.anivahealth.com/sk/concepts/webhooks.md). Webhook vlastní tvoj API
kľúč. Udalosť prijme iba pre objekty, ktoré dokáže tvoj kľúč čítať. Jeden API kľúč môže vlastniť najviac 5
webhookov.

> [!NOTE]
>
> Vyžaduje scope `webhooks_manage`.

## Požiadavka

### Parametre tela

**url** `string` *required*

HTTPS URL na porte 443 s verejným hostiteľom a bez prihlasovacích údajov. Aniva nenasleduje presmerovania.

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

[Typy udalostí](https://docs.anivahealth.com/sk/concepts/webhooks.md#udalosti), ktoré sa majú prijímať, aspoň jeden. `["*"]` znamená každý typ.
`ping` nemožno uviesť.

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

1 až 5 adries, na ktoré Aniva pošle e-mail, keď doručovanie opakovane zlyháva.

**description** `string`

Voľný text pre tvoju vlastnú potrebu, najviac 500 znakov.

## Odpoveď

Pri úspechu API vráti `201 Created` s webhookom a jeho tajným kľúčom.

**secret** `string` *required*

Podpisový tajný kľúč, `whsec_` plus base64. Aniva ho zobrazí iba v tejto odpovedi. Pozri [Overenie
podpisu](https://docs.anivahealth.com/sk/concepts/webhooks.md#overenie-podpisu).

**id** `string` *required*

Identifikátor webhooku (UUID).

**url** `string` *required*

HTTPS URL, na ktorú Aniva posiela udalosti.

**description** `string`

Voľný text pre tvoju vlastnú potrebu. Môže byť `null`.

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

[Typy udalostí](https://docs.anivahealth.com/sk/concepts/webhooks.md#udalosti), ktoré tento webhook prijíma. `*` znamená každý typ.

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

Adresy, na ktoré Aniva posiela e-maily, keď doručenia opakovane zlyhávajú.

**status** `string` *required*

`enabled` alebo `disabled`.

**disabled\_at** `string`

Čas v ISO 8601 UTC, kedy bol webhook vypnutý. `null`, kým je zapnutý.

**disabled\_reason** `string`

Prečo bol webhook vypnutý. Pozri [Upozornenia na zlyhania](https://docs.anivahealth.com/sk/concepts/webhooks.md#upozornenia-na-zlyhanie). `null`,
kým je zapnutý.

**failing\_since** `string`

Čas v ISO 8601 UTC, kedy sa začala aktuálna séria zlyhaní. `null`, keď posledné doručenie uspelo.

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

Čas v ISO 8601 UTC, kedy predchádzajúci tajný kľúč prestane podpisovať. `null`, keď neprebieha žiadna rotácia.

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

Čas v ISO 8601 UTC, kedy bol webhook vytvorený.

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

Čas poslednej zmeny v ISO 8601 UTC.

## Chybové odpovede

| Stav | Popis |
| - | - |
| `400` | Neplatná požiadavka, napríklad zlá URL, neznámy typ udalosti, neplatné `alert_emails` alebo API kľúč, ktorý nemôže vlastniť webhook. |
| `401` | Chýbajúci alebo neplatný API kľúč. |
| `403` | Tvoj API kľúč nemá rozsah `webhooks_manage`. |
| `409` | Tvoj API kľúč už vlastní 5 webhookov. |
| `500` | Interná chyba servera. |

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