{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/measure-sh/json-schema/measure-sh-funnel-schema.json",
  "title": "Funnel",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dashboard.yaml#/components/schemas/Funnel",
  "type": "object",
  "required": [
    "id",
    "app_id",
    "name",
    "steps",
    "conversion_window_seconds",
    "pinned",
    "pin_order",
    "created_by",
    "created_by_email",
    "created_at",
    "updated_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "app_id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "steps": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FunnelStepEvent"
      }
    },
    "conversion_window_seconds": {
      "type": "integer"
    },
    "pinned": {
      "type": "boolean"
    },
    "pin_order": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Sorts the app's pinned funnels, lowest first. Null when the funnel is not pinned."
    },
    "created_by": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Id of the user that created the funnel. Null when that user no longer exists."
    },
    "created_by_email": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "FunnelStepEvent": {
      "type": "object",
      "required": [
        "event_name"
      ],
      "properties": {
        "event_name": {
          "type": "string",
          "description": "Name of a custom event."
        }
      }
    }
  }
}