# Webhooks

Webhook management and events

## GET /api/webhook/events

> Get all available webhook event types

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Webhooks","description":"Webhook management and events"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"WebhookEventInfoDto":{"type":"object","properties":{"eventType":{"type":"string","description":"Event type identifier"},"description":{"type":"string","description":"Human-readable description of when this event is triggered"},"examplePayload":{"type":"object","description":"Example payload structure for this event type"}},"required":["eventType","description","examplePayload"]}}},"paths":{"/api/webhook/events":{"get":{"operationId":"WebhookController_getAvailableEvents","parameters":[],"responses":{"200":{"description":"Returns list of all webhook event types with descriptions and example payloads","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEventInfoDto"}}}}}},"summary":"Get all available webhook event types","tags":["Webhooks"]}}}}
```

## POST /api/webhook/subscription

> Create webhook subscription

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Webhooks","description":"Webhook management and events"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"WebhookSubscriberCreateDto":{"type":"object","properties":{"event":{"description":"Event type that triggers the webhook","allOf":[{"$ref":"#/components/schemas/WebhookEventType"}]},"url":{"type":"string","description":"URL where webhook notifications will be sent"}},"required":["event","url"]},"WebhookEventType":{"type":"string","enum":["extracted","export","validation-success"]},"WebhookSubscriber":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the webhook subscriber"},"event":{"description":"Event type that triggers the webhook","allOf":[{"$ref":"#/components/schemas/WebhookEventType"}]},"url":{"type":"string","description":"URL where webhook notifications will be sent"},"secret":{"type":"object","description":"Secret token used for HMAC signature generation"},"createdAt":{"format":"date-time","type":"string","description":"Timestamp when the webhook subscription was created"},"updatedAt":{"format":"date-time","type":"string","description":"Timestamp when the webhook subscription was last updated"}},"required":["id","event","url","secret","createdAt","updatedAt"]}}},"paths":{"/api/webhook/subscription":{"post":{"operationId":"WebhookController_createSubscription","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberCreateDto"}}}},"responses":{"201":{"description":"The webhook subscription has been created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriber"}}}},"400":{"description":"Bad request - URL and event are required"},"500":{"description":"Internal server error"}},"summary":"Create webhook subscription","tags":["Webhooks"]}}}}
```

## GET /api/webhook/subscriptions

> Get all webhook subscriptions

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Webhooks","description":"Webhook management and events"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"WebhookSubscriber":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the webhook subscriber"},"event":{"description":"Event type that triggers the webhook","allOf":[{"$ref":"#/components/schemas/WebhookEventType"}]},"url":{"type":"string","description":"URL where webhook notifications will be sent"},"secret":{"type":"object","description":"Secret token used for HMAC signature generation"},"createdAt":{"format":"date-time","type":"string","description":"Timestamp when the webhook subscription was created"},"updatedAt":{"format":"date-time","type":"string","description":"Timestamp when the webhook subscription was last updated"}},"required":["id","event","url","secret","createdAt","updatedAt"]},"WebhookEventType":{"type":"string","enum":["extracted","export","validation-success"]}}},"paths":{"/api/webhook/subscriptions":{"get":{"operationId":"WebhookController_getAllSubscriptions","parameters":[],"responses":{"200":{"description":"List of webhook subscriptions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WebhookSubscriber"}}}}},"500":{"description":"Internal server error"}},"summary":"Get all webhook subscriptions","tags":["Webhooks"]}}}}
```

## GET /api/webhook/subscription/{id}

> Get webhook subscription by ID

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Webhooks","description":"Webhook management and events"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"WebhookSubscriber":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the webhook subscriber"},"event":{"description":"Event type that triggers the webhook","allOf":[{"$ref":"#/components/schemas/WebhookEventType"}]},"url":{"type":"string","description":"URL where webhook notifications will be sent"},"secret":{"type":"object","description":"Secret token used for HMAC signature generation"},"createdAt":{"format":"date-time","type":"string","description":"Timestamp when the webhook subscription was created"},"updatedAt":{"format":"date-time","type":"string","description":"Timestamp when the webhook subscription was last updated"}},"required":["id","event","url","secret","createdAt","updatedAt"]},"WebhookEventType":{"type":"string","enum":["extracted","export","validation-success"]}}},"paths":{"/api/webhook/subscription/{id}":{"get":{"operationId":"WebhookController_getSubscriptionById","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription ID","schema":{"type":"string"}}],"responses":{"200":{"description":"The webhook subscription details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriber"}}}},"404":{"description":"Subscription not found"},"500":{"description":"Internal server error"}},"summary":"Get webhook subscription by ID","tags":["Webhooks"]}}}}
```

## PUT /api/webhook/subscription/{id}

> Update webhook subscription

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Webhooks","description":"Webhook management and events"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"WebhookSubscriberUpdateDto":{"type":"object","properties":{"event":{"description":"Event type that triggers the webhook","allOf":[{"$ref":"#/components/schemas/WebhookEventType"}]},"url":{"type":"string","description":"URL where webhook notifications will be sent"}}},"WebhookEventType":{"type":"string","enum":["extracted","export","validation-success"]},"WebhookSubscriber":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of the webhook subscriber"},"event":{"description":"Event type that triggers the webhook","allOf":[{"$ref":"#/components/schemas/WebhookEventType"}]},"url":{"type":"string","description":"URL where webhook notifications will be sent"},"secret":{"type":"object","description":"Secret token used for HMAC signature generation"},"createdAt":{"format":"date-time","type":"string","description":"Timestamp when the webhook subscription was created"},"updatedAt":{"format":"date-time","type":"string","description":"Timestamp when the webhook subscription was last updated"}},"required":["id","event","url","secret","createdAt","updatedAt"]}}},"paths":{"/api/webhook/subscription/{id}":{"put":{"operationId":"WebhookController_updateSubscription","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberUpdateDto"}}}},"responses":{"200":{"description":"The updated webhook subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriber"}}}},"404":{"description":"Subscription not found"},"500":{"description":"Internal server error"}},"summary":"Update webhook subscription","tags":["Webhooks"]}}}}
```

## DELETE /api/webhook/subscription/{id}

> Delete webhook subscription

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Webhooks","description":"Webhook management and events"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"WebhookSubscriberDeleteResponseDto":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates if the delete operation was successful"}},"required":["success"]}}},"paths":{"/api/webhook/subscription/{id}":{"delete":{"operationId":"WebhookController_deleteSubscription","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Subscription successfully deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriberDeleteResponseDto"}}}},"404":{"description":"Subscription not found"},"500":{"description":"Internal server error"}},"summary":"Delete webhook subscription","tags":["Webhooks"]}}}}
```
