APIDeveloper GuideAI Document VerificationDocument VerificationKYC

Document Verification API: How to Add AI Document Verification to Your Workflow

Léa MarchettiUpdated 10 min read

A practical guide for product and engineering teams adding an AI document verification API before OCR, onboarding, underwriting, expense approval, or agent workflows trust uploaded files.

What a Document Verification API Should Do

A document verification API should answer a question that OCR, extraction, and workflow automation usually skip: does this uploaded file deserve trust before the system acts on it?

If your product accepts bank statements, IDs, receipts, payslips, invoices, proof-of-address files, or payment screenshots, the first technical risk is not whether the text can be parsed. The first risk is whether the file was edited, regenerated, screenshotted, flattened, or manipulated before it reached your workflow.

The key distinction: OCR turns a document into text. AI document verification checks the document itself for authenticity signals before OCR, underwriting, onboarding, reimbursement, compliance review, or an AI agent inherits trust from the upload.


Where AI Document Verification Fits

The cleanest integration point is usually immediately after file intake and before the rest of the workflow treats the file as evidence.

  1. User submits the file through your web app, mobile app, partner portal, or internal upload queue.
  2. Your backend calls the document verification API with the original file, a fetch URL, or raw bytes from object storage.
  3. DocVerify checks authenticity signals such as image artifacts, recompression, metadata anomalies, PDF structure, and suspicious regions.
  4. Your risk logic routes the result to auto-approve, continue OCR, request a replacement, or send the file to manual review.

This sequence prevents a common failure mode: a forged document becomes structured data, the structured data enters a business system, and the original file is no longer questioned.


Use Cases for a Document Verification API

The same authenticity check can support several high-value workflows:

  • KYC and onboarding: verify IDs, proof-of-address documents, payslips, and bank statements before account approval.
  • Lending and underwriting: check uploaded bank statements, proof-of-income files, and application documents before income or cash-flow models use them.
  • Expense and AP automation: screen receipts, invoices, screenshots, and vendor documents before ERP approval or reimbursement.
  • Insurance and claims: detect manipulated estimates, invoices, repair documents, and supporting evidence before claims workflows escalate or pay.
  • AI agent workflows: add a document trust layer before LLMs summarize, approve, classify, or take action on uploaded files.

Those workflows have different policies, but the API pattern is the same: verify the file first, then let OCR and automation operate on documents that passed an authenticity gate.


Step 1: Authenticate Server-Side

Generate an API key in the DocVerify dashboard, then call the API from your backend. Do not expose the key in browser JavaScript, mobile app bundles, public repositories, or client-side automation.

DocVerify accepts API keys in either the X-API-Key header or the standard bearer-token form:

# X-API-Key header
curl -X POST https://docverify.app/api/analyze \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "file=@bank-statement.pdf"

# Authorization bearer header
curl -X POST https://docverify.app/api/analyze \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@bank-statement.pdf"

Step 2: Send the Document

The API supports several upload styles. Use multipart uploads for typical backend services, raw bytes for storage pipelines, and JSON with a URL when the document already lives behind a presigned link.

Multipart upload

# With an API key
curl -X POST \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "file=@user_upload.jpg" \
  -F "models=core_forensics" \
  https://docverify.app/api/analyze

# Or with an OAuth bearer token
curl -X POST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@user_upload.jpg" \
  -F "models=core_forensics" \
  https://docverify.app/api/analyze

Raw binary upload

curl -X POST "https://docverify.app/api/analyze?include_heatmap=true" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/pdf" \
  -H "X-File-Name: customer-statement.pdf" \
  --data-binary @customer-statement.pdf

JSON with a fetch URL

curl -X POST https://docverify.app/api/analyze \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://storage.example.com/uploads/document.pdf",
    "include_heatmap": true,
    "ai_review": true
  }'

Step 3: Integrate from Node.js

Here is a minimal server-side Node example using Axios and a streaming file upload.

const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

const form = new FormData();
form.append('file', fs.createReadStream('/path/to/user_upload.jpg'));
form.append('models', 'core_forensics');

axios.post('https://docverify.app/api/analyze', form, {
  headers: {
    ...form.getHeaders(),
    'X-API-Key': 'YOUR_API_KEY'
  }
}).then(response => {
  console.log(response.data);
}).catch(error => {
  console.error(error);
});

If your stack already uses Axios, the same pattern works: stream the file from disk or object storage, send the file server-side, and keep the API key out of the client.


Step 4: Handle the Response

The API returns structured JSON that your workflow can use for routing. Do not build your integration around one field only. Use status, forensic signals, heatmap availability, error states, and your own risk policy together.

{
  "status": "success",
  "forensic_analysis": {
    "is_authentic": false,
    "confidence_score": 0.12,
    "tampered_regions": [
      {"type": "text_insertion", "box": [120, 450, 300, 480]}
    ],
    "signals": {
      "compression_anomaly": true,
      "metadata_modified": true
    }
  }
}

In most production workflows, a suspicious result should not instantly become a hard rejection. Better default handling is:

  • Low-risk pass: continue to OCR, extraction, approval, or automated review.
  • Ambiguous result: request a clearer original file or route to manual review.
  • Strong tamper signal: block automated approval, preserve the file, and escalate with the forensic reason.
  • API or file error: retry safely, ask for a supported file, or fall back to human review instead of silently approving.

Step 5: Put the API Before OCR

The most important architectural decision is where the call sits. If you verify after OCR, summaries, underwriting rules, reimbursement logic, or agent reasoning, the system has already started trusting the upload.

For a stronger workflow, put the document verification API at the intake boundary:

  1. Upload received
  2. Authenticity checked
  3. Suspicious documents routed
  4. Approved documents passed to OCR and business logic

This is especially important for bank statements, receipts, proof-of-income documents, identity files, and any document that can trigger money movement, account approval, lending decisions, or compliance sign-off.


Best Practices for AI Document Verification

  • Keep original files: Store the original upload or a controlled copy so reviewers can inspect the source, not only extracted text.
  • Use policy-specific thresholds: A $20 receipt, a $20,000 bank statement, and an ID document should not use the same routing rule.
  • Log decisions: Record the API result, review outcome, user action, and final decision for fraud operations and compliance audits.
  • Do not hide uncertainty: If the API flags an issue, show reviewers the signal type and suspicious region instead of a vague "failed" label.
  • Verify before agents act: LLM and agent pipelines should not summarize, approve, or execute based on an unverified file.

What to Build First

If you are adding document verification to an existing product, start with one narrow intake path where fraud cost is obvious.

  • For fintech: bank statement uploads in onboarding or source-of-funds review.
  • For expense platforms: receipt and invoice uploads before reimbursement approval.
  • For lending: proof-of-income and bank statement uploads before underwriting rules run.
  • For AI products: a trust gate before any agent reads or acts on uploaded documents.

Once that path is stable, reuse the same API pattern across other upload workflows.

Ready to build? Read the full API documentation, review the AI document verification overview, or start testing at https://docverify.app.

Frequently Asked Questions

What is a document verification API?

A document verification API lets your backend submit uploaded files for authenticity checks and receive structured JSON about tampering, metadata, forensic signals, confidence, and review routing. It verifies whether the file deserves trust before OCR, approval, or automation acts on it.

What file formats does the document verification API accept?

DocVerify accepts JPEG, PNG, WebP, HEIC, TIFF, BMP, GIF, and PDF. You can send files as multipart uploads, raw bytes, JSON with a fetch URL, or JSON with base64 data.

What does the document verification API return?

The API returns forensic analysis results, billing metadata, and optional heatmap output. A production workflow should inspect authenticity signals, suspicious regions, metadata anomalies, and request status before deciding whether to approve, retry, or send the file to review.

How is AI document verification different from OCR?

OCR reads text from a document. AI document verification asks whether the uploaded file itself appears authentic. It looks at image artifacts, metadata, recompression, PDF structure, suspicious regions, and other signals that OCR usually ignores.

How do I handle verification failures in my application?

Do not auto-reject every suspicious file. Route flagged files to a review queue, request a replacement file when needed, log the forensic signals, and reserve automatic rejection for workflows where your fraud policy already supports that decision.

Add document fraud detection to your workflow

DocVerify is document fraud detection software for AI agents and developer APIs. Catch fake receipts, forged PDFs, manipulated bank statements, and tampered IDs before your system trusts them. See the documents we verify.

Ready to add document verification to your AI agent?

Detect fake receipts, forged PDFs, and manipulated documents before your agent acts.

Get Started with DocVerify

This site uses cookies for authentication and analytics. Free-tier uploads may be retained to improve our models; paid-tier uploads are never stored. Learn more