{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/frihet-io/json-schema/frihet-io-webhook-schema.json",
  "title": "Webhook",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/frihet-io-webhooks-api-openapi.yml#/components/schemas/Webhook",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "userId": {
          "type": "string"
        },
        "hasSecret": {
          "type": "boolean",
          "description": "True if an HMAC secret is configured. The secret value itself is never returned by read endpoints."
        }
      }
    },
    {
      "$ref": "#/$defs/WebhookCreate"
    }
  ],
  "$defs": {
    "WebhookCreate": {
      "type": "object",
      "required": [
        "name",
        "url",
        "events"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Webhook name",
          "maxLength": 200
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Endpoint URL to receive webhook events",
          "maxLength": 2000
        },
        "secret": {
          "type": "string",
          "description": "HMAC secret for verifying webhook signatures. Write-only: echoed once in the create response, never returned by read endpoints (see hasSecret).",
          "maxLength": 500
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 100,
            "x-enum-ref": "#/components/schemas/WebhookEventType"
          },
          "minItems": 1,
          "description": "List of event types to subscribe to"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "inactive"
          ],
          "default": "active"
        },
        "metadata": {
          "type": "object",
          "additionalProperties": true,
          "description": "Arbitrary metadata to attach to the webhook"
        }
      }
    }
  }
}