document_contents
Creates, updates, deletes, gets or lists a document_contents resource.
Overview
| Name | document_contents |
| Type | Resource |
| Id | aws.qbusiness.document_contents |
Fields
The following fields are returned by SELECT queries:
- get_document_content
| Name | Datatype | Description |
|---|---|---|
mime_type | string | The MIME type of the document content. When outputFormat is RAW, this corresponds to the original document's MIME type (e.g., application/pdf, text/plain, application/vnd.openxmlformats-officedocument.wordprocessingml.document). When outputFormat is EXTRACTED, the MIME type is always application/json. |
presigned_url | string | A pre-signed URL that provides temporary access to download the document content directly from Amazon Q Business. The URL expires after 5 minutes for security purposes. This URL is generated only after successful ACL validation. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_document_content | select | application_id, index_id, document_id, region | dataSourceId, outputFormat | Retrieves the content of a document that was ingested into Amazon Q Business. This API validates user authorization against document ACLs before returning a pre-signed URL for secure document access. You can download or view source documents referenced in chat responses through the URL. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
application_id | string | The unique identifier of the Amazon Q Business application containing the document. This ensures the request is scoped to the correct application environment and its associated security policies. |
document_id | string | The unique identifier of the document that is indexed via BatchPutDocument API or file-upload or connector sync. It is also found in chat or chatSync response. |
index_id | string | The identifier of the index where documents are indexed. |
region | string | AWS region (default: us-east-1) |
dataSourceId | string | 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. If the document is from a file-upload data source, the datasource will be "uploaded-docs-file-stat-datasourceid". |
outputFormat | string | Document outputFormat. Defaults to RAW if not selected. |
SELECT examples
- get_document_content
Retrieves the content of a document that was ingested into Amazon Q Business. This API validates user authorization against document ACLs before returning a pre-signed URL for secure document access. You can download or view source documents referenced in chat responses through the URL.
SELECT
mime_type,
presigned_url
FROM aws.qbusiness.document_contents
WHERE application_id = '{{ application_id }}' -- required
AND index_id = '{{ index_id }}' -- required
AND document_id = '{{ document_id }}' -- required
AND region = '{{ region }}' -- required
AND dataSourceId = '{{ dataSourceId }}'
AND outputFormat = '{{ outputFormat }}'
;