APIDeveloper GuideIntegrationDocument Verification

How to Integrate a Document Verification API in Minutes

DocVerify TeamMarch 26, 20266 min read

A developer-focused guide on integrating an AI document verification API into your app. Add forensic forgery detection to your workflow with just a few lines of code.

Why You Need a Document Verification API

If your application accepts user-uploaded documents—receipts, invoices, IDs, or bank statements—you are a target for document fraud. Building your own forensic image analysis engine is complex, expensive, and outside the core competency of most engineering teams.

That is where a document verification API comes in. By calling a dedicated service, you can instantly add AI document verification to your backend, flagging manipulated files before they poison your database or trigger automated actions.


The Integration Workflow

Integrating the DocVerify API is straightforward. The typical architecture looks like this:

  1. User Uploads File: The user submits an image or PDF via your frontend.
  2. API Call: Your backend sends the file to the DocVerify API.
  3. Forensic Analysis: DocVerify analyzes the file for compression artifacts, metadata anomalies, and visual tampering.
  4. Response Handling: Your backend receives a JSON response with an authenticity score and decides whether to accept, reject, or flag the document for manual review.

Step-by-Step Integration

Step 1: Get Your Credentials

Sign up for a DocVerify account and either generate an API key from the Admin Dashboard, or use the OAuth flow to obtain a bearer token. Every endpoint accepts both: send X-API-Key: YOUR_KEY or Authorization: Bearer YOUR_TOKEN. Use whichever your stack supports — they authenticate against the same account.

Step 2: Make the API Request

You can send documents via a standard multipart form upload. Here is an example using cURL:

# 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

Or, if you prefer using Node.js and Axios:

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);
});

Step 3: Handle the Response

The API returns a detailed JSON object. The most important field is the confidence_score or is_authentic boolean.

{
  "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
    }
  }
}

Based on this response, your application logic can automatically reject the upload and prompt the user to submit a genuine document.


Best Practices for API Integration

  • Never expose your API key: Always make calls from your backend server, never directly from the client-side browser or mobile app.
  • Handle errors gracefully: Implement fallback logic in case of network timeouts or unsupported file types.
  • Set risk thresholds: Not all workflows require the same strictness. You might accept a document with an 80% authenticity score for a $10 expense, but require 95% for a $10,000 wire transfer.

Ready to build? Read the full API Documentation and start integrating AI document verification today.

Frequently Asked Questions

How do I add document verification to my application?

Generate an API key, POST the document file to the verification endpoint, and parse the authenticity score and tampered-region heatmap from the JSON response. Five minutes end-to-end for a basic integration.

What file formats does the document verification API accept?

JPEG, PNG, WebP, HEIC, TIFF, BMP, and GIF. PDFs should be exported to images first because most forensic signals operate on raster data.

What does the document verification API return?

An authenticity confidence score (0–1), a list of detected tampering signals (compression, font, metadata, vision model), optional heatmap highlighting suspicious regions, and the extracted document metadata.

Should I verify every document or just high-risk ones?

For high-volume low-risk documents, sample-based verification works fine. For financial, identity, or compliance documents, verify every upload — the per-document cost is low and the per-fraud cost is high.

How do I handle verification failures in my application?

Don't auto-reject on low confidence. Route flagged documents to a human review queue, surface the specific forensic signals that triggered the flag, and let a reviewer make the final call. This reduces false-positive friction.

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