{
  "$defs": {
    "WebhookEventType": {
      "enum": [
        "run.succeeded",
        "run.failed",
        "model.version.ready",
        "endpoint.promoted",
        "score.completed",
        "tenant.deletion.completed",
        "workflow.run.succeeded",
        "workflow.run.failed",
        "model.validation.checks_passed",
        "model.validation.checks_failed",
        "model.validation.awaiting_approval",
        "model.validated",
        "model.rejected",
        "model.deprecated",
        "dataset.version.created",
        "optimize.completed"
      ],
      "title": "WebhookEventType",
      "type": "string"
    }
  },
  "$id": "https://schemas.mapi.dev/v1/api-WebhookCreate.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "``POST /v1/webhooks``: the secret is generated by the server and shown once.\n\nThe server applies the SSRF policy to ``url`` (:func:`check_webhook_url`, then\n:func:`check_resolved_addresses` at every delivery): ``422 WEBHOOK_URL_BLOCKED``.",
  "examples": [
    {
      "description": "Notify the planning service",
      "events": [
        "run.succeeded",
        "run.failed",
        "endpoint.promoted"
      ],
      "url": "https://hooks.example.com/mapi"
    }
  ],
  "properties": {
    "active": {
      "default": true,
      "title": "Active",
      "type": "boolean"
    },
    "description": {
      "anyOf": [
        {
          "maxLength": 500,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Description"
    },
    "events": {
      "items": {
        "$ref": "#/$defs/WebhookEventType"
      },
      "maxItems": 16,
      "minItems": 1,
      "title": "Events",
      "type": "array"
    },
    "url": {
      "maxLength": 2048,
      "minLength": 9,
      "title": "Url",
      "type": "string"
    }
  },
  "required": [
    "url",
    "events"
  ],
  "title": "WebhookCreate",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
