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:
- User Uploads File: The user submits an image or PDF via your frontend.
- API Call: Your backend sends the file to the DocVerify API.
- Forensic Analysis: DocVerify analyzes the file for compression artifacts, metadata anomalies, and visual tampering.
- 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.