{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-q/json-schema/amazon-q-chat-sync-output-schema.json",
  "title": "ChatSyncOutput",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-q-conversations-api-openapi.yml#/components/schemas/ChatSyncOutput",
  "type": "object",
  "properties": {
    "conversationId": {
      "type": "string",
      "description": "The identifier of the Amazon Q Business conversation."
    },
    "systemMessage": {
      "type": "string",
      "description": "An AI-generated message in a conversation."
    },
    "systemMessageId": {
      "type": "string",
      "description": "The identifier of an Amazon Q Business AI generated message within the conversation."
    },
    "userMessageId": {
      "type": "string",
      "description": "The identifier of an Amazon Q Business end user text input message within the conversation."
    },
    "actionReview": {
      "$ref": "#/$defs/ActionReview"
    },
    "authChallengeRequest": {
      "$ref": "#/$defs/AuthChallengeRequest"
    },
    "sourceAttributions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SourceAttribution"
      },
      "description": "The source documents used to generate the conversation response."
    },
    "failedAttachments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AttachmentOutput"
      },
      "description": "A list of files which failed to upload during chat."
    }
  },
  "$defs": {
    "ActionReview": {
      "type": "object",
      "properties": {
        "pluginId": {
          "type": "string",
          "description": "The identifier of the plugin associated with the action review."
        },
        "pluginType": {
          "type": "string",
          "enum": [
            "SERVICE_NOW",
            "SALESFORCE",
            "JIRA",
            "ZENDESK",
            "CUSTOM",
            "QUICKSIGHT",
            "SERVICENOW_NOW_PLATFORM",
            "JIRA_CLOUD",
            "SALESFORCE_CRM",
            "ZENDESK_SUITE",
            "ATLASSIAN_CONFLUENCE",
            "GOOGLE_CALENDAR",
            "MICROSOFT_TEAMS",
            "MICROSOFT_EXCHANGE",
            "PAGERDUTY_ADVANCE",
            "SMARTSHEET",
            "ASANA"
          ],
          "description": "The type of plugin."
        },
        "payload": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ActionReviewPayloadField"
          },
          "description": "Field values that an end user needs to provide to Amazon Q Business for Amazon Q Business to perform the requested plugin action."
        },
        "payloadFieldNameSeparator": {
          "type": "string",
          "description": "A string used to retain information about the hierarchical contexts within an action review payload."
        }
      }
    },
    "ActionReviewPayloadField": {
      "type": "object",
      "properties": {
        "displayName": {
          "type": "string",
          "description": "The name of the field."
        },
        "displayOrder": {
          "type": "integer",
          "description": "The display order of fields in a payload."
        },
        "displayDescription": {
          "type": "string",
          "description": "The field level description of each action review input field. This could be an explanation of the field. In the Amazon Q Business web experience, these descriptions could be used to display as tool tips to help users understand the field."
        },
        "type": {
          "type": "string",
          "enum": [
            "STRING",
            "NUMBER",
            "ARRAY",
            "BOOLEAN"
          ],
          "description": "The type of field."
        },
        "value": {
          "type": "object",
          "description": "The field value."
        },
        "allowedValues": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ActionReviewPayloadFieldAllowedValue"
          },
          "description": "Information about the field values that an end user can use to provide to Amazon Q Business for Amazon Q Business to perform the requested plugin action."
        },
        "allowedFormat": {
          "type": "string",
          "description": "The expected data format for the action review input field value. For example, in PTO request, from and to would be of datetime allowed format."
        },
        "arrayItemJsonSchema": {
          "type": "object",
          "description": "Use to create a custom form with array fields (fields with nested objects inside an array)."
        },
        "required": {
          "type": "boolean",
          "description": "Information about whether the field is required."
        }
      }
    },
    "ActionReviewPayloadFieldAllowedValue": {
      "type": "object",
      "properties": {
        "value": {
          "type": "object",
          "description": "The field value."
        },
        "displayValue": {
          "type": "object",
          "description": "The name of the field."
        }
      }
    },
    "AttachmentOutput": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of a file uploaded during chat."
        },
        "status": {
          "type": "string",
          "enum": [
            "FAILED",
            "SUCCESS"
          ],
          "description": "The status of a file uploaded during chat."
        },
        "error": {
          "$ref": "#/$defs/ErrorDetail"
        },
        "attachmentId": {
          "type": "string",
          "description": "The unique identifier of the Amazon Q Business attachment."
        },
        "conversationId": {
          "type": "string",
          "description": "The unique identifier of the Amazon Q Business conversation."
        }
      }
    },
    "AudioSourceDetails": {
      "type": "object",
      "properties": {
        "mediaId": {
          "type": "string",
          "description": "Unique identifier for the audio media file."
        },
        "mediaMimeType": {
          "type": "string",
          "description": "The MIME type of the audio file (e.g., audio/mp3, audio/wav)."
        },
        "startTimeMilliseconds": {
          "type": "integer",
          "description": "The starting timestamp in milliseconds for the relevant audio segment."
        },
        "endTimeMilliseconds": {
          "type": "integer",
          "description": "The ending timestamp in milliseconds for the relevant audio segment."
        },
        "audioExtractionType": {
          "type": "string",
          "enum": [
            "TRANSCRIPT",
            "SUMMARY"
          ],
          "description": "The type of audio extraction performed on the content."
        }
      }
    },
    "AuthChallengeRequest": {
      "type": "object",
      "properties": {
        "authorizationUrl": {
          "type": "string",
          "description": "The URL sent by Amazon Q Business to the third party authentication server to authenticate a custom plugin user through an OAuth protocol."
        }
      },
      "required": [
        "authorizationUrl"
      ]
    },
    "ErrorDetail": {
      "type": "object",
      "properties": {
        "errorMessage": {
          "type": "string",
          "description": "The message explaining the Amazon Q Business request error."
        },
        "errorCode": {
          "type": "string",
          "enum": [
            "InternalError",
            "InvalidRequest",
            "ResourceInactive",
            "ResourceNotFound"
          ],
          "description": "The code associated with the Amazon Q Business request error."
        }
      }
    },
    "ImageSourceDetails": {
      "type": "object",
      "properties": {
        "mediaId": {
          "type": "string",
          "description": "Unique identifier for the image file."
        },
        "mediaMimeType": {
          "type": "string",
          "description": "The MIME type of the image file."
        }
      }
    },
    "SnippetExcerpt": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "The relevant text excerpt from a source that was used to generate a citation text segment in an Amazon Q chat response."
        }
      }
    },
    "SourceAttribution": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The title of the document which is the source for the Amazon Q Business generated response."
        },
        "snippet": {
          "type": "string",
          "description": "The content extract from the document on which the generated response is based."
        },
        "url": {
          "type": "string",
          "description": "The URL of the document which is the source for the Amazon Q Business generated response."
        },
        "citationNumber": {
          "type": "integer",
          "description": "The number attached to a citation in an Amazon Q Business generated response."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "The Unix timestamp when the Amazon Q Business application was last updated."
        },
        "textMessageSegments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TextSegment"
          },
          "description": "A text extract from a source document that is used for source attribution."
        },
        "documentId": {
          "type": "string",
          "description": "The unique identifier of the source document used in the citation, obtained from the Amazon Q Business index during chat response generation. This ID is used as input to the GetDocumentContent API to retrieve the actual document content for user verification."
        },
        "indexId": {
          "type": "string",
          "description": "The identifier of the index containing the source document's metadata and access control information. This links the citation back to the specific Amazon Q Business index where the document's searchable content and permissions are stored."
        },
        "datasourceId": {
          "type": "string",
          "description": "The identifier of the data source from which the document was ingested. This field is not present if the document is ingested by directly calling the BatchPutDocument API (similar to checkDocumentAccess). If the document is from a file-upload data source, the datasource will be \"uploaded-docs-file-stat-datasourceid\"."
        }
      }
    },
    "SourceDetails": {
      "type": "object",
      "properties": {
        "imageSourceDetails": {
          "$ref": "#/$defs/ImageSourceDetails"
        },
        "audioSourceDetails": {
          "$ref": "#/$defs/AudioSourceDetails"
        },
        "videoSourceDetails": {
          "$ref": "#/$defs/VideoSourceDetails"
        }
      },
      "description": "Exactly one member is set."
    },
    "TextSegment": {
      "type": "object",
      "properties": {
        "beginOffset": {
          "type": "integer",
          "description": "The zero-based location in the response string where the source attribution starts."
        },
        "endOffset": {
          "type": "integer",
          "description": "The zero-based location in the response string where the source attribution ends."
        },
        "snippetExcerpt": {
          "$ref": "#/$defs/SnippetExcerpt"
        },
        "mediaId": {
          "type": "string",
          "description": "The identifier of the media object associated with the text segment in the source attribution."
        },
        "mediaMimeType": {
          "type": "string",
          "description": "The MIME type (image/png) of the media object associated with the text segment in the source attribution."
        },
        "sourceDetails": {
          "$ref": "#/$defs/SourceDetails"
        }
      }
    },
    "VideoSourceDetails": {
      "type": "object",
      "properties": {
        "mediaId": {
          "type": "string",
          "description": "Unique identifier for the video media file."
        },
        "mediaMimeType": {
          "type": "string",
          "description": "The MIME type of the video file (e.g., video/mp4, video/avi)."
        },
        "startTimeMilliseconds": {
          "type": "integer",
          "description": "The starting timestamp in milliseconds for the relevant video segment."
        },
        "endTimeMilliseconds": {
          "type": "integer",
          "description": "The ending timestamp in milliseconds for the relevant video segment."
        },
        "videoExtractionType": {
          "type": "string",
          "enum": [
            "TRANSCRIPT",
            "SUMMARY"
          ],
          "description": "The type of video extraction performed on the content."
        }
      }
    }
  }
}