{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agilehero-io/json-schema/agilehero-io-webhook-event-schema.json",
  "title": "WebhookEvent",
  "description": "The body of every webhook request. `data` holds the affected resource under its name (`card`, `comment`, `epic`, `list`, `label`, `checklist_item`, `user`, `project`), plus a related one where the type implies it (`card.label_added` adds `label`, `card.assigned` adds `user`). Rich-text bodies are never included (`description_present` flags them).",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agilehero-io-openapi.yml#/components/schemas/WebhookEvent",
  "type": "object",
  "required": [
    "id",
    "type",
    "occurred_at",
    "origin",
    "workspace",
    "project",
    "actor",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "The event id — also the `webhook-id` header."
    },
    "type": {
      "type": "string",
      "enum": [
        "card.created",
        "card.updated",
        "card.moved",
        "card.deleted",
        "comment.created",
        "comment.updated",
        "comment.deleted",
        "epic.created",
        "epic.updated",
        "epic.deleted",
        "list.created",
        "list.updated",
        "list.deleted",
        "label.created",
        "label.updated",
        "label.deleted",
        "card.label_added",
        "card.label_removed",
        "card.assigned",
        "card.unassigned",
        "epic.assigned",
        "epic.unassigned",
        "checklist_item.created",
        "checklist_item.updated",
        "checklist_item.deleted",
        "project.member_added",
        "project.member_removed",
        "workspace.member_removed"
      ]
    },
    "occurred_at": {
      "type": "string",
      "format": "date-time"
    },
    "origin": {
      "type": "string",
      "enum": [
        "web",
        "mcp",
        "slack",
        "github",
        "api"
      ]
    },
    "workspace": {
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "type": "string"
        }
      }
    },
    "project": {
      "$ref": "#/$defs/NullableReference"
    },
    "actor": {
      "$ref": "#/$defs/NullableReference"
    },
    "data": {
      "type": "object",
      "additionalProperties": true
    },
    "changes": {
      "type": "object",
      "description": "On `*.updated` and `card.moved` only: each changed field as `{ from, to }`, or `{ changed: true }` for a rich-text body.",
      "additionalProperties": true
    }
  },
  "$defs": {
    "NullableReference": {
      "type": [
        "object",
        "null"
      ],
      "description": "A reference, or null (a card's list is null in the backlog; its epic when it has none).",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    }
  }
}