{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-q/json-schema/amazon-q-send-message-request-schema.json",
  "title": "SendMessageRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-q-operations-api-openapi.yml#/components/schemas/SendMessageRequest",
  "type": "object",
  "properties": {
    "assistantId": {
      "type": "string",
      "description": "The identifier of the Amazon Q in Connect assistant."
    },
    "sessionId": {
      "type": "string",
      "description": "The identifier of the Amazon Q in Connect session."
    },
    "type": {
      "type": "string",
      "description": "The message type."
    },
    "message": {
      "$ref": "#/$defs/MessageInput"
    },
    "aiAgentId": {
      "type": "string",
      "description": "The identifier of the AI Agent to use for processing the message."
    },
    "conversationContext": {
      "$ref": "#/$defs/ConversationContext"
    },
    "configuration": {
      "$ref": "#/$defs/MessageConfiguration"
    },
    "clientToken": {
      "type": "string",
      "description": "A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the AWS SDK populates this field.For more information about idempotency, see Making retries safe with idempotent APIs."
    },
    "orchestratorUseCase": {
      "type": "string",
      "description": "The orchestrator use case for message processing."
    },
    "metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Additional metadata for the message."
    },
    "originRequestId": {
      "type": "string",
      "description": "Request identifier from the origin system, used for end-to-end tracing across spans."
    }
  },
  "required": [
    "assistantId",
    "sessionId",
    "type",
    "message"
  ],
  "$defs": {
    "AIGuardrailAssessment": {
      "type": "object",
      "properties": {
        "blocked": {
          "type": "boolean",
          "description": "Indicates whether the AI Guardrail blocked the content."
        }
      },
      "required": [
        "blocked"
      ]
    },
    "Citation": {
      "type": "object",
      "properties": {
        "contentId": {
          "type": "string",
          "description": "The identifier of the content being cited."
        },
        "title": {
          "type": "string",
          "description": "The title of the cited content."
        },
        "knowledgeBaseId": {
          "type": "string",
          "description": "The identifier of the knowledge base containing the cited content."
        },
        "citationSpan": {
          "$ref": "#/$defs/CitationSpan"
        },
        "sourceURL": {
          "type": "string",
          "description": "The source URL for the citation."
        },
        "referenceType": {
          "type": "string",
          "description": "A type to define the KB origin of a cited content"
        }
      },
      "required": [
        "citationSpan",
        "referenceType"
      ]
    },
    "CitationSpan": {
      "type": "object",
      "properties": {
        "beginOffsetInclusive": {
          "type": "integer",
          "description": "Where the text with a citation starts in the generated output."
        },
        "endOffsetExclusive": {
          "type": "integer",
          "description": "Where the text with a citation ends in the generated output."
        }
      }
    },
    "ConversationContext": {
      "type": "object",
      "properties": {
        "selfServiceConversationHistory": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SelfServiceConversationHistory"
          },
          "description": "The self service conversation history before the Amazon Q in Connect session."
        }
      },
      "required": [
        "selfServiceConversationHistory"
      ]
    },
    "MessageConfiguration": {
      "type": "object",
      "properties": {
        "generateFillerMessage": {
          "type": "boolean",
          "description": "Generates a filler response when tool selection is QUESTION."
        },
        "generateChunkedMessage": {
          "type": "boolean",
          "description": "Configuration for generating chunked messages."
        }
      }
    },
    "MessageData": {
      "type": "object",
      "properties": {
        "text": {
          "$ref": "#/$defs/TextMessage"
        },
        "toolUseResult": {
          "$ref": "#/$defs/ToolUseResultData"
        },
        "data": {
          "type": "object",
          "description": "The message data as a structured JSON document. This is the payload for a message of type DATA, and must be a JSON object at the root level."
        }
      },
      "description": "Exactly one member is set."
    },
    "MessageInput": {
      "type": "object",
      "properties": {
        "value": {
          "$ref": "#/$defs/MessageData"
        }
      },
      "required": [
        "value"
      ]
    },
    "SelfServiceConversationHistory": {
      "type": "object",
      "properties": {
        "turnNumber": {
          "type": "integer",
          "description": "The number of turn of the conversation history data."
        },
        "inputTranscript": {
          "type": "string",
          "description": "The input transcript of the conversation history data."
        },
        "botResponse": {
          "type": "string",
          "description": "The bot response of the conversation history data."
        },
        "timestamp": {
          "type": "string",
          "description": "The timestamp of the conversation history entry."
        }
      }
    },
    "TextMessage": {
      "type": "object",
      "properties": {
        "value": {
          "type": "string",
          "description": "The value of the message data in text type."
        },
        "citations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Citation"
          },
          "description": "The citations associated with the text message."
        },
        "aiGuardrailAssessment": {
          "$ref": "#/$defs/AIGuardrailAssessment"
        }
      }
    },
    "ToolUseResultData": {
      "type": "object",
      "properties": {
        "toolUseId": {
          "type": "string",
          "description": "The identifier of the tool use instance."
        },
        "toolName": {
          "type": "string",
          "description": "The name of the tool that was used."
        },
        "toolResult": {
          "type": "object",
          "description": "The result of the tool usage."
        },
        "inputSchema": {
          "type": "object",
          "description": "The input schema for the tool use result."
        }
      },
      "required": [
        "toolUseId",
        "toolName",
        "toolResult"
      ]
    }
  }
}