Skip to main content

KYC Validation

Agent-TS includes multi-layer KYC document validation with OCR extraction, OpenAI Vision verification, and fraud detection for Sierra Leone National ID cards.

Validation Pipeline

OCR Service

The OCR service uses Tesseract.js to extract text and compute confidence scores.

Extracted Fields

For Sierra Leone National ID cards:

Usage

OCR Result Interface

Vision API Validation

The ID Card Validator uses OpenAI’s Vision API for document authenticity checks.

Validation Checks

Document Type

Verifies the image is a valid Sierra Leone National ID

Photo Presence

Confirms a clear photo is visible on the document

Official Appearance

Checks for official government styling and elements

Text Readability

Ensures text is legible and not obscured

Usage

Fraud Detection

Fraud Indicators

The system detects multiple fraud patterns:

Suspicious Text Patterns

Cross-Validation

When both sides are provided, the system performs cross-validation:

Complete Validation Flow

Single Image Upload

KYC Upgrade (Both Sides)

Configuration

OCR Settings

Confidence Thresholds

Image Requirements

For best results, KYC images should:
  • Minimum resolution: 800x600 pixels
  • Clear, in-focus image
  • Good lighting without glare
  • No blur or motion artifacts
  • ID card fills 70-80% of frame
  • All edges visible
  • No fingers covering text
  • Flat surface (no curves)
  • JPEG or PNG format
  • Maximum file size: 10MB
  • Base64 encoded with data URI prefix

Error Handling

S3 Storage

Validated documents are stored in S3:

Pre-signed URLs

For admin access to KYC documents:

Next Steps

Webhooks

WhatsApp integration for receiving images

Tools Reference

KYC tool definitions