Introducing the DOCSCAN API: Revolutionizing eKYC with AI-Powered Document Scanning
In today's fast-paced digital landscape, ensuring the authenticity of user identities is crucial for businesses. Enter PixLab's cutting-edge DOCSCAN API, a powerful tool designed to streamline the eKYC (electronic Know Your Customer) process. This AI-powered platform offers robust ID document scanning and data extraction capabilities, making it a game-changer for developers and businesses alike.
Key Features of DOCSCAN API
-
Comprehensive Document Support
- The DOCSCAN API supports over 11,000 types of ID documents from 197+ countries, including passports, ID cards, driving licenses, visas, birth certificates, and death certificates. No other KYC platform offers such extensive coverage, making DOCSCAN an industry leader.
-
Advanced Features
- The API includes highly accurate text scanning and automatic face detection and cropping. This ensures precise extraction of essential details from documents, such as full name, issuing country, document number, address, and expiry date.
-
Developer-Friendly Integration
- DOCSCAN is designed with developers in mind. The single REST API endpoint simplifies the integration process, allowing for quick and easy implementation into any application.
Let's dive into how you can integrate this powerful tool into your application.
Versatile Use Cases
DOCSCAN is ideal for various industries and applications, including:
KYC (Know Your Customer): Enhance security across digital platforms.
User Verification: Ensure authenticity in user profiles.
Financial Services: Facilitate international market expansion.
Fraud Detection: Combat identity theft and fraudulent activities.
E-commerce: Prevent chargebacks and combat credit card fraud.
Healthcare: Enhance patient care with secure identity verification.
Travel & Hospitality: Ensure secure, seamless check-in processes for travelers.
Easy Integration with DOCSCAN API
Integrating the DOCSCAN API into your application is straightforward. Here’s a step-by-step guide to get you started:
-
Get Your API Key
- First, you need to sign up at PixLab and generate your API key. This key is essential for authenticating your requests to the DOCSCAN API.
-
Endpoint and Parameters
- The primary endpoint for DOCSCAN is
https://api.pixlab.io/docscan
. You can make GET or POST requests to this endpoint, depending on your preference for uploading the document image.
- The primary endpoint for DOCSCAN is
-
Making a Request
- Here’s a simple example using JavaScript to scan a passport image:
const apiKey = 'YOUR_PIXLAB_API_KEY'; // Replace with your PixLab API Key
const imageUrl = 'http://example.com/passport.png'; // URL of the passport image
const url = `https://api.pixlab.io/docscan?img=${encodeURIComponent(imageUrl)}&type=passport&key=${apiKey}`;
fetch(url)
.then(response => response.json())
.then(data => {
if (data.status !== 200) {
console.error(data.error);
} else {
console.log("Cropped Face URL: " + data.face_url);
console.log("Extracted Fields: ", data.fields);
}
})
.catch(error => console.error('Error:', error));
4.Handling the Response
- The API responds with a JSON object containing the scanned information. This includes URLs to the cropped face image and detailed extracted fields like full name, issuing country, document number, and more.
Additional Code Samples
PHP
Java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
public class DocScanExample {
public static void main(String[] args) {
try {
String apiKey = "YOUR_PIXLAB_API_KEY"; // Replace with your PixLab API Key
String imageUrl = "http://example.com/passport.png"; // URL of the passport image
String urlStr = "https://api.pixlab.io/docscan?img=" + java.net.URLEncoder.encode(imageUrl, "UTF-8") + "&type=passport&key=" + apiKey;
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
conn.disconnect();
JSONObject data = new JSONObject(content.toString());
if (data.getInt("status") != 200) {
System.out.println("Error: " + data.getString("error"));
} else {
System.out.println("Cropped Face URL: " + data.getString("face_url"));
System.out.println("Extracted Fields: " + data.getJSONObject("fields").toString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Comprehensive HTTP Response
The DOCSCAN API endpoint always returns a JSON object. Below are the fields typically included in the response:
status: HTTP status code (200 indicates success).
type: Type of the scanned document.
face_url: URL to the cropped image of the face from the document.
mrz_raw_text: Extracted raw MRZ text (for Passports and Visas only).
fields: A JSON object containing extracted data such as fullName, issuingCountry, documentNumber, address, dateOfBirth, dateOfExpiry, sex, nationality, issuingDate, checkDigit, personalNumber, finalCheckDigit, issuingState, issuingStateCode, religion.
How Does the PixLab DocScan Work?
Do you want to know, what happens when you scan a driving license using the Docscan API? Let’s understand the process step by step. I am summarizing the point here, but you can read more about it in their official documentation.
At first the user’s face is detected using the face detectAPI.
After getting the face coordinate, you can crop and extract the image using image processing API from Pixlab.
Then using Docscan API, Pixlab extracts the information about the user.
After the processing is done, the image is deleted from the server. Pixlab doesn’t store any of the images for future reference. This is a very good move for privacy.
Underthe hood, Pixlab uses PP-OCR which is a practical ultra-lightweight OCR system that is mainly composed of three parts: Text Detection, Bounding Box Isolation, & Text Recognition. Thus Pixlab can generate accurate results by scanning a driver’s license.
Real-World Example
Let's consider a practical example. Suppose you want to verify a user's passport. By using the DOCSCAN API, you can extract all relevant details and store them in your database for future reference. The API also crops the user's face from the passport image, which can be used for profile verification.
// components/DocScanComponent.jsx
import { useState } from 'react';
import axios from 'axios';
const DocScanComponent = () => {
const [imageUrl, setImageUrl] = useState('');
const [scanResult, setScanResult] = useState(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const apiKey = 'YOUR_PIXLAB_API_KEY';
const handleScan = async () => {
setLoading(true);
setError(null);
try {
const response = await axios.get('https://api.pixlab.io/docscan', {
params: {
img: imageUrl,
type: 'passport',
key: apiKey,
},
});
if (response.data.status !== 200) {
setError(response.data.error);
} else {
setScanResult(response.data);
}
} catch (err) {
setError('Error scanning document');
} finally {
setLoading(false);
}
};
return (
<div>
<h1>DocScan</h1>
<input
type="text"
placeholder="Enter Image URL"
value={imageUrl}
onChange={(e) => setImageUrl(e.target.value)}
/>
<button onClick={handleScan} disabled={loading}>
{loading ? 'Scanning...' : 'Scan Document'}
</button>
{error && <p style={{ color: 'red' }}>{error}</p>}
{scanResult && (
<div>
<h2>Scan Result:</h2>
<img src={scanResult.face_url} alt="Cropped Face" />
<pre>{JSON.stringify(scanResult, null, 2)}</pre>
</div>
)}
</div>
);
};
export default DocScanComponent;
This is a demo passport image. The extracted data using Pixlab Docscan API is listed below.
Example Output for a Passport Scan
{
"type": "PASSPORT",
"face_url": "https://s3.amazonaws.com/media.pixlab.xyz/24p5ba822a00df7F.png",
"mrz_img_url": "https://s3.amazonaws.com/media.pixlab.xyz/24p5ba822a1e426d.png",
"mrz_raw_text": "P<UTOERIKSSON<<ANNAXMARIAK<<<<<<<<<<<\nL898962C36UTO7408122F1204159ZE184226B<<<<<16",
"fields": {
"fullName": "ERIKSSON ANNA MARIA",
"issuingCountry": "UTO",
"documentNumber": "L898902C36",
"dateOfBirth": "19740812",
"dateOfExpiry": "20120415",
"sex": "F",
"nationality": "UTO"
}
}
Key Takeaways:
- DOCSCAN API supports 11,000+ document types from 197+ countries
- Easy integration with a single REST API endpoint
- Advanced AI for accurate text scanning and face detection
- Streamlines KYC, user onboarding, and fraud prevention processes
- Compatible with multiple programming languages
Conclusion
PixLab's DOCSCAN API offers a comprehensive and efficient solution for eKYC processes. With support for a vast array of documents, advanced scanning features, and a developer-friendly interface, integrating this API into your application can significantly enhance your identity verification processes.
To learn more, explore the DOCSCAN API documentation and get started today. Revolutionize your eKYC process with PixLab!
For additional resources, code samples, and community-contributed articles, visit the PixLab GitHub Repository and join the conversation with fellow developers.