{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/infiniteaudience-ai/json-schema/infiniteaudience-ai-webhook-subscription-schema.json",
  "title": "WebhookSubscription",
  "description": "A durable event-trigger subscription (e.g. a Zap that is turned on). Delivery is retried with exponential backoff; see the Triggers tag for the ownership model.\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/infiniteaudience-ai-triggers-api-openapi.yml#/components/schemas/WebhookSubscription",
  "type": "object",
  "required": [
    "id",
    "target_url",
    "events",
    "status",
    "created_at",
    "created_by",
    "last_delivery_at",
    "consecutive_failure_count"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "target_url": {
      "type": "string",
      "format": "uri"
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/NotifiableEventType"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "disabled",
        "revoked"
      ],
      "description": "\"disabled\" is set automatically after 20 consecutive dead-lettered deliveries; \"revoked\" is explicit — owner action, disconnecting the partnership, or the target endpoint itself returning 410 Gone.\n"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_by": {
      "type": "string",
      "description": "Identifier of the creating caller."
    },
    "last_delivery_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "consecutive_failure_count": {
      "type": "integer",
      "description": "Resets to 0 on any successful delivery; reaching 20 auto-disables the subscription."
    }
  },
  "$defs": {
    "NotifiableEventType": {
      "type": "string",
      "description": "Events that can trigger a webhook delivery. Segment and delivery events support ordinary durable subscriptions and the org's legacy webhook. Partnership events are restricted to the owning OAuth grant and are never sent to an org-wide webhook.\n",
      "enum": [
        "enrichment.release.available",
        "segment.ready",
        "segment.failed",
        "delivery.completed",
        "delivery.failed",
        "integration.enrichment.prepared",
        "integration.enrichment.failed",
        "integration.enrichment.blocked",
        "integration.file.ready",
        "integration.file.failed"
      ]
    }
  }
}