Skip to main content
POST
Document Verification
Extract and verify data from identity documents, proof of address, company charters, tax certificates, and bank ownership documents using AI-powered document processing.

Overview

The document verification endpoints use AI (LLM) to extract structured data from uploaded document images. Supported document types:
  • ID Documents: Passports, national IDs, driver’s licenses
  • Proof of Address: Utility bills, bank statements, government letters
  • Company Charters: Corporate registration documents
  • Tax Certificates: Tax registrations, RUC/RFC/VAT/TIN certificates, and equivalent documents
  • Bank Ownership: Bank account ownership verification documents

Endpoints

Authentication

Requires kyc:create permission. Include your Bearer token in the Authorization header.

Request Body Parameters

Supported Image Formats

  • JPEG (image/jpeg)
  • PNG (image/png)
  • PDF (application/pdf)

Zero Data Retention (ephemeral mode)

You can request ephemeral processing with either the X-Data-Retention: ephemeral header or "data_retention": "ephemeral" in the JSON body. Per-request ephemeral must be enabled for your account first: the endpoint identifier documents.extract (or the wildcard *) has to appear in your tenant’s data_processing_config.allowed_ephemeral_endpoints, otherwise the request is rejected with a 400. Tenants can also opt in account-wide by setting data_processing_config.mode to ephemeral — the tenant-level setting always wins over per-request flags and does not require the allowlist. Contact support to enable either option on your account. When ephemeral mode is active, the API returns the normal extraction response but never emits the detailed audit event (which otherwise archives the submitted document images and every extracted field). The platform retains only an aggregate billing metric (one counted document verification, with no document content or extracted-field references); tenants with retain_billing_metrics: false suppress that too. Restrictions in ephemeral mode:
  • Images must be submitted inline as base64. S3-referenced documents are rejected with 400 ZDR_UNSUPPORTED_IMAGE_FORMAT, because a document already stored in a durable bucket cannot honor zero retention.
Document extraction queries third-party providers: the document images are sent to the configured LLM (AWS Bedrock or OpenAI) and, for ID documents, to AWS Textract, which process them under their own no-retention / non-training policies. Ephemeral mode guarantees zero retention in Legaltalent’s own stores.

Request Example

ID Document

Proof of Address

Tax Certificate

Response Format

Success Response - ID Document

Success Response - Proof of Address

Success Response - Company Charter

Success Response - Bank Ownership

Success Response - Tax Certificate

The following example represents a Uruguayan DGI certificate. Values vary by country and by the content printed on the document.

Response Fields

Extracted Data Fields

ID Document Fields

ID documents used as proof of address. Some identity documents print the holder’s domicile (notably the reverse of the Argentine DNI), which is accepted in lieu of a separate proof of address. When such a document is captured with its back/reverse side, the address field is populated and the document’s issuing country is used as the country of residence in the curated extracted block of session webhooks. See residence_country resolution.

Proof of Address Fields

Company Charter Fields

Tax Certificate Fields

All extraction fields are optional. Fields for which no value was found are omitted from the response.
is_valid_document: true only means that the uploaded image matches the expected document category. It does not validate the issuer, detect every possible forgery, query the tax authority, or establish that the taxpayer remains active. Use tax_status as extracted evidence and perform an authoritative registry check when current legal or tax status is required.
tax_status, legal_form, and taxpayer_segment currently preserve free-text document values rather than returning canonical enums. Integrations should preserve unknown values and avoid rejecting responses solely because a new label appears. There is no default validity period calculated from issue_date. A workflow can enforce its own age policy with max_days_since_issue.

Bank Ownership Fields

Error Responses

400 Bad Request - Invalid Image Format

400 Bad Request - Missing Images

400 Bad Request - Invalid Base64

500 Internal Server Error - Processing Failed

Status Codes

Usage Examples

Python Example

JavaScript Example

Best Practices

  • Image Quality: Use high-quality images (minimum 300 DPI) for best results
  • File Size: Keep images under 10MB for optimal performance
  • Multiple Pages: For multi-page documents (PDFs), include all pages in the images array
  • Confidence Scores: Review confidence scores before using extracted data
  • Manual Verification: Always verify extracted data manually for critical operations
  • Error Handling: Implement proper error handling for processing failures

Performance

  • Typical Response Time: 2-5 seconds per document
  • Rate Limits: Subject to API rate limiting (1,000 requests per 5 minutes)
  • File Size Limits: Maximum 10MB per image
  • Concurrent Processing: Process multiple documents in separate requests

LLM Provider Options

AWS Bedrock (Default)

  • Provider: "bedrock" (default)
  • Model: Uses default Bedrock model
  • Use Case: Production deployments on AWS

OpenAI

  • Provider: "openai"
  • Model: Specify model (e.g., "gpt-4o")
  • Use Case: High-precision extraction, specific model requirements

Integration Tips

  1. Pre-processing: Ensure images are properly oriented and well-lit
  2. Batch Processing: Process multiple documents in separate requests
  3. Caching: Consider caching verification IDs for reference
  4. Validation: Validate extracted data against business rules before use