{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eusend-dev/json-schema/eusend-dev-webhook-with-deliveries-schema.json",
  "title": "WebhookWithDeliveries",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eusend-dev-webhooks-api-openapi.yml#/components/schemas/WebhookWithDeliveries",
  "allOf": [
    {
      "$ref": "#/$defs/Webhook"
    },
    {
      "type": "object",
      "required": [
        "deliveries"
      ],
      "properties": {
        "deliveries": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WebhookDelivery"
          }
        }
      }
    }
  ],
  "$defs": {
    "Webhook": {
      "type": "object",
      "required": [
        "id",
        "url",
        "events",
        "createdAt"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "email.sent",
              "email.delivered",
              "email.bounced",
              "email.complained",
              "email.opened",
              "email.clicked",
              "email.failed",
              "email.suppressed",
              "*"
            ]
          }
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "WebhookDelivery": {
      "type": "object",
      "required": [
        "id",
        "webhookId",
        "eventType",
        "status",
        "attempts",
        "createdAt"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "webhookId": {
          "type": "string",
          "format": "uuid"
        },
        "emailId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "eventType": {
          "type": "string"
        },
        "payload": {
          "type": "object",
          "additionalProperties": true
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "success",
            "failed"
          ]
        },
        "responseStatus": {
          "type": [
            "integer",
            "null"
          ]
        },
        "attempts": {
          "type": "integer"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "lastAttemptAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    }
  }
}