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

# Nomainīt noslēpumu

> Aizstāt tīmekļa aizķeres parakstīšanas noslēpumu

Izveido jaunu parakstīšanas noslēpumu tīmekļa aizķerei. Vecais noslēpums turpina parakstīt 24 stundas, līdz
`previous_secret_expires_at`. Otrā rotācija šajā laikā uzreiz aptur vecāko noslēpumu.

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

## Pieprasījums

### Ceļa parametri

**id** `string` *required*

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

### Pieprasījuma satura parametri

Pieprasījuma pamatteksts nav obligāts.

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

`true` uzreiz aptur pašreizējo noslēpumu, piemēram, pēc noplūdes.

## Atbilde

Ja pieprasījums izdodas, API atgriež `200 OK` ar tīmekļa aizķeri un tās jauno noslēpumu.

**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. Skati `error` ziņojumu. |
| `401` | Nederīga API atslēga. |
| `403` | Nav API atslēgas vai API atslēgai trūkst `webhooks_manage` tvēruma. |
| `404` | Tīmekļa aizķere nav atrasta vai pieder citai API atslēgai. |
| `500` | Iekšēja servera kļūda. |

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