# Webhooks

Manage a single webhook subscription for real-time alert events (subscribe/update, status, delete).

## Get alerts webhook subscription status

> Returns the current subscription status or none if not configured.

```json
{"openapi":"3.0.3","info":{"title":"Fortisx Public API","version":"1.0.0"},"tags":[{"name":"Webhooks","description":"Manage a single webhook subscription for real-time alert events (subscribe/update, status, delete)."}],"servers":[{"url":"https://api.fortisx.fi/v1","description":"Demo host (replace with your own in production)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}},"schemas":{"WebhookSubscriptionResponse":{"type":"object","properties":{"url":{"type":"string"},"status":{"type":"string","enum":["active"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"secret":{"type":"string","nullable":true,"description":"Returned only when a new secret is generated or explicitly updated"}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalServerError":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ServiceUnavailable":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/webhooks/subscription":{"get":{"tags":["Webhooks"],"summary":"Get alerts webhook subscription status","description":"Returns the current subscription status or none if not configured.","responses":{"200":{"description":"Status payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}}}}
```

## Upsert alerts webhook subscription

> Creates or updates the single subscription for alert events.

```json
{"openapi":"3.0.3","info":{"title":"Fortisx Public API","version":"1.0.0"},"tags":[{"name":"Webhooks","description":"Manage a single webhook subscription for real-time alert events (subscribe/update, status, delete)."}],"servers":[{"url":"https://api.fortisx.fi/v1","description":"Demo host (replace with your own in production)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}},"schemas":{"WebhookSubscriptionUpsertRequest":{"type":"object","required":["url","event"],"properties":{"url":{"type":"string","format":"uri","description":"HTTPS callback URL"},"secret":{"type":"string","description":"Optional secret used for HMAC signatures"}}},"WebhookSubscriptionResponse":{"type":"object","properties":{"url":{"type":"string"},"status":{"type":"string","enum":["active"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"secret":{"type":"string","nullable":true,"description":"Returned only when a new secret is generated or explicitly updated"}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}},"responses":{"BadRequestInvalidParam":{"description":"Invalid parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalServerError":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ServiceUnavailable":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/webhooks/subscription":{"put":{"tags":["Webhooks"],"summary":"Upsert alerts webhook subscription","description":"Creates or updates the single subscription for alert events.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionUpsertRequest"}}}},"responses":{"200":{"description":"Subscription is active","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestInvalidParam"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}}}}
```

## Delete alerts webhook subscription

> Removes the current subscription (if any).

```json
{"openapi":"3.0.3","info":{"title":"Fortisx Public API","version":"1.0.0"},"tags":[{"name":"Webhooks","description":"Manage a single webhook subscription for real-time alert events (subscribe/update, status, delete)."}],"servers":[{"url":"https://api.fortisx.fi/v1","description":"Demo host (replace with your own in production)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalServerError":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ServiceUnavailable":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}},"paths":{"/webhooks/subscription":{"delete":{"tags":["Webhooks"],"summary":"Delete alerts webhook subscription","description":"Removes the current subscription (if any).","responses":{"204":{"description":"Subscription deleted (or none existed)"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}}}}
```
