Skip to content

Bedrock Agent Runtime  >  Operations  >  get_document_content

get_document_content

Operation

get_document_content async

get_document_content(input: GetDocumentContentInput, plugins: list[Plugin] | None = None) -> GetDocumentContentOutput

Retrieves the content of an ingested document from a knowledge base. Returns a pre-signed URL for secure document access.

Parameters:

Name Type Description Default
input GetDocumentContentInput

An instance of GetDocumentContentInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
GetDocumentContentOutput

An instance of GetDocumentContentOutput.

Input

GetDocumentContentInput dataclass

Dataclass for GetDocumentContentInput structure.

Attributes

data_source_id class-attribute instance-attribute
data_source_id: str | None = None

The unique identifier of the data source that contains the document.

document_id class-attribute instance-attribute
document_id: str | None = None

The unique identifier of the document to retrieve content for.

knowledge_base_id class-attribute instance-attribute
knowledge_base_id: str | None = None

The unique identifier of the knowledge base that contains the document.

output_format class-attribute instance-attribute
output_format: DocumentOutputFormat | None = None

The output format for the document content. RAW returns the original file. EXTRACTED returns parsed text as JSON. Defaults to RAW.

user_context class-attribute instance-attribute
user_context: UserContext | None = field(repr=False, default=None)

Contains information about the user making the request. Use this to pass user identity information for access control filtering, so that retrieval results only include documents the user is authorized to access.

Output

GetDocumentContentOutput dataclass

Dataclass for GetDocumentContentOutput structure.

Attributes

document_content_length class-attribute instance-attribute
document_content_length: int | None = None

The size of the document content in bytes available at the pre-signed URL.

mime_type instance-attribute
mime_type: str

The MIME type of the document content. For RAW format, this is the original file type (for example, application/pdf). For EXTRACTED format, this is always application/json.

presigned_url class-attribute instance-attribute
presigned_url: str = field(repr=False)

A pre-signed URL for downloading the document content. The URL expires after 5 minutes.