{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/clearstreet8e71/json-schema/clearstreet8e71-create-thread-request-schema.json",
  "title": "CreateThreadRequest",
  "description": "Create-thread request body.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/clearstreet8e71-omni-ai-api-openapi.yml#/components/schemas/CreateThreadRequest",
  "type": "object",
  "required": [
    "type"
  ],
  "properties": {
    "account_id": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "Selected account for creation or the first account-linked turn. Omit for an unlinked conversation.\nAn existing account link remains authoritative even when another account is selected.",
      "minimum": 1
    },
    "capabilities": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Capability"
      }
    },
    "context": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/TurnContext",
          "description": "Snapshots for the first instant-chat message. Omit to attach no new context."
        }
      ]
    },
    "target": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/DeepInsightsTarget"
        }
      ]
    },
    "text": {
      "type": [
        "string",
        "null"
      ]
    },
    "thesis": {
      "type": [
        "string",
        "null"
      ]
    },
    "type": {
      "$ref": "#/$defs/ConversationMode"
    }
  },
  "$defs": {
    "Capability": {
      "type": "string",
      "description": "Capability allowlist for structured actions.\n\nClients declare which capabilities they support when starting a run.\nOmni AI will only emit structured actions that match the declared capabilities.",
      "enum": [
        "PREFILL_ORDER",
        "OPEN_CHART",
        "OPEN_SCREENER",
        "OPEN_ENTITLEMENT_CONSENT"
      ]
    },
    "ContextItem": {
      "type": "object",
      "description": "A snapshot of the widget the user asks about.",
      "required": [
        "kind",
        "label",
        "data"
      ],
      "properties": {
        "captured_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Client-reported snapshot time. Omit when unknown."
        },
        "data": {
          "type": "object",
          "description": "Relevant widget data, selections, and units. Use strings for exact decimals and large IDs.",
          "additionalProperties": true
        },
        "kind": {
          "type": "string",
          "description": "Nonblank descriptive kind. New kinds do not require a backend release.",
          "minLength": 1
        },
        "label": {
          "type": "string",
          "description": "Nonblank attachment label for conversation rendering.",
          "minLength": 1
        }
      }
    },
    "ConversationMode": {
      "type": "string",
      "description": "Thread creation mode.",
      "enum": [
        "instant",
        "deep_insights"
      ]
    },
    "DeepInsightsTarget": {
      "type": "object",
      "description": "Deep-insights target payload.",
      "required": [
        "type",
        "ticker"
      ],
      "properties": {
        "ticker": {
          "type": "string"
        },
        "type": {
          "$ref": "#/$defs/DeepInsightsTargetType"
        }
      }
    },
    "DeepInsightsTargetType": {
      "type": "string",
      "description": "Deep-insights target type. Launch supports ticker-only.",
      "enum": [
        "ticker"
      ]
    },
    "TurnContext": {
      "type": "object",
      "description": "Client snapshots attached to one instant-chat user message.\n\nContext is separate from visible message text and does not grant account access.\nThe compact JSON representation must not exceed 64 KiB.",
      "required": [
        "items"
      ],
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContextItem"
          },
          "description": "One to four snapshots. Each snapshot's data may contain at most 32 levels of nesting.",
          "maxItems": 4,
          "minItems": 1
        }
      }
    }
  }
}