{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cherami-to/json-schema/cherami-to-webhook-schema.json",
  "title": "Webhook",
  "description": "status is active (delivering), disabled (not delivering until you set enabled to true; you or repeated delivery failures turned it off), pending (creation or removal not yet confirmed; read it again shortly) or unknown (the configuration couldn't be read and its fields are null; if it stays unknown, delete the webhook and add it again). pending_operation names the unconfirmed work.",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cherami-to-openapi.yml#/components/schemas/Webhook",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Cherami resource ID."
    },
    "created_at": {
      "type": "string",
      "description": "UTC timestamp with milliseconds.",
      "format": "date-time",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Destination URL; null while status is pending or unknown."
    },
    "event_types": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WebhookEventType"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "inbox_ids": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "string",
            "description": "Cherami resource ID."
          }
        },
        {
          "type": "null"
        }
      ],
      "description": "Scoped inboxes; empty means every inbox."
    },
    "deleted_inbox_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "Cherami resource ID."
      },
      "description": "Scoped inboxes that have since been deleted. They match nothing; edit inbox_ids to remove them."
    },
    "enabled": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ]
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string",
          "description": "UTC timestamp with milliseconds.",
          "format": "date-time",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "disabled",
        "pending",
        "unknown"
      ]
    },
    "pending_operation": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "create",
                "delete",
                "rotate"
              ]
            },
            "started_at": {
              "type": "string",
              "description": "UTC timestamp with milliseconds.",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            }
          },
          "required": [
            "kind",
            "started_at"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "secret_rotated_at": {
      "anyOf": [
        {
          "type": "string",
          "description": "UTC timestamp with milliseconds.",
          "format": "date-time",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
        },
        {
          "type": "null"
        }
      ]
    },
    "previous_secret_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "description": "UTC timestamp with milliseconds.",
          "format": "date-time",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "created_at",
    "url",
    "event_types",
    "inbox_ids",
    "deleted_inbox_ids",
    "enabled",
    "updated_at",
    "status",
    "pending_operation",
    "secret_rotated_at",
    "previous_secret_expires_at"
  ],
  "$defs": {
    "WebhookEventType": {
      "type": "string",
      "enum": [
        "message.received",
        "message.sent"
      ],
      "description": "message.received: a received message is ready to read. message.sent: the provider accepted a sent message, which is not delivery."
    }
  }
}