On This Page

AWS Textract extracts text, tables, forms, and structured data from PDFs and images using pre-trained deep learning models. No OCR expertise or model training required. A single-page synchronous call returns results in under a second; a 500-page mortgage package runs asynchronously and completes in minutes. This guide covers API selection, async polling, confidence thresholds, production pipeline architecture, and when to route to Amazon Bedrock Data Automation instead.

6Specialized APIs
$0.0015Per page, plain OCR
95%Classification accuracy (Associa, 2026)
54%Cost reduction, hybrid routing vs BDA-only

Prerequisites

Before your first API call, you need:

  • An AWS account with Textract enabled in your target region
  • IAM permissions: textract:AnalyzeDocument, textract:DetectDocumentText, textract:StartDocumentAnalysis, textract:GetDocumentAnalysis, plus S3 read access for your document bucket
  • AWS SDK installed (Python boto3, Java AWS SDK, or .NET AWS SDK)
  • Documents in JPEG, PNG, PDF, or TIFF format; 150 DPI minimum for reliable extraction

PDF and TIFF support multi-page processing. JPEG and PNG are single-page only.

Choosing the right API

The first implementation decision is API selection. Using AnalyzeDocument on every document wastes budget and adds latency. Match the API to the document type:

Document type API Cost per page
Raw text only DetectDocumentText $0.0015
Forms and tables AnalyzeDocument (FORMS, TABLES) $0.015–$0.05
Invoices and receipts AnalyzeExpense $0.01
US passports, driver's licenses AnalyzeID $0.025
Mortgage loan packages AnalyzeLending Managed workflow
Custom document fields Custom Queries (trained on 10+ samples) Varies

AnalyzeDocument accepts multiple FeatureTypes in one call: ['FORMS', 'TABLES', 'QUERIES', 'SIGNATURES']. Enable only what you need. Combining FORMS and TABLES costs $0.065 per page total.

For invoice processing automation, AnalyzeExpense normalizes field names automatically, returning VENDOR_NAME, INVOICE_RECEIPT_ID, TOTAL, and LINE_ITEM_GROUPS regardless of how the source document labels them. This handles layout variation across vendors better than generic form extraction.

AnalyzeLending has no equivalent in Azure AI Document Intelligence, according to Signisys's April 2026 Textract comparison. It classifies each page in a loan package and routes it to the appropriate extraction operation automatically.

Synchronous vs. asynchronous calls

Single-page documents use synchronous APIs and return results immediately. Multi-page PDFs and TIFFs require async job submission.

Synchronous (single page, sub-second latency):

import boto3

client = boto3.client('textract', region_name='us-east-1')

with open('invoice.pdf', 'rb') as f:
    response = client.analyze_expense(
        Document={'Bytes': f.read()}
    )

for field in response['ExpenseDocuments'][0]['SummaryFields']:
    print(field['Type']['Text'], ':', field['ValueDetection']['Text'],
          '| confidence:', field['ValueDetection']['Confidence'])

Asynchronous (multi-page, S3 required):

## Submit job
response = client.start_document_analysis(
    DocumentLocation={'S3Object': {'Bucket': 'my-bucket', 'Name': 'loan-package.pdf'}},
    FeatureTypes=['FORMS', 'TABLES'],
    NotificationChannel={
        'SNSTopicArn': 'arn:aws:sns:us-east-1:123456789:textract-complete',
        'RoleArn': 'arn:aws:iam::123456789:role/TextractSNSRole'
    }
)
job_id = response['JobId']

## Poll for results (or use SNS trigger)
import time
while True:
    result = client.get_document_analysis(JobId=job_id)
    if result['JobStatus'] in ['SUCCEEDED', 'FAILED']:
        break
    time.sleep(5)

## Paginate through results
pages = [result]
next_token = result.get('NextToken')
while next_token:
    page = client.get_document_analysis(JobId=job_id, NextToken=next_token)
    pages.append(page)
    next_token = page.get('NextToken')

Use SNS notifications rather than polling loops in production. Rick Hightower's May 2025 implementation guide recommends defaulting to async even for single-page documents to avoid code changes as document sizes grow.

Confidence scores and thresholds

Every extracted element carries a confidence score from 0 to 100. The AWS best practices documentation recommends calibrating thresholds to the cost of errors in each use case:

Use case Minimum confidence
Archival or handwritten notes 50%
Identity document required fields 80%
Financial decision processes 90%+

Fields below threshold should route to human review, not fail silently. Amazon Augmented AI (A2I) integrates directly with Textract confidence scores to trigger human review queues.

Production pipeline architecture

A production intelligent document processing pipeline does more than call Textract. As Nawaz Dhandala wrote for OneUptime in February 2026: "A real IDP pipeline classifies incoming documents, routes them to the right extraction logic, validates the extracted data, handles exceptions, and feeds results into your business systems."

The standard AWS reference architecture:

1

Ingest

Documents land in S3, triggering an S3 event notification that invokes a Lambda function.

2

Classify

Lambda classifies the document using keyword rules (checking for "invoice", "bill to") or Amazon Comprehend Custom Classification. Confidence below 0.5 routes to human review.

3

Extract

Classified documents route to type-specific APIs: `analyze_expense()` for invoices, `analyze_id()` for identity documents, `analyze_document()` with FORMS and TABLES for contracts.

4

Validate and store

Validated results write to DynamoDB, RDS, or OpenSearch. Step Functions orchestrate the full workflow with exponential backoff, dead-letter queues, and CloudWatch monitoring.

AWS provides CDK constructs with pre-built infrastructure templates covering this full stack, available on GitHub under the MIT license.

Adding Comprehend for enrichment

Textract handles extraction; Amazon Comprehend handles enrichment. The combination covers entity recognition, key phrase extraction, and PII detection for redaction workflows.

One constraint: Comprehend enforces text size limits. Hightower's guide uses 5,000-byte chunks split on sentence boundaries. Comprehend supports Spanish, French, and other languages via the LanguageCode parameter, extending beyond Textract's six-language OCR support.

Minimum IAM permissions for Comprehend enrichment: comprehend:DetectEntities, comprehend:DetectKeyPhrases, comprehend:DetectPiiEntities.

What practitioners report

Teams find Textract reliable for standardized document types: US invoices, driver's licenses, W-2s, and mortgage packages process with high consistency. The async API and SNS notification pattern works smoothly at scale.

Common friction points: merged table cells spanning multiple columns produce unreliable output. Rotated text within tables fails. Non-US identity documents are not supported. The AWS best practices guide explicitly recommends falling back to DetectDocumentText when table geometry is irregular and parsing structure in application code instead.

Language coverage is a real constraint. Textract covers English, Spanish, German, French, Italian, and Portuguese. Azure AI Document Intelligence covers 300+ languages, per Signisys's April 2026 analysis.

When to use Bedrock Data Automation instead

Amazon Bedrock Data Automation (BDA) reached general availability in March 2025. Choosing between Textract and BDA is now a core implementation decision.

Textract uses specialized ML models with deterministic output: the same input always produces the same result. BDA uses foundation models with a single unified API covering documents, images, audio, and video, handling layout variability better through generative AI reasoning. BDA is async-only; Textract supports synchronous calls with sub-second latency.

The pricing difference is significant. Textract DetectDocumentText costs $0.0015 per page. BDA Standard costs $0.01 per page in us-east-1 as of February 2026. Textract offers volume discounts reducing per-page costs by 40% or more at 1 million or more pages per month; BDA has no volume pricing tiers, per Davide Gallitelli's February 2026 hybrid architecture analysis.

For a concrete comparison, the AWS machine learning blog in July 2025 calculated that processing 100 twenty-page documents costs $31.36 with Textract plus a Bedrock foundation model, versus $20.11 with BDA alone. Gallitelli's hybrid routing model shows that a portfolio of 100,000 monthly documents (60% invoices, 25% IDs, 15% contracts) costs $1,825 per month with smart routing versus $4,000 per month using BDA for everything, a 54% reduction.

As Gallitelli summarizes: "Textract excels at high-volume, standardized document processing with deterministic results and volume discounts. BDA shines with variable documents, multimodal content, and scenarios requiring semantic understanding."

BDA is also limited to us-west-2 and us-east-1 as of June 2025, making Textract the only option in other AWS regions. BDA supports documents up to 20 pages for custom attribute extraction; larger documents require splitting.

AWS's own guidance recommends BDA for fully managed solutions and Textract for high-volume standardized documents at 50,000 or more pages per month requiring 95% or higher accuracy.

Verified production results

Associa, described by AWS as North America's largest community management company managing 48 million documents across 26 TB of data, deployed the GenAI IDP Accelerator using Textract for OCR in a document classification pipeline. Results published in the February 2026 AWS machine learning blog post:

  • OCR plus image input: 95% overall accuracy, 85% on unknown document types, at $0.0055 per document using Amazon Nova Pro
  • Image-only (no Textract OCR): 93% overall accuracy, 50% on unknown document types

The 35-percentage-point drop in unknown document accuracy when removing OCR confirms that Textract's text layer is not redundant with vision-model image understanding for classification tasks.

Cost optimization

Enable only the Textract features you need per document type. Calling TABLES, FORMS, and SIGNATURES on a document that only needs plain text adds cost with no benefit. The GenAI IDP Accelerator cost documentation identifies the primary cost drivers in a full IDP stack: Bedrock tokens, Textract per-page charges, S3 storage, Lambda, Step Functions, and SQS.

Additional levers: compress images before processing to reduce downstream token costs; use prompt caching in Bedrock when processing similar documents with few-shot examples; move processed documents to S3 Infrequent Access using lifecycle policies; monitor with AWS Cost Explorer and AWS Budgets.

Security and compliance

All data is encrypted in transit via TLS and at rest via AWS KMS. Documents are not stored after analysis. Textract supports VPC endpoints via AWS PrivateLink, keeping document traffic within your selected AWS region. Compliance certifications include HIPAA eligibility, SOC 1/2/3, PCI DSS, and ISO 27001.

For clinical document workflows, Amazon Comprehend Medical handles PHI detection and redaction as a complement to Textract extraction.

For extraction approaches that combine Textract with large language models, see the LLM document extraction guide. For table parsing including merged cells and complex layouts where Textract struggles, see the table extraction guide. For a broader view of the IDP vendor landscape, the IDP guides index covers OCR engines, pipeline patterns, and vendor comparisons.