Skip to main content

Income Tax OCR APIs

The OCR (Optical Character Recognition) APIs automate the extraction and classification of data from tax documents. These APIs parse PDFs and images to extract structured information for tax workflows.

Supported Documents

How It Works

  1. Upload Document: Submit PDF or image file
  2. Processing: System extracts and classifies data
  3. Get Results: Receive structured JSON with confidence scores
{
  "document_type": "form_16",  
  "file": "Base64 encoded PDF/Image",
  "taxpayer_pan": "AAAPI0000A",
  "financial_year": "2024-25",
  "confidence_threshold": 0.85
}

Processing Flow

  1. Upload Document: Submit PDF/image with metadata
  2. Initial Classification: Auto-detect document type and version
  3. OCR Processing: Extract text and tabular data using advanced AI models
  4. Data Validation: Validate extracted fields against expected patterns
  5. Normalization: Standardize dates, numbers, and formats
  6. Return Results: Return structured JSON with confidence scores

Response Structure

Successful Extraction

{
  "code": 200,
  "data": {
    "document_type": "form_16",
    "confidence": 0.95,
    "extraction_details": {
      "employer": {
        "name": "ABC Technologies Pvt Ltd",
        "pan": "AABCT1234K",
        "address": "Bangalore, Karnataka"
      },
      "employee": {
        "name": "Rajesh Kumar",
        "pan": "BXRPK5678A",
        "designation": "Senior Software Engineer"
      },
      "salary": {
        "gross_salary": 2400000,
        "basic": 1000000,
        "hra": 600000,
        "dearness_allowance": 200000,
        "other_allowances": 400000,
        "deductions": 100000,
        "net_salary": 2300000
      },
      "tax_details": {
        "tds_deducted": 350000,
        "surcharge": 15000,
        "cess": 2000,
        "total_tax": 367000
      },
      "investment_declarations": [
        {
          "section": "80C",
          "investment_type": "Life Insurance",
          "amount": 150000
        }
      ],
      "fy": "2024-25",
      "issue_date": "2025-03-31"
    },
    "extraction_metadata": {
      "pages_processed": 1,
      "extraction_timestamp": "2025-01-20T10:30:00Z",
      "model_version": "v2.1"
    }
  },
  "timestamp": 1750687659809,
  "transaction_id": "txn_ext_123456"
}

Confidence Scores

Each extracted field includes a confidence score (0.0 to 1.0):
{
  "employer_name": {
    "value": "ABC Technologies Pvt Ltd",
    "confidence": 0.98
  },
  "tds_deducted": {
    "value": 350000,
    "confidence": 0.92
  }
}
Interpretation:
  • 0.95+: Very high confidence, can be used directly
  • 0.85-0.95: High confidence, minimal validation needed
  • 0.75-0.85: Moderate confidence, recommend review
  • <0.75: Low confidence, manual verification recommended

Partial Extraction

If some fields cannot be extracted:
{
  "code": 200,
  "data": {
    "document_type": "form_16",
    "confidence": 0.78,
    "extraction_details": { },
    "warnings": [
      {
        "field": "investment_declarations",
        "reason": "Page quality too low",
        "recommendation": "Manual verification suggested"
      }
    ]
  }
}

Integration Patterns

Customer KYC/Income Verification

  1. Accept Form 16 upload from customer
  2. Extract income and employer details
  3. Verify against other sources
  4. Use for lending decisions or account opening

Tax Compliance Workflows

  1. Employee uploads Form 16 from multiple employers
  2. System extracts TDS details from each
  3. Verify total TDS matches Form 26AS (reconcile discrepancies)
  4. Auto-populate ITR with extracted data
  5. Flag any mismatches for manual review

Payroll Integration

  1. HR uploads employee Form 16 PDFs in bulk
  2. Extract salary information and TDS
  3. Validate against payroll records
  4. Reconcile any discrepancies
  5. Generate compliance reports

Document Archival

  1. Upload historical tax documents
  2. Extract and index searchable data
  3. Create audit trail of document processing
  4. Enable quick retrieval and verification

Async Processing Pattern

Like Calculator APIs, OCR operations follow async job-based processing:
  1. Submit Document: POST upload request → Get job_id
  2. Check Status: GET job status endpoint → Receive processing progress
  3. Fetch Results: GET results endpoint → Download extraction results
This enables:
  • Processing of large documents without timeout
  • Bulk processing of multiple documents
  • Progress tracking for UI feedback
  • Retry mechanisms for failed extractions

Error Handling & Validation

Common Issues & Solutions

IssueCauseSolution
Low Confidence ScorePoor document quality or handwritingManual review or re-upload with better quality
Missing FieldsDocument doesn’t contain expected dataVerify correct document type, check document completeness
Incorrect ExtractionWrong field mapping or poor OCRProvide feedback for model improvement, manual correction
Unsupported FormatDocument version not recognizedEnsure document is original/official copy

Quality Checks

  • Page Count: Verify all pages uploaded (multi-page documents)
  • Document Completeness: Ensure all required fields present
  • Data Validity: Validate extracted dates, amounts, PAN formats
  • Cross-field Validation: Verify relationships between fields (e.g., salary components sum to gross)

Best Practices

  • Document Quality: Upload clear, well-lit scans or digital PDFs for best results
  • Complete Documents: Ensure all pages included, especially if multi-page
  • Metadata: Provide taxpayer PAN and financial year for better validation
  • Confidence Thresholds: Set appropriate confidence thresholds for your use case
  • Validation: Always validate extracted data, especially for high-value decisions
  • Feedback: Report extraction errors to improve model accuracy over time
  • Privacy: Handle sensitive documents securely, follow data privacy regulations