{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/honkio-ca/json-schema/honkio-ca-webhook-schema.json",
  "title": "Webhook",
  "description": "A registered webhook endpoint. The signing secret is shown once, at creation or rotation.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/honkio-ca-webhooks-api-openapi.yml#/components/schemas/Webhook",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "id",
    "url",
    "events",
    "active",
    "deactivated_reason",
    "deactivated_at",
    "failing_since",
    "failed_events",
    "last_success_at",
    "last_failure_at",
    "last_failure_reason",
    "secret_rotated_at",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "url": {
      "type": "string"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "An event name, e.g. message.delivered or phone_number.suspended."
      }
    },
    "active": {
      "type": "boolean"
    },
    "deactivated_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Why delivery disabled the endpoint, when it did: e.g. \"HTTP_401 for 26h across 7 events\" after 24 hours of failure across at least 5 events, or SSRF_BLOCKED."
    },
    "deactivated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "failing_since": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "The first failed attempt since the last successful delivery; null while the endpoint is healthy. Any delivered attempt clears it."
    },
    "failed_events": {
      "type": "integer",
      "description": "Distinct events that have failed since failing_since. The endpoint is disabled once every attempt has failed for 24 hours and this reaches 5."
    },
    "last_success_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "The last delivered attempt, to within a minute."
    },
    "last_failure_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "last_failure_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "The last failed attempt's result: HTTP_<status>, HTTP_<status>_REDIRECT_NOT_FOLLOWED, TIMEOUT or NETWORK_ERROR."
    },
    "secret_rotated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the signing secret was last rotated (POST /v1/webhooks/{id}/rotate-secret); null while the endpoint still signs with the secret it was created with."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}