{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-created-webhook-response-schema.json",
  "title": "CreatedWebhookResponse",
  "description": "A new webhook, with its signing secret: the only time the secret is shown.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/logbrew-alerts-api-openapi.yml#/components/schemas/CreatedWebhookResponse",
  "properties": {
    "consecutive_failures": {
      "description": "Deliveries in a row that failed after their last attempt; 5 turn the webhook off.",
      "format": "uint32",
      "minimum": 0,
      "type": "integer"
    },
    "created_at": {
      "description": "When it was created.",
      "format": "date-time",
      "type": "string"
    },
    "disabled_at": {
      "description": "When it was turned off after failing deliveries, while it is off.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "events": {
      "description": "The events it takes.",
      "items": {
        "$ref": "#/$defs/WebhookEvent"
      },
      "type": "array"
    },
    "format": {
      "$ref": "#/$defs/WebhookFormat",
      "description": "Message format."
    },
    "id": {
      "description": "Webhook ID.",
      "format": "uuid",
      "type": "string"
    },
    "last_delivery": {
      "anyOf": [
        {
          "$ref": "#/$defs/WebhookDeliveryResponse"
        },
        {
          "type": "null"
        }
      ],
      "description": "The latest attempted delivery, including tests."
    },
    "locale": {
      "$ref": "#/$defs/WebsiteLocale",
      "description": "Message language."
    },
    "name": {
      "description": "Name; empty for none.",
      "type": "string"
    },
    "project_id": {
      "description": "Its project.",
      "format": "uuid",
      "type": "string"
    },
    "rule_ids": {
      "description": "The alert rules whose events it takes; all when empty.",
      "items": {
        "format": "uuid",
        "type": "string"
      },
      "type": "array"
    },
    "signing_secret": {
      "description": "Secret that signs generic deliveries (`whsec_` and base64); `null` for the other formats.",
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "$ref": "#/$defs/WebhookStatus",
      "description": "Whether it gets deliveries."
    },
    "updated_at": {
      "description": "When it last changed.",
      "format": "date-time",
      "type": "string"
    },
    "url_preview": {
      "description": "The URL's scheme and host; the full URL is never shown again.",
      "type": "string"
    }
  },
  "required": [
    "id",
    "project_id",
    "name",
    "format",
    "url_preview",
    "events",
    "rule_ids",
    "locale",
    "status",
    "disabled_at",
    "consecutive_failures",
    "last_delivery",
    "created_at",
    "updated_at",
    "signing_secret"
  ],
  "type": "object",
  "$defs": {
    "WebhookDeliveryError": {
      "description": "Why a delivery attempt failed.",
      "oneOf": [
        {
          "const": "timeout",
          "description": "The URL did not answer within 10 seconds.",
          "type": "string"
        },
        {
          "const": "connection",
          "description": "The connection or TLS handshake failed, or the host was not found.",
          "type": "string"
        },
        {
          "const": "blocked_address",
          "description": "The host resolved to a private, loopback, link-local, or other non-public address.",
          "type": "string"
        },
        {
          "const": "redirect",
          "description": "The URL answered with a redirect, which deliveries never follow.",
          "type": "string"
        },
        {
          "const": "http_status",
          "description": "The URL answered with a status outside 2xx; see `status_code`.",
          "type": "string"
        }
      ]
    },
    "WebhookDeliveryResponse": {
      "description": "One delivery of one event to a webhook.",
      "properties": {
        "attempts": {
          "description": "Attempts made, at most 6.",
          "format": "uint8",
          "maximum": 255,
          "minimum": 0,
          "type": "integer"
        },
        "created_at": {
          "description": "When the delivery was queued.",
          "format": "date-time",
          "type": "string"
        },
        "error": {
          "anyOf": [
            {
              "$ref": "#/$defs/WebhookDeliveryError"
            },
            {
              "type": "null"
            }
          ],
          "description": "Why the last attempt failed, if it did."
        },
        "event": {
          "$ref": "#/$defs/WebhookEvent",
          "description": "The event."
        },
        "id": {
          "description": "Delivery ID, also sent as the `webhook-id` header and the generic payload's `id`; it stays\nthe same across retries.",
          "format": "uuid",
          "type": "string"
        },
        "issue_id": {
          "description": "The issue, if the event is about one.",
          "format": "uuid",
          "type": [
            "string",
            "null"
          ]
        },
        "last_attempt_at": {
          "description": "When the last attempt was made.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "next_attempt_at": {
          "description": "When the next attempt is due, while pending.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "occurred_at": {
          "description": "When the event happened.",
          "format": "date-time",
          "type": "string"
        },
        "rule_id": {
          "description": "The alert rule, for an alert rule event.",
          "format": "uuid",
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "$ref": "#/$defs/WebhookDeliveryState",
          "description": "Where it is."
        },
        "status_code": {
          "description": "HTTP status of the last attempt, if the URL answered.",
          "format": "uint16",
          "maximum": 65535,
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "event",
        "issue_id",
        "rule_id",
        "state",
        "attempts",
        "status_code",
        "error",
        "occurred_at",
        "created_at",
        "last_attempt_at",
        "next_attempt_at"
      ],
      "type": "object"
    },
    "WebhookDeliveryState": {
      "description": "Where a delivery is.",
      "oneOf": [
        {
          "const": "pending",
          "description": "Waiting for its next attempt.",
          "type": "string"
        },
        {
          "const": "delivered",
          "description": "The URL answered with a 2xx status.",
          "type": "string"
        },
        {
          "const": "failed",
          "description": "Its last attempt failed.",
          "type": "string"
        },
        {
          "const": "skipped",
          "description": "Not sent: the webhook was paused, turned off, or removed, or no longer takes the event.",
          "type": "string"
        }
      ]
    },
    "WebhookEvent": {
      "description": "An event a webhook can take, and the event of a test delivery.",
      "oneOf": [
        {
          "const": "new_issue",
          "description": "A new issue appeared.",
          "type": "string"
        },
        {
          "const": "regressed_issue",
          "description": "A resolved issue happened again.",
          "type": "string"
        },
        {
          "const": "reopened_issue",
          "description": "A resolved or archived issue opened again.",
          "type": "string"
        },
        {
          "const": "assigned_issue",
          "description": "An issue was assigned.",
          "type": "string"
        },
        {
          "const": "alert_rule",
          "description": "One of the project's alert rules fired.",
          "type": "string"
        },
        {
          "const": "usage_warning",
          "description": "The project owner's account used 80% of a plan limit.",
          "type": "string"
        },
        {
          "const": "usage_limit",
          "description": "The project owner's account reached a plan limit.",
          "type": "string"
        },
        {
          "const": "test",
          "description": "A test sent on request; a webhook cannot subscribe to it.",
          "type": "string"
        }
      ]
    },
    "WebhookFormat": {
      "description": "How a webhook formats its events.",
      "oneOf": [
        {
          "const": "generic",
          "description": "JSON signed with HMAC-SHA256 in the `webhook-signature` header.",
          "type": "string"
        },
        {
          "const": "slack",
          "description": "A Slack incoming webhook message.",
          "type": "string"
        },
        {
          "const": "discord",
          "description": "A Discord webhook message.",
          "type": "string"
        },
        {
          "const": "teams",
          "description": "A Microsoft Teams workflow message with an Adaptive Card.",
          "type": "string"
        }
      ]
    },
    "WebhookStatus": {
      "description": "Whether a webhook gets deliveries.",
      "oneOf": [
        {
          "const": "active",
          "description": "It gets deliveries.",
          "type": "string"
        },
        {
          "const": "paused",
          "description": "The project paused it.",
          "type": "string"
        },
        {
          "const": "disabled",
          "description": "Turned off after its deliveries kept failing.",
          "type": "string"
        }
      ]
    },
    "WebsiteLocale": {
      "description": "A Website locale: the language of an invitation email and the path segment of its link.",
      "oneOf": [
        {
          "const": "en",
          "description": "English.",
          "type": "string"
        },
        {
          "const": "tr",
          "description": "Turkish.",
          "type": "string"
        },
        {
          "const": "de",
          "description": "German.",
          "type": "string"
        },
        {
          "const": "es",
          "description": "Spanish.",
          "type": "string"
        },
        {
          "const": "ja",
          "description": "Japanese.",
          "type": "string"
        },
        {
          "const": "fr",
          "description": "French.",
          "type": "string"
        },
        {
          "const": "pt-BR",
          "description": "Brazilian Portuguese.",
          "type": "string"
        },
        {
          "const": "it",
          "description": "Italian.",
          "type": "string"
        },
        {
          "const": "nl",
          "description": "Dutch.",
          "type": "string"
        },
        {
          "const": "vi",
          "description": "Vietnamese.",
          "type": "string"
        },
        {
          "const": "zh-Hans",
          "description": "Simplified Chinese.",
          "type": "string"
        },
        {
          "const": "ko",
          "description": "Korean.",
          "type": "string"
        },
        {
          "const": "id",
          "description": "Indonesian.",
          "type": "string"
        },
        {
          "const": "pl",
          "description": "Polish.",
          "type": "string"
        },
        {
          "const": "ar",
          "description": "Arabic.",
          "type": "string"
        }
      ]
    }
  }
}