Skip to content
Get Started for Free

Textract

Textract is a machine learning service that automatically extracts text, forms, and tables from scanned documents. It simplifies the process of extracting valuable information from a variety of document types, enabling applications to quickly analyze and understand document content.

LocalStack allows you to mock Textract APIs in your local environment. The supported APIs are available on our API Coverage section, providing details on the extent of Textract’s integration with LocalStack.

This guide is tailored for users new to Textract and assumes basic knowledge of the AWS CLI and our lstk aws command.

Start your LocalStack container using your preferred method. We will demonstrate how to perform basic Textract operations, such as mocking text detection in a document.

You can use the DetectDocumentText API to identify and extract text from a document. Execute the following command:

Terminal window
lstk aws textract detect-document-text \
--document '{"S3Object":{"Bucket":"your-bucket","Name":"your-document"}}'
Output
{
"DocumentMetadata": {
"Pages": {
"Pages": 389
}
},
"Blocks": [],
"DetectDocumentTextModelVersion": "1.0"
}

You can use the StartDocumentTextDetection API to asynchronously detect text in a document. Execute the following command:

Terminal window
lstk aws textract start-document-text-detection \
--document-location '{"S3Object":{"Bucket":"bucket","Name":"document"}}'
Output
{
"JobId": "501d7251-1249-41e0-a0b3-898064bfc506"
}

Save the JobId value to use in the next command.

You can use the GetDocumentTextDetection API to retrieve the results of a document text detection job. Execute the following command:

Terminal window
lstk aws textract get-document-text-detection \
--job-id "501d7251-1249-41e0-a0b3-898064bfc506"

Replace 501d7251-1249-41e0-a0b3-898064bfc506 with the JobId value retrieved from the previous command.

Output
{
"DocumentMetadata": {
"Pages": {
"Pages": 389
}
},
"JobStatus": "SUCCEEDED",
"Blocks": [],
"DetectDocumentTextModelVersion": "1.0"
}

5 of 25 operations implemented

Available from the Ultimate plan. Licensing details

Find an API

Search the full operation list, then sort the table to compare current support.

Loading operations…

Verified on Kubernetes
Loading operations…
Complete static API list All 25 operations and their current support status
OperationStatus
AnalyzeDocumentNot implemented
AnalyzeExpenseNot implemented
AnalyzeIDNot implemented
CreateAdapterNot implemented
CreateAdapterVersionNot implemented
DeleteAdapterNot implemented
DeleteAdapterVersionNot implemented
DetectDocumentTextImplemented
GetAdapterNot implemented
GetAdapterVersionNot implemented
GetDocumentAnalysisImplemented
GetDocumentTextDetectionImplemented
GetExpenseAnalysisNot implemented
GetLendingAnalysisNot implemented
GetLendingAnalysisSummaryNot implemented
ListAdapterVersionsNot implemented
ListAdaptersNot implemented
ListTagsForResourceNot implemented
StartDocumentAnalysisImplemented
StartDocumentTextDetectionImplemented
StartExpenseAnalysisNot implemented
StartLendingAnalysisNot implemented
TagResourceNot implemented
UntagResourceNot implemented
UpdateAdapterNot implemented
Was this page helpful?