Document Verification
Ensure the authenticity of end-users’ identity documents with a secure and reliable solution. Facia’s robust ID verification system is designed to safeguard against fraud, forgery, data manipulation, and unauthorized alterations. The solution strengthens protection against potential fraudulent activities while ensuring a seamless experience and maintaining high end-user conversion rates.
Generate Document Verification Request
This endpoint initiates a transaction request for document verification and returns response accordingly if the request includes proper authentication and valid fields, as mentioned below in the request parameters, using the POST method.
Endpoint
POSThttps://api.facia.ai/document-verification
Authorization:
Token Type: Client-Secret/Bearer TokenDescription:
This API utilizes Access token or Client-Secret key in header for authentication.
You can use your client_id and client_secret key when using the "/request-access-token" endpoint to obtain a Bearer token for authorization while connecting to this API. For additional details on Authorization, click Here
Request Body Samples:
- HTTP
- Javascript
- Curl
- PHP
- Python
- Ruby
- Java
- C#
- Go
//POST /document-verification HTTP/1.1
//Host: https://api.facia.ai
//Content-Type: application/json
//Headers: client-secret <client_secret_here>
{
"additional_file": "data:image/png;base64,your_image_base64_here",
"file": "data:image/png;base64,your_image_base64_here",
"type": "document_verification"
}
var myHeaders = new Headers();
myHeaders.append("client-secret", "<client_secret_here>");
var raw = JSON.stringify({
"additional_file": "data:image/png;base64,your_image_base64_here",
"file": "data:image/png;base64,your_image_base64_here",
"type": "document_verification"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.facia.ai/document-verification", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location 'https://api.facia.ai/document-verification' \
--header 'Content-Type: application/json' \
--header 'client-secret: <client_secret_here>' \
--data-raw '{
"additional_file": "data:image/png;base64,your_image_base64_here",
"file": "data:image/png;base64,your_image_base64_here",
"type": "document_verification"
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.facia.ai/document-verification',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"additional_file": "data:image/png;base64,your_image_base64_here",
"file": "data:image/png;base64,your_image_base64_here",
"type": "document_verification"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'client-secret: <client_secret_here>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.facia.ai/document-verification"
payload = {
"additional_file": "data:image/png;base64,your_image_base64_here",
"file": "data:image/png;base64,your_image_base64_here",
"type": "document_verification"
}
headers = {
'Content-Type': 'application/json',
'client-secret': '<client_secret_here>'
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
require 'net/http'
require 'uri'
require 'json'
url = URI.parse('https://api.facia.ai/document-verification')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url.path)
request['Content-Type'] = 'application/json'
request['client-secret'] = '<client_secret_here>'
request.body = {
"additional_file": "data:image/png;base64,your_image_base64_here",
"file": "data:image/png;base64,your_image_base64_here",
"type": "document_verification"
}.to_json
response = http.request(request)
puts response.body
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
try {
URL url = new URL("https://api.facia.ai/document-verification");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("client-secret", "<client_secret_here>");
conn.setDoOutput(true);
String jsonInputString = "{ \"additional_file\": \"data:image/png;base64,your_image_base64_here\", \"file\": \"data:image/png;base64,your_image_base64_here\", \"type\": \"document_verification\" }";
try(OutputStream os = conn.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
try(InputStream is = conn.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is, "utf-8"))) {
StringBuilder response = new StringBuilder();
String responseLine;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("client-secret", "<client_secret_here>");
var json = "{\"additional_file\":\"data:image/png;base64,your_image_base64_here\",\"file\":\"data:image/png;base64,your_image_base64_here\",\"type\":\"document_verification\"}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync("https://api.facia.ai/document-verification", content);
string responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
}
}
package main
import (
"bytes"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.facia.ai/document-verification"
jsonStr := []byte(`{
"additional_file": "data:image/png;base64,your_image_base64_here",
"file": "data:image/png;base64,your_image_base64_here",
"type": "document_verification"
}`)
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("client-secret", "<client_secret_here>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
Request Parameters
Parameters | Description |
---|---|
type | Required: Yes Type: string Example: type=document_verification The service type being used. |
file | Required: Yes Type: string (Base64 encoded image) Example: file=data:image/png;base64,your_image_base64_here |
additional_file | Required: No Type: string (Base64 encoded image) Example: additional_file=data:image/png;base64,your_image_base64_here |
Response Sample
{
"status": true,
"message": "success",
"result": {
"data": {
"reference_id": "ABC12345678",
"event": "verification_declined",
"ocr_results": {
"name": {
"first_name": John,
"middle_name": null,
"last_name": Doe,
"full_name": "John Doe"
},
"dob": "1999-01-01",
"expiry_date": "2020-01-01",
"issue_date": "2020-01-10",
"document_number": "1234567892345",
"gender": "M",
"full_address": "123, Street, City, Country",
"age": 25,
"selected_type": [
"id_card"
]
},
"decline_reason": "Uploaded image is found on the internet."
}
}
}
Response Parameters
Parameters | Description |
---|---|
reference_id | Type: string Example: reference_id=ABC12345678 The unique identifier associated with each transaction. |
ocr_results | Type: object The object will include the extracted data from the provided card. |
event | Type: string Indicates the final decision of the transaction. Example: verification_accepted/declined |
decline_reason | Type: string Returns the reason based on which the case was declined. |