{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lune/json-schema/lune-webhook-schema.json",
  "title": "Webhook",
  "description": "You can configure webhook endpoints via the API to be notified about events that occur in your accounts or client accounts.\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lune-webhooks-api-openapi.yml#/components/schemas/Webhook",
  "allOf": [
    {
      "$ref": "#/$defs/WebhookBase"
    },
    {
      "type": "object",
      "required": [
        "secret"
      ],
      "properties": {
        "secret": {
          "description": "The last 4 characters of the secret key used to generate the webhook payload HMAC.",
          "type": "string"
        }
      }
    }
  ],
  "$defs": {
    "AccountType": {
      "type": "string",
      "description": "The account's type.\n",
      "enum": [
        "live",
        "test"
      ]
    },
    "Timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "An <a href=\"https://pretty-rfc.herokuapp.com/RFC3339\">RFC 3339</a>-formatted timestamp."
    },
    "Url": {
      "type": "string",
      "format": "https-url",
      "description": "An HTTPS URL.\n\nThe URL must match the following regular expression: `^https:\\/\\/[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&\\/\\/=]*)$`\n"
    },
    "WebhookBase": {
      "type": "object",
      "required": [
        "id",
        "url",
        "enabled",
        "account_type",
        "created_at"
      ],
      "properties": {
        "id": {
          "description": "The webhook's unique identifier",
          "type": "string"
        },
        "url": {
          "$ref": "#/$defs/Url"
        },
        "enabled": {
          "description": "Determines if events should be sent to the webhook or not.",
          "type": "boolean"
        },
        "account_type": {
          "description": "For events related to an account, this property refers to the accounts' type.\n\nA webhook does not mix live and test events.\n",
          "$ref": "#/$defs/AccountType"
        },
        "account_ids": {
          "description": "The webhook will exclusively push events which belong to account identifiers.\n\nActs as a filter: if not set, events belonging to all the organisation's accounts are pushed.\n",
          "type": "array",
          "items": {
            "type": "string",
            "description": "An account's unique identifier"
          }
        },
        "created_at": {
          "description": "The webhook's creation timestamp.",
          "$ref": "#/$defs/Timestamp"
        }
      }
    }
  }
}