{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-bedrock/json-schema/amazon-bedrock-ingest-knowledge-base-documents-request-schema.json",
  "title": "IngestKnowledgeBaseDocumentsRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-bedrock-documents-api-openapi.yml#/components/schemas/IngestKnowledgeBaseDocumentsRequest",
  "type": "object",
  "properties": {
    "knowledgeBaseId": {
      "type": "string",
      "description": "The unique identifier of the knowledge base to ingest the documents into."
    },
    "dataSourceId": {
      "type": "string",
      "description": "The unique identifier of the data source connected to the knowledge base that you're adding documents to."
    },
    "clientToken": {
      "type": "string",
      "description": "A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency."
    },
    "documents": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/KnowledgeBaseDocument"
      },
      "description": "A list of objects, each of which contains information about the documents to add."
    }
  },
  "required": [
    "knowledgeBaseId",
    "dataSourceId",
    "documents"
  ],
  "$defs": {
    "BedrockAgentByteContentDoc": {
      "type": "object",
      "properties": {
        "mimeType": {
          "type": "string",
          "description": "The MIME type of the content. For a list of MIME types, see Media Types. The following MIME types are supported: text/plain text/html text/csv text/vtt message/rfc822 application/xhtml+xml application/pdf application/msword application/vnd.ms-word.document.macroenabled.12 application/vnd.ms-word.template.macroenabled.12 application/vnd.ms-excel application/vnd.ms-excel.addin.macroenabled.12 application/vnd.ms-excel.sheet.macroenabled.12 application/vnd.ms-excel.template.macroenabled.12 application/vnd.ms-excel.sheet.binary.macroenabled.12 application/vnd.ms-spreadsheetml application/vnd.openxm"
        },
        "data": {
          "type": "string",
          "format": "byte",
          "description": "The base64-encoded string of the content."
        }
      },
      "required": [
        "mimeType",
        "data"
      ]
    },
    "BedrockAgentS3Location": {
      "type": "object",
      "properties": {
        "uri": {
          "type": "string",
          "description": "The location's URI. For example, s3://my-bucket/chunk-processor/."
        }
      },
      "required": [
        "uri"
      ]
    },
    "CustomContent": {
      "type": "object",
      "properties": {
        "customDocumentIdentifier": {
          "$ref": "#/$defs/CustomDocumentIdentifier"
        },
        "sourceType": {
          "type": "string",
          "enum": [
            "IN_LINE",
            "S3_LOCATION"
          ],
          "description": "The source of the data to ingest."
        },
        "s3Location": {
          "$ref": "#/$defs/CustomS3Location"
        },
        "inlineContent": {
          "$ref": "#/$defs/InlineContent"
        }
      },
      "required": [
        "customDocumentIdentifier",
        "sourceType"
      ]
    },
    "CustomDocumentIdentifier": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The identifier of the document to ingest into a custom data source."
        }
      },
      "required": [
        "id"
      ]
    },
    "CustomS3Location": {
      "type": "object",
      "properties": {
        "uri": {
          "type": "string",
          "description": "The S3 URI of the file containing the content to ingest."
        },
        "bucketOwnerAccountId": {
          "type": "string",
          "description": "The identifier of the Amazon Web Services account that owns the S3 bucket containing the content to ingest."
        }
      },
      "required": [
        "uri"
      ]
    },
    "DocumentAccessControlEntry": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The user identifier."
        },
        "type": {
          "type": "string",
          "enum": [
            "USER"
          ],
          "description": "The type of principal."
        },
        "access": {
          "type": "string",
          "enum": [
            "ALLOW",
            "DENY"
          ],
          "description": "Whether to allow or deny access."
        }
      },
      "required": [
        "name",
        "type",
        "access"
      ]
    },
    "DocumentContent": {
      "type": "object",
      "properties": {
        "dataSourceType": {
          "type": "string",
          "enum": [
            "CUSTOM",
            "S3"
          ],
          "description": "The type of data source that is connected to the knowledge base to which to ingest this document."
        },
        "custom": {
          "$ref": "#/$defs/CustomContent"
        },
        "s3": {
          "$ref": "#/$defs/S3Content"
        }
      },
      "required": [
        "dataSourceType"
      ]
    },
    "DocumentMetadata": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "IN_LINE_ATTRIBUTE",
            "S3_LOCATION"
          ],
          "description": "The type of the source source from which to add metadata."
        },
        "inlineAttributes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MetadataAttribute"
          },
          "description": "An array of objects, each of which defines a metadata attribute to associate with the content to ingest. You define the attributes inline."
        },
        "s3Location": {
          "$ref": "#/$defs/CustomS3Location"
        },
        "accessControlList": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DocumentAccessControlEntry"
          },
          "description": "Access control list for the document. Used when metadata type is IN_LINE_ATTRIBUTE."
        }
      },
      "required": [
        "type"
      ]
    },
    "InlineContent": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "BYTE",
            "TEXT"
          ],
          "description": "The type of inline content to define."
        },
        "byteContent": {
          "$ref": "#/$defs/BedrockAgentByteContentDoc"
        },
        "textContent": {
          "$ref": "#/$defs/TextContentDoc"
        }
      },
      "required": [
        "type"
      ]
    },
    "KnowledgeBaseDocument": {
      "type": "object",
      "properties": {
        "metadata": {
          "$ref": "#/$defs/DocumentMetadata"
        },
        "content": {
          "$ref": "#/$defs/DocumentContent"
        }
      },
      "required": [
        "content"
      ]
    },
    "MetadataAttribute": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "The key of the metadata attribute."
        },
        "value": {
          "$ref": "#/$defs/MetadataAttributeValue"
        }
      },
      "required": [
        "key",
        "value"
      ]
    },
    "MetadataAttributeValue": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "BOOLEAN",
            "NUMBER",
            "STRING",
            "STRING_LIST"
          ],
          "description": "The type of the metadata attribute."
        },
        "numberValue": {
          "type": "number",
          "description": "The value of the numeric metadata attribute."
        },
        "booleanValue": {
          "type": "boolean",
          "description": "The value of the Boolean metadata attribute."
        },
        "stringValue": {
          "type": "string",
          "description": "The value of the string metadata attribute."
        },
        "stringListValue": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An array of strings that define the value of the metadata attribute."
        }
      },
      "required": [
        "type"
      ]
    },
    "S3Content": {
      "type": "object",
      "properties": {
        "s3Location": {
          "$ref": "#/$defs/BedrockAgentS3Location"
        }
      },
      "required": [
        "s3Location"
      ]
    },
    "TextContentDoc": {
      "type": "object",
      "properties": {
        "data": {
          "type": "string",
          "description": "The text of the content."
        }
      },
      "required": [
        "data"
      ]
    }
  }
}