{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/relaystation-ai/json-schema/relaystation-ai-v1-webhook-schema.json",
  "title": "V1Webhook",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/relaystation-ai-api-openapi.json#/components/schemas/V1Webhook",
  "type": "object",
  "required": [
    "id",
    "url",
    "events",
    "active",
    "createdAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WebhookEventName"
      }
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "active": {
      "type": "boolean"
    },
    "consecutiveFailures": {
      "type": "integer"
    },
    "secret": {
      "type": "string",
      "description": "Returned ONCE on POST /v1/webhooks. Subsequent reads omit."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "WebhookEventName": {
      "type": "string",
      "enum": [
        "baton.written",
        "token.used",
        "token.exhausted",
        "pass.all_tokens_consumed",
        "bridge.ask.replied",
        "envelope.sent",
        "envelope.viewed",
        "envelope.signed",
        "envelope.completed",
        "envelope.rejected",
        "envelope.expired",
        "envelope.cancelled",
        "verification.started",
        "verification.document_processed",
        "verification.age_check",
        "verification.manual_review",
        "verification.completed",
        "verification.failed",
        "verification.expired",
        "job.completed"
      ],
      "description": "A webhook event type from the live allowlist (GET /v1/webhooks/events)."
    }
  }
}