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

# Izveidot tīmekļa aizķeri

> Reģistrēt URL, kas saņem tīmekļa aizķeres notikumus

Reģistrē HTTPS URL, kas saņem [tīmekļa aizķeres notikumus](https://docs.anivahealth.com/lv/concepts/webhooks.md). Tīmekļa aizķere pieder tavai API
atslēgai. Tā saņem notikumu tikai par objektiem, kurus tava atslēga var lasīt. Vienai API atslēgai var piederēt ne vairāk kā 5
tīmekļa aizķeres.

> [!NOTE]
>
> Nepieciešams `webhooks_manage` tvērums.

## Pieprasījums

### Pieprasījuma satura parametri

**url** `string` *required*

HTTPS URL 443. portā ar publisku resursdatoru un bez piekļuves datiem. Aniva neseko pāradresācijām.

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

Saņemamie [notikumu veidi](https://docs.anivahealth.com/lv/concepts/webhooks.md#notikumi), vismaz viens. `["*"]` nozīmē visus veidus.
`ping` nevar iekļaut sarakstā.

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

1 līdz 5 adreses, uz kurām Aniva sūta e-pastus, ja piegādes atkārtoti neizdodas.

**description** `string`

Brīvs teksts tavai uzziņai, ne vairāk kā 500 rakstzīmju.

## Atbilde

Veiksmīgas izpildes gadījumā API atgriež `201 Created` ar tīmekļa aizķeri un tās slepeno atslēgu.

**secret** `string` *required*

Parakstīšanas slepenā atslēga, `whsec_` un base64. Aniva to parāda tikai šajā atbildē. Skati [Paraksta
pārbaude](https://docs.anivahealth.com/lv/concepts/webhooks.md#paraksta-parbaude).

**id** `string` *required*

Tīmekļa aizķeres identifikators (UUID).

**url** `string` *required*

HTTPS URL, uz kuru Aniva sūta notikumus.

**description** `string`

Brīvs teksts tavai uzziņai. Var būt `null`.

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

[Notikumu veidi](https://docs.anivahealth.com/lv/concepts/webhooks.md#notikumi), ko saņem šī tīmekļa aizķere. `*` nozīmē visus veidus.

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

Adreses, uz kurām Aniva sūta e-pastus, ja piegādes atkārtoti neizdodas.

**status** `string` *required*

`enabled` vai `disabled`.

**disabled\_at** `string`

ISO 8601 UTC laika brīdis, kad tīmekļa aizķere tika atspējota. `null`, kamēr tā ir iespējota.

**disabled\_reason** `string`

Kāpēc tīmekļa aizķere tika atspējota. Skati [Kļūmju paziņojumi](https://docs.anivahealth.com/lv/concepts/webhooks.md#pazinojumi-par-klumem). `null`,
kamēr tā ir iespējota.

**failing\_since** `string`

ISO 8601 UTC laika brīdis, kad sākās pašreizējā kļūmju sērija. `null`, ja pēdējā piegāde izdevās.

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

ISO 8601 UTC laika brīdis, kad iepriekšējā slepenā atslēga pārstāj parakstīt. `null`, ja nenotiek rotācija.

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

ISO 8601 UTC laika brīdis, kad tīmekļa aizķere tika izveidota.

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

Pēdējo izmaiņu ISO 8601 UTC laika brīdis.

## Kļūdu atbildes

| Statuss | Apraksts |
| - | - |
| `400` | Nederīgs pieprasījums, piemēram, nederīgs URL, nezināms notikuma veids, nederīgs `alert_emails` vai API atslēga, kurai nevar piederēt tīmekļa aizķere. |
| `401` | Nederīga API atslēga. |
| `403` | Nav API atslēgas vai API atslēgai trūkst `webhooks_manage` tvēruma. |
| `409` | Tavai API atslēgai jau pieder 5 tīmekļa aizķeres. |
| `500` | Iekšēja servera kļūda. |

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