Automating Document Processing with Amazon Textract - From OCR to Form and Table Extraction
Structure recognition of forms and tables that goes beyond OCR automatically extracts data from invoices, receipts, and identity documents. Integration of human review through A2I is also introduced.
The Textract API Structure
Textract is a machine learning-based document analysis service that extracts not only text but also structured data from forms and tables. DetectDocumentText is the basic OCR feature, extracting text from images and PDFs by line and word. AnalyzeDocument is the analysis feature that recognizes forms (key-value pairs) and tables (row and column structures). For example, from "Name: Taro Yamada" on an application form, it automatically pairs the key "Name" with the value "Taro Yamada". AnalyzeExpense is an API specialized for invoices and receipts that extracts vendor names, invoice dates, total amounts, tax amounts, and line items as structured data. AnalyzeID extracts information such as names, dates of birth, and addresses from documents such as driver's licenses and passports issued by the US government.
Asynchronous Processing of Large Volumes of Documents
Synchronous APIs handle single-page images, but asynchronous APIs are used to process multi-page PDFs or large volumes of documents. Processing is started with StartDocumentTextDetection or StartDocumentAnalysis, and a completion notification is sent to an SNS topic. An event-driven configuration in which a Lambda function receives the notification and retrieves the results with GetDocumentTextDetection or GetDocumentAnalysis is commonly used. By building a pipeline that is triggered by document uploads to S3, calls Textract from Lambda, and stores the extraction results in DynamoDB, you can automate document processing.
Improving Accuracy and Human Review
Each field in Textract's extraction results is assigned a confidence score (0-100%). Results whose confidence falls below a threshold can be routed to a human review workflow using Amazon Augmented AI (A2I). Reviewers check the original document and the extraction results side by side in the A2I console and make corrections. The corrected results can be used to revisit later processing. With Textract's Queries feature, you can specify questions in natural language (e.g., "What is the patient's name?") to extract specific information from documents, which also lets you handle documents with no fixed form structure.
Textract Pricing
Textract pricing is pay-as-you-go per API. DetectDocumentText (OCR) costs about $0.0015 per page, AnalyzeDocument (forms / tables) about $0.015, AnalyzeExpense (invoices) about $0.01, and AnalyzeID (identity documents) about $0.01 (as of August 2026). The Queries feature adds about $0.005 per query to about $0.015 per page. When processing large volumes of documents, you can reduce costs with two-stage processing that first runs OCR with DetectDocumentText and applies AnalyzeDocument only to the pages that require structured data extraction.
Identity Document Processing and Identity Verification
AnalyzeID extracts items such as names, dates of birth, addresses, and expiration dates in structured form from identity documents such as driver's licenses and passports issued by the US government. It is suited to identity verification (KYC) for account opening and membership registration, where information is automatically read from a photo of a document taken by the user and populated into input forms. It can reduce the effort and errors of manual entry and make the registration experience smooth. However, the data handled is sensitive personal information. For that reason, operations that thoroughly enforce stating the purpose of collection, managing retention periods, and access control, and that reliably delete data once it is no longer needed, are a prerequisite.
Understanding Meaning Through Integration with Comprehend
Textract handles the work up to extracting characters and structure, and combining it with Comprehend is effective for interpreting the meaning of that content. If you pass the extracted text to Comprehend, you can extract named entities such as person names, organization names, and dates, classify documents, determine sentiment, and more. In addition, if you add processing that detects personal information in documents and masks it, you can protect sensitive information before storage or sharing. By dividing the roles of character extraction and meaning comprehension, you can build pipelines for automated processing based on content.
Verification and Highlighting That Make Use of Coordinate Information
Textract results include coordinate information (bounding boxes) that shows where each extracted element is located on the page. Using this, the extracted locations are overlaid on the original document image, which makes it easy for reviewers to confirm which part a value was read from. Using the location information as a clue, you can also build precise extraction rules, such as adopting only values written in specific regions. Because extraction results can be visually matched with the original, it becomes easy to proceed with review work and with finding and correcting incorrect extractions.
Security and Compliance
Business documents often contain personal or confidential information, so the security design of the processing platform is important. Stored documents and extraction results are encrypted, and access is narrowed to least privilege with IAM. If you do not want traffic to go over the internet, you can call Textract through a VPC endpoint and keep communication within a closed network. Who accessed what at each stage of processing is recorded so that it can be audited. Setting data retention periods and putting in place a mechanism that reliably deletes originals and extraction results that are no longer needed makes it easy to proceed with document processing that meets compliance requirements.
Summary
Textract is a service that extracts data based on the structure of documents. It provides dedicated APIs for each document type, such as forms, tables, invoices, and identity documents, and helps reduce manual entry work. If you build in human review through integration with A2I, it can also be used in business workflows that demand accuracy.
References (Official AWS Resources)
The primary sources for this page are the official AWS website and documentation. Check the official pages below for the latest specifications and pricing.
- Amazon Textract official page
- Amazon S3 official page
- AWS Lambda official page
- AWS Documentation (official)
If this page and the official documentation disagree, treat the official documentation as authoritative.