{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/clearstreet8e71/json-schema/clearstreet8e71-message-schema.json",
  "title": "Message",
  "description": "Final immutable message.",
  "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/Message",
  "type": "object",
  "required": [
    "id",
    "thread_id",
    "created_at",
    "seq",
    "role",
    "outcome",
    "content"
  ],
  "properties": {
    "content": {
      "$ref": "#/$defs/MessageContent"
    },
    "context": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/TurnContext",
          "description": "Immutable snapshots attached to this user message. Omitted when none were supplied.\nWhen a null/undefined value is observed, it indicates that there is no available data."
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "error": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/ErrorStatus",
          "description": "When a null/undefined value is observed, it indicates it does not apply."
        }
      ]
    },
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "outcome": {
      "$ref": "#/$defs/MessageOutcome"
    },
    "role": {
      "$ref": "#/$defs/MessageRole"
    },
    "seq": {
      "type": "integer",
      "format": "int64"
    },
    "thread_id": {
      "type": "string",
      "format": "uuid"
    }
  },
  "$defs": {
    "ActionButton": {
      "type": "object",
      "description": "Button metadata shared by chart and suggested-actions payloads.",
      "required": [
        "buttonId",
        "label"
      ],
      "properties": {
        "buttonId": {
          "type": "string",
          "description": "Stable button identifier within the content part."
        },
        "itemId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Interaction-tracking identity. Absent on messages created before tracking.\nWhen a null/undefined value is observed, it indicates that there is no available data."
        },
        "label": {
          "type": "string",
          "description": "User-visible label."
        },
        "prompt": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/PromptButtonAction",
              "description": "Follow-up prompt to submit as the next user message.\nWhen a null/undefined value is observed, it indicates it does not apply."
            }
          ]
        },
        "structuredAction": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/StructuredActionButtonAction",
              "description": "Structured action in the same message to execute on click.\nWhen a null/undefined value is observed, it indicates it does not apply."
            }
          ]
        }
      }
    },
    "ChartPayload": {
      "type": "object",
      "description": "Typed chart payload rendered inline in assistant content.",
      "required": [
        "chartId",
        "clicked"
      ],
      "properties": {
        "actionButtons": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ActionButton"
          },
          "description": "Buttons associated with this chart."
        },
        "chartId": {
          "type": "string",
          "description": "Stable chart identifier scoped to the content part."
        },
        "clicked": {
          "type": "boolean",
          "description": "Whether the current user clicked this chart."
        },
        "dataChart": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/DataChart",
              "description": "Explicit series-driven chart definition.\nWhen a null/undefined value is observed, it indicates it does not apply."
            }
          ]
        },
        "itemId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Interaction-tracking identity. Absent on messages created before tracking.\nWhen a null/undefined value is observed, it indicates that there is no available data."
        }
      }
    },
    "ChartPoint": {
      "type": "object",
      "description": "Single chart coordinate.",
      "required": [
        "x",
        "y"
      ],
      "properties": {
        "x": {
          "type": "string"
        },
        "y": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "ChartSeries": {
      "type": "object",
      "description": "Named data series within a chart.",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "points": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChartPoint"
          }
        }
      }
    },
    "ContentPartChartPayload": {
      "type": "object",
      "description": "Chart payload content part.",
      "required": [
        "payload"
      ],
      "properties": {
        "payload": {
          "$ref": "#/$defs/ChartPayload"
        }
      }
    },
    "ContentPartCustomPayload": {
      "type": "object",
      "description": "Escape-hatch custom payload content part.",
      "required": [
        "payload"
      ],
      "properties": {
        "payload": {
          "type": "object"
        }
      }
    },
    "ContentPartStructuredActionPayload": {
      "type": "object",
      "description": "Structured action content part.",
      "required": [
        "action_id",
        "clicked",
        "action"
      ],
      "properties": {
        "action": {
          "$ref": "#/$defs/StructuredAction"
        },
        "action_id": {
          "type": "string",
          "format": "uuid"
        },
        "clicked": {
          "type": "boolean",
          "description": "Whether the current user clicked this action."
        },
        "clicked_item_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "description": "IDs of nested items clicked by the current user."
        },
        "item_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Interaction-tracking identity. Absent on messages created before tracking.\nWhen a null/undefined value is observed, it indicates that there is no available data."
        }
      }
    },
    "ContentPartSuggestedActionsPayload": {
      "type": "object",
      "description": "Suggested actions payload content part.",
      "required": [
        "payload"
      ],
      "properties": {
        "payload": {
          "$ref": "#/$defs/SuggestedActionsPayload"
        }
      }
    },
    "ContentPartTextPayload": {
      "type": "object",
      "description": "Text content part.",
      "required": [
        "text"
      ],
      "properties": {
        "text": {
          "type": "string"
        }
      }
    },
    "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
        }
      }
    },
    "DataChart": {
      "type": "object",
      "description": "Chart represented by explicit data series.",
      "properties": {
        "series": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChartSeries"
          }
        }
      }
    },
    "EntitlementAgreementKey": {
      "type": "string",
      "description": "Stable entitlement agreement family key.",
      "enum": [
        "omni_account_data_access"
      ]
    },
    "EntitlementCode": {
      "type": "string",
      "description": "Stable entitlement code granted by an agreement.",
      "enum": [
        "omni.account_data"
      ]
    },
    "ErrorStatus": {
      "type": "object",
      "description": "Shared sanitized error payload.",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "details": {
          "type": [
            "object",
            "null"
          ],
          "description": "When a null/undefined value is observed, it indicates it does not apply."
        },
        "message": {
          "type": "string"
        }
      }
    },
    "InstrumentIdOrSymbol": {
      "type": "string",
      "description": "Instrument identifier: either an instrument UUID or a symbol (symbol for equities, OSI for options). Non-UUID inputs are resolved server-side.",
      "minLength": 1
    },
    "MessageContent": {
      "type": "object",
      "description": "Finalized immutable message content container. Never includes thinking parts.",
      "required": [
        "parts"
      ],
      "properties": {
        "parts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MessageContentPart"
          }
        }
      }
    },
    "MessageContentPart": {
      "oneOf": [
        {
          "allOf": [
            {
              "$ref": "#/$defs/ContentPartTextPayload"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text"
                  ]
                }
              }
            }
          ],
          "title": "ContentPartText"
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/ContentPartStructuredActionPayload"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "structured_action"
                  ]
                }
              }
            }
          ],
          "title": "ContentPartStructuredAction"
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/ContentPartChartPayload"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "chart"
                  ]
                }
              }
            }
          ],
          "title": "ContentPartChart"
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/ContentPartSuggestedActionsPayload"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "suggested_actions"
                  ]
                }
              }
            }
          ],
          "title": "ContentPartSuggestedActions"
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/ContentPartCustomPayload"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "custom"
                  ]
                }
              }
            }
          ],
          "title": "ContentPartCustom"
        }
      ],
      "description": "Final immutable content part visible on persisted messages."
    },
    "MessageOutcome": {
      "type": "string",
      "description": "Immutable terminal outcome for a finalized assistant message.",
      "enum": [
        "completed",
        "errored",
        "canceled"
      ]
    },
    "MessageRole": {
      "type": "string",
      "description": "Finalized message role in the public contract.",
      "enum": [
        "USER",
        "ASSISTANT"
      ]
    },
    "OpenChartAction": {
      "type": "object",
      "description": "Action to open a chart for a symbol.",
      "required": [
        "symbol"
      ],
      "properties": {
        "extras": {
          "type": "object",
          "description": "Additional chart configuration (indicators, overlays, etc.)\nWhen a null/undefined value is observed, it indicates it does not apply."
        },
        "item_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Interaction-tracking identity. Absent on messages created before tracking.\nWhen a null/undefined value is observed, it indicates that there is no available data."
        },
        "symbol": {
          "type": "string",
          "description": "Trading symbol to chart"
        },
        "timeframe": {
          "type": [
            "string",
            "null"
          ],
          "description": "Chart timeframe (e.g., \"1D\", \"1W\", \"1M\", \"3M\", \"1Y\", \"5Y\")\nWhen a null/undefined value is observed, it indicates it does not apply."
        }
      }
    },
    "OpenEntitlementConsentAction": {
      "type": "object",
      "description": "Action to open entitlement consent flow for one or more accounts.",
      "required": [
        "agreement_key",
        "account_ids",
        "entitlement_codes",
        "reason"
      ],
      "properties": {
        "account_ids": {
          "type": "array",
          "items": {
            "type": "integer",
            "format": "int64"
          }
        },
        "agreement_key": {
          "$ref": "#/$defs/EntitlementAgreementKey"
        },
        "entitlement_codes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EntitlementCode"
          }
        },
        "item_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Interaction-tracking identity. Absent on messages created before tracking.\nWhen a null/undefined value is observed, it indicates that there is no available data."
        },
        "reason": {
          "type": "string"
        }
      }
    },
    "OpenScreenerAction": {
      "type": "object",
      "description": "Action to open a stock screener with filters.",
      "required": [
        "filters"
      ],
      "properties": {
        "columns": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          },
          "description": "Optional field/column selection for screener results.\nWhen a null/undefined value is observed, it indicates it does not apply."
        },
        "filters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScreenerFilter"
          },
          "description": "Filter criteria for the screener"
        },
        "item_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Interaction-tracking identity. Absent on messages created before tracking.\nWhen a null/undefined value is observed, it indicates that there is no available data."
        },
        "page_size": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32",
          "description": "Optional page size.\nWhen a null/undefined value is observed, it indicates it does not apply."
        },
        "sort_by": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional sort field for screener rows.\nWhen a null/undefined value is observed, it indicates it does not apply."
        },
        "sort_direction": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional sort direction (`ASC` or `DESC`).\nWhen a null/undefined value is observed, it indicates it does not apply."
        }
      }
    },
    "OrderStrategy": {
      "oneOf": [
        {
          "type": "object",
          "description": "Smart Order Router. Routes the order to the best available venue(s).",
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "description": "Execution strategy type.",
              "enum": [
                "SOR"
              ]
            }
          }
        },
        {
          "type": "object",
          "description": "Volume-Weighted Average Price. Works the order to track the volume-weighted average price over the execution window.",
          "required": [
            "type"
          ],
          "properties": {
            "end_at": {
              "type": "string",
              "format": "date-time",
              "description": "UTC timestamp (RFC 3339) by which to finish working the order. Defaults to market close."
            },
            "start_at": {
              "type": "string",
              "format": "date-time",
              "description": "UTC timestamp (RFC 3339) at which to begin working the order. Defaults to the time the order is received."
            },
            "type": {
              "type": "string",
              "description": "Execution strategy type.",
              "enum": [
                "VWAP"
              ]
            }
          }
        },
        {
          "type": "object",
          "description": "Time-Weighted Average Price. Spreads execution evenly across the execution window.",
          "required": [
            "type"
          ],
          "properties": {
            "end_at": {
              "type": "string",
              "format": "date-time",
              "description": "UTC timestamp (RFC 3339) by which to finish working the order. Defaults to market close."
            },
            "start_at": {
              "type": "string",
              "format": "date-time",
              "description": "UTC timestamp (RFC 3339) at which to begin working the order. Defaults to the time the order is received."
            },
            "type": {
              "type": "string",
              "description": "Execution strategy type.",
              "enum": [
                "TWAP"
              ]
            }
          }
        },
        {
          "type": "object",
          "description": "Direct Market Access. Routes the order straight to the named venue.",
          "required": [
            "type",
            "destination"
          ],
          "properties": {
            "destination": {
              "type": "string",
              "description": "Venue code the order is routed to."
            },
            "type": {
              "type": "string",
              "description": "Execution strategy type.",
              "enum": [
                "DMA"
              ]
            }
          }
        }
      ],
      "description": "Optional execution strategy controlling how the order is worked in the market. Omit to use standard routing. One of `SOR`, `VWAP`, `TWAP`, or `DMA`."
    },
    "PrefillCancelOrderAction": {
      "type": "object",
      "description": "Cancel-order prefill action.",
      "required": [
        "orders"
      ],
      "properties": {
        "orders": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PrefillCancelOrderRequest"
          },
          "description": "Orders to cancel using the same identifiers required by the cancel-order API."
        }
      }
    },
    "PrefillCancelOrderRequest": {
      "allOf": [
        {
          "oneOf": [
            {
              "type": "object",
              "description": "Request to cancel an existing order\n\nNote: In the API, order cancellation is done via DELETE request without a body.\nThe order_id and account_id come from the URL path parameters.",
              "required": [
                "order_id",
                "account_id"
              ],
              "properties": {
                "account_id": {
                  "$ref": "#/$defs/i64",
                  "description": "Account ID (from path parameter)"
                },
                "order_id": {
                  "type": "string",
                  "description": "Order ID to cancel (from path parameter)"
                }
              }
            }
          ],
          "description": "Cancellation target, flattened for the frontend."
        },
        {
          "type": "object",
          "properties": {
            "item_id": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid",
              "description": "Interaction-tracking identity. Absent on messages created before tracking.\nWhen a null/undefined value is observed, it indicates that there is no available data."
            }
          }
        }
      ],
      "description": "One cancellation emitted as part of an Omni prefill action."
    },
    "PrefillModifyOrderAction": {
      "type": "object",
      "description": "Modify-order prefill action.",
      "required": [
        "orders"
      ],
      "properties": {
        "orders": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PrefillModifyOrderRequest"
          },
          "description": "Modification targets and deltas needed to construct replace-order API requests."
        }
      }
    },
    "PrefillModifyOrderRequest": {
      "allOf": [
        {
          "oneOf": [
            {
              "type": "object",
              "description": "Request to replace (modify) an existing order\n\nAt least one field must be provided.",
              "properties": {
                "limit_offset": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "New limit offset for trailing stop-limit orders (signed)"
                },
                "limit_price": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "New limit price for the order"
                },
                "quantity": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "New quantity for the order"
                },
                "stop_price": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "New stop price for the order"
                },
                "trailing_offset": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "New trailing offset for trailing orders"
                },
                "trailing_offset_type": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/$defs/TrailingOffsetType",
                      "description": "New trailing offset type (PRICE or BPS)"
                    }
                  ]
                }
              }
            }
          ],
          "description": "Fields to replace, flattened to match the replace-order request body."
        },
        {
          "type": "object",
          "required": [
            "order_id",
            "account_id"
          ],
          "properties": {
            "account_id": {
              "$ref": "#/$defs/i64",
              "description": "Account ID that owns the order."
            },
            "item_id": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid",
              "description": "Interaction-tracking identity. Absent on messages created before tracking.\nWhen a null/undefined value is observed, it indicates that there is no available data."
            },
            "order_id": {
              "type": "string",
              "description": "Order ID to modify."
            }
          }
        }
      ],
      "description": "One order modification emitted as part of an Omni prefill action.\n\nThe replace-order REST endpoint carries `account_id` and `order_id` in its\npath and accepts `ReplaceOrderRequest` as its body. A structured action has\nno request path, so this type combines the target identifiers with the body\nfields the frontend needs to construct that request. `request` is flattened\nso the deltas are not nested under a second `request` object in the emitted\nstructured-action JSON."
    },
    "PrefillNewOrderAction": {
      "type": "object",
      "description": "New-order prefill action.",
      "required": [
        "orders"
      ],
      "properties": {
        "orders": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PrefillNewOrderRequest"
          },
          "description": "Orders to prefill using the same shape accepted by the orders API."
        }
      }
    },
    "PrefillNewOrderRequest": {
      "allOf": [
        {
          "oneOf": [
            {
              "type": "object",
              "description": "Request to submit a new order",
              "required": [
                "side",
                "quantity",
                "order_type",
                "time_in_force"
              ],
              "properties": {
                "expires_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time",
                  "description": "The timestamp when the order should expire (UTC). Required when time_in_force is GOOD_TILL_DATE."
                },
                "extended_hours": {
                  "type": [
                    "boolean",
                    "null"
                  ],
                  "description": "Allow trading outside regular trading hours. Some brokers disallow options outside RTH."
                },
                "id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Optional client-provided unique ID (idempotency). Required to be unique per account.",
                  "maxLength": 64
                },
                "instrument_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/$defs/InstrumentIdOrSymbol",
                      "description": "Instrument ID (UUID) or symbol (equity ticker or OSI option symbol). Either `symbol` or `instrument_id` must be provided."
                    }
                  ]
                },
                "limit_offset": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Limit offset for trailing stop-limit orders (signed)"
                },
                "limit_price": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Limit price (required for LIMIT and STOP_LIMIT orders)"
                },
                "order_type": {
                  "$ref": "#/$defs/RequestOrderType",
                  "description": "Type of order"
                },
                "position_intent": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/$defs/RequestPositionEffect",
                      "description": "Optional open/close intent for this order. When omitted, the platform\ndetermines the position effect."
                    }
                  ]
                },
                "quantity": {
                  "type": "string",
                  "description": "Quantity to trade. For COMMON_STOCK: shares (may be fractional if supported).\nFor OPTION (single-leg): contracts (must be an integer)"
                },
                "side": {
                  "$ref": "#/$defs/Side",
                  "description": "Side of the order"
                },
                "stop_price": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Stop price (required for STOP and STOP_LIMIT orders)"
                },
                "strategy": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/$defs/OrderStrategy",
                      "description": "Optional execution strategy. One of `SOR`, `VWAP`, `TWAP`, or `DMA`. Defaults\nto `SOR`, the only strategy OTC common-stock orders support. `VWAP` and `TWAP`\nare supported only on `MARKET` and `LIMIT` orders, and `DMA` only on `LIMIT`\norders; all three require `DAY` time-in-force."
                    }
                  ]
                },
                "symbol": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Trading symbol. For equities, use the ticker symbol (e.g., \"TSLA\").\nFor options, use the OSI symbol (e.g., \"TSLA  250117C00190000\").\nEither `symbol` or `instrument_id` must be provided."
                },
                "time_in_force": {
                  "$ref": "#/$defs/RequestTimeInForce",
                  "description": "Time in force"
                },
                "trailing_offset": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Trailing offset amount (required for trailing orders)"
                },
                "trailing_offset_type": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/$defs/TrailingOffsetType",
                      "description": "Trailing offset type (PRICE or PERCENT_BPS)"
                    }
                  ]
                }
              }
            }
          ],
          "description": "Order fields, flattened to match the order-submission request."
        },
        {
          "type": "object",
          "properties": {
            "item_id": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid",
              "description": "Interaction-tracking identity. Absent on messages created before tracking.\nWhen a null/undefined value is observed, it indicates that there is no available data."
            }
          }
        }
      ],
      "description": "One new order emitted as part of an Omni prefill action."
    },
    "PrefillOrderAction": {
      "oneOf": [
        {
          "allOf": [
            {
              "$ref": "#/$defs/PrefillNewOrderAction",
              "description": "Create one or more new orders."
            },
            {
              "type": "object",
              "required": [
                "action_type"
              ],
              "properties": {
                "action_type": {
                  "type": "string",
                  "enum": [
                    "NEW"
                  ]
                }
              }
            }
          ],
          "title": "PrefillNewOrderAction",
          "description": "Create one or more new orders."
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/PrefillCancelOrderAction",
              "description": "Cancel one or more existing orders."
            },
            {
              "type": "object",
              "required": [
                "action_type"
              ],
              "properties": {
                "action_type": {
                  "type": "string",
                  "enum": [
                    "CANCEL"
                  ]
                }
              }
            }
          ],
          "title": "PrefillCancelOrderAction",
          "description": "Cancel one or more existing orders."
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/PrefillModifyOrderAction",
              "description": "Modify one or more existing orders."
            },
            {
              "type": "object",
              "required": [
                "action_type"
              ],
              "properties": {
                "action_type": {
                  "type": "string",
                  "enum": [
                    "MODIFY"
                  ]
                }
              }
            }
          ],
          "title": "PrefillModifyOrderAction",
          "description": "Modify one or more existing orders."
        }
      ],
      "description": "Action to prefill order details for user confirmation.\n\nThe user must review and authorize the order before submission to the trading API.\nThis action provides parsed order data that can be used to prefill an order ticket UI\nor submitted directly via the orders API after user confirmation."
    },
    "PromptButtonAction": {
      "type": "object",
      "description": "Prompt-style button behavior.",
      "required": [
        "prompt"
      ],
      "properties": {
        "prompt": {
          "type": "string",
          "description": "Prompt text to submit as the next user turn."
        }
      }
    },
    "RequestOrderType": {
      "type": "string",
      "description": "Strict order-type enum for order submission/replacement requests.",
      "enum": [
        "MARKET",
        "LIMIT",
        "STOP",
        "STOP_LIMIT",
        "TRAILING_STOP",
        "TRAILING_STOP_LIMIT"
      ]
    },
    "RequestPositionEffect": {
      "type": "string",
      "description": "Client-attested open/close intent for an order.",
      "enum": [
        "OPEN",
        "CLOSE"
      ]
    },
    "RequestTimeInForce": {
      "type": "string",
      "description": "Strict time-in-force enum for order submission requests.",
      "enum": [
        "DAY",
        "GOOD_TILL_CANCEL",
        "IMMEDIATE_OR_CANCEL",
        "FILL_OR_KILL",
        "GOOD_TILL_DATE",
        "AT_OPEN",
        "AT_CLOSE"
      ]
    },
    "ScreenerFilter": {
      "type": "object",
      "description": "A single filter criterion for the screener.",
      "required": [
        "field",
        "operator",
        "value"
      ],
      "properties": {
        "field": {
          "type": "string",
          "description": "Field to filter on (e.g., \"market_cap\", \"sector\", \"price\")"
        },
        "operator": {
          "type": "string",
          "description": "Comparison operator (e.g., \"eq\", \"gte\", \"lte\", \"in\")"
        },
        "value": {
          "type": "object",
          "description": "Filter value"
        }
      }
    },
    "Side": {
      "type": "string",
      "description": "Side of the order (BUY or SELL).",
      "enum": [
        "BUY",
        "SELL"
      ]
    },
    "StructuredAction": {
      "oneOf": [
        {
          "type": "object",
          "title": "PrefillOrder",
          "description": "Prefill an order ticket for user confirmation",
          "required": [
            "prefill_order"
          ],
          "properties": {
            "prefill_order": {
              "$ref": "#/$defs/PrefillOrderAction",
              "description": "Prefill an order ticket for user confirmation"
            }
          }
        },
        {
          "type": "object",
          "title": "OpenChart",
          "description": "Open a chart for a symbol",
          "required": [
            "open_chart"
          ],
          "properties": {
            "open_chart": {
              "$ref": "#/$defs/OpenChartAction",
              "description": "Open a chart for a symbol"
            }
          }
        },
        {
          "type": "object",
          "title": "OpenScreener",
          "description": "Open a stock screener with filters",
          "required": [
            "open_screener"
          ],
          "properties": {
            "open_screener": {
              "$ref": "#/$defs/OpenScreenerAction",
              "description": "Open a stock screener with filters"
            }
          }
        },
        {
          "type": "object",
          "title": "OpenEntitlementConsent",
          "description": "Open entitlement consent flow",
          "required": [
            "open_entitlement_consent"
          ],
          "properties": {
            "open_entitlement_consent": {
              "$ref": "#/$defs/OpenEntitlementConsentAction",
              "description": "Open entitlement consent flow"
            }
          }
        }
      ],
      "description": "Structured actions that Omni AI can return to clients.\n\nThese actions provide machine-readable instructions for the client to execute,\nsuch as prefilling an order ticket, opening a chart, or navigating to a route."
    },
    "StructuredActionButtonAction": {
      "type": "object",
      "description": "Structured-action button behavior.",
      "properties": {
        "actionId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "UUID of a `structured_action` content part in the same message.\nWhen a null/undefined value is observed, it indicates it does not apply."
        }
      }
    },
    "SuggestedActionsPayload": {
      "type": "object",
      "description": "Suggested follow-up buttons rendered at the end of an assistant message.",
      "properties": {
        "actionButtons": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ActionButton"
          },
          "description": "Ordered message-level buttons."
        },
        "clickedItemIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "description": "IDs of buttons clicked by the current user."
        }
      }
    },
    "TrailingOffsetType": {
      "type": "string",
      "description": "Trailing offset type for trailing stop orders.",
      "enum": [
        "PRICE",
        "BPS"
      ]
    },
    "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
        }
      }
    },
    "i64": {
      "type": "integer",
      "format": "int64"
    }
  }
}