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

# Utwórz webhook

> Zarejestruj adres URL odbierający zdarzenia webhooka

Zarejestruj adres HTTPS, który odbiera [zdarzenia webhooków](https://docs.anivahealth.com/pl/concepts/webhooks.md). Właścicielem
webhooka jest twój klucz API. Webhook odbiera zdarzenie tylko dla obiektów, które twój klucz może
odczytać. Klucz API może mieć maksymalnie 5 webhooków.

> [!NOTE]
>
> Wymaga zakresu `webhooks_manage`.

## Żądanie

### Parametry treści

**url** `string` *required*

Adres HTTPS na porcie 443 z publicznym hostem i bez danych uwierzytelniających. Aniva nie podąża za przekierowaniami.

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

[Typy zdarzeń](https://docs.anivahealth.com/pl/concepts/webhooks.md#zdarzenia) do odbierania, co najmniej jeden. `["*"]` oznacza
wszystkie typy. Nie można podać `ping`.

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

Od 1 do 5 adresów, na które Aniva wysyła e-maile, gdy dostarczenia wciąż się nie udają.

**description** `string`

Dowolny tekst na własne potrzeby, maksymalnie 500 znaków.

## Odpowiedź

W przypadku powodzenia API zwraca `201 Created` wraz z webhookiem i jego sekretem.

**secret** `string` *required*

Sekret podpisujący, `whsec_` oraz base64. Aniva pokazuje go tylko w tej odpowiedzi. Zobacz
[Zweryfikuj podpis](https://docs.anivahealth.com/pl/concepts/webhooks.md#zweryfikuj-podpis).

**id** `string` *required*

Identyfikator webhooka (UUID).

**url** `string` *required*

Adres HTTPS, na który Aniva wysyła zdarzenia.

**description** `string`

Dowolny tekst na własne potrzeby. Może mieć wartość `null`.

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

[Typy zdarzeń](https://docs.anivahealth.com/pl/concepts/webhooks.md#zdarzenia) odbierane przez ten webhook. `*` oznacza wszystkie typy.

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

Adresy, na które Aniva wysyła e-maile, gdy dostarczenia wciąż się nie udają.

**status** `string` *required*

`enabled` lub `disabled`.

**disabled\_at** `string`

Czas w formacie ISO 8601 UTC wyłączenia webhooka. `null`, gdy jest włączony.

**disabled\_reason** `string`

Powód wyłączenia webhooka. Zobacz [Powiadomienia o błędach](https://docs.anivahealth.com/pl/concepts/webhooks.md#powiadomienia-o-niepowodzeniach).
`null`, gdy jest włączony.

**failing\_since** `string`

Czas w formacie ISO 8601 UTC rozpoczęcia bieżącej serii niepowodzeń. `null`, gdy ostatnie dostarczenie się powiodło.

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

Czas w formacie ISO 8601 UTC, kiedy poprzedni sekret przestanie podpisywać. `null`, gdy nie trwa rotacja.

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

Czas w formacie ISO 8601 UTC utworzenia webhooka.

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

Czas w formacie ISO 8601 UTC ostatniej zmiany.

## Odpowiedzi z błędami

| Status | Opis |
| - | - |
| `400` | Nieprawidłowe żądanie, na przykład błędny URL, nieznany typ zdarzenia, nieprawidłowe `alert_emails` lub klucz API, który nie może być właścicielem webhooka. |
| `401` | Nieprawidłowy klucz API. |
| `403` | Brak klucza API lub klucz API bez zakresu `webhooks_manage`. |
| `409` | Twój klucz API ma już 5 webhooków. |
| `500` | Wewnętrzny błąd serwera. |

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