Integration Guide & API Reference

Welcome to the official MYETV Identity Provider documentation. Integrate our adaptive Frontend SDK or direct backend HTTP endpoints to verify identities, enforce anti-forgery forensics, and extract structured data from Electronic Identity Cards (CIE / eID), ICAO Passports, Driver's Licenses, and Residence Permits worldwide.

Production Verification Endpoint: POST https://identityprovider.myetv.tv/api/v1/verify.php
Frontend SDK URL: https://identityprovider.myetv.tv/sdk/mip_sdk.js

2. API Keys & Granular Security Rules

To authenticate requests, create an API Key from your Developer Dashboard. Each key carries its own extraction schema, biometric settings, and security enforcement rules:

Allowed Issuing Countries

By default, new API Keys accept documents from All Countries Enabled. From the creation or edit modal in your dashboard, you can restrict an API Key to a custom subset of issuing countries:

Editing Active API Keys

Active API Keys can be reconfigured at any time directly from the dashboard via the Edit button (next to Test UI and Revoke) without regenerating credentials or breaking live integrations. Revoked or banned keys are read-only.

Forensic Checks & Biometrics

Security Warning: NEVER expose your X-API-SECRET in frontend JavaScript. The Frontend SDK only receives your public apiKey and posts captured files to your own backend proxy, which attaches X-API-KEY and X-API-SECRET server-to-server.

3. Adaptive Capture Widget & Document Catalog

Before opening the camera, file upload, or smartphone handoff QR code, the capture widget guides the user through selecting their Issuing Country and Document Type. Based on this choice, both PC webcam and smartphone scanners adapt automatically:

Automatic Country Detection Priority

When the capture widget loads, it selects the initial country automatically using the following fallback chain (constrained to the API Key's allowed countries):

  1. Explicit Parameter: defaultCountry in MyETVIdentity.init() (or query parameter override).
  2. Browser Locale Region: Extracted from browser language preferences (e.g., it-IT → IT, en-US → US, fr-FR → FR).
  3. Geolocation Header Fallback: Server-side IP country detection when the browser locale lacks a region subtag.
  4. Catalog Fallback: OTHER (if enabled on the API Key) or the first enabled country in the catalog.

Supported Countries & Documents

For countries whose domestic IDs use non-Latin scripts exclusively without English transliteration, the catalog prioritizes International ICAO Passports (which universally include Latin fields and an ASCII MRZ) to guarantee high OCR accuracy.

Country Document ID Label Category Ratio / Sides Features
IT — Italy (Italia) it_cie Electronic ID Card (CIE 3.0) IDENTITY_CARD 1.586:1 • 2 Sides MRZ Barcode
IT — Italy (Italia) passport Italian Passport (Passaporto) PASSPORT 1.42:1 • 1 Side MRZ
IT — Italy (Italia) driver_license Driver's License (Patente di Guida) DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
IT — Italy (Italia) residence_permit Residence Permit (Permesso di Soggiorno) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
FR — France fr_cni_new National ID Card (CNI — Format Carte Bancaire) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
FR — France fr_cni_legacy Legacy National ID Card (CNI — Grand Format ID-2) IDENTITY_CARD 1.42:1 • 2 Sides MRZ
FR — France passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
FR — France driver_license Driver's License (Permis de Conduire) DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
FR — France residence_permit Residence Permit (Titre de Séjour) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
DE — Germany (Deutschland) national_id Personalausweis (National ID) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
DE — Germany (Deutschland) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
DE — Germany (Deutschland) driver_license Führerschein (Driver's License) DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
DE — Germany (Deutschland) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
ES — Spain (España) national_id DNI / NIE (Documento Nacional) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
ES — Spain (España) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
ES — Spain (España) driver_license Permiso de Conducción DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
ES — Spain (España) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
PT — Portugal national_id Cartão de Cidadão IDENTITY_CARD 1.586:1 • 2 Sides MRZ
PT — Portugal passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
PT — Portugal driver_license Carta de Condução DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
PT — Portugal residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
NL — Netherlands (Nederland) national_id Nederlandse Identiteitskaart IDENTITY_CARD 1.586:1 • 2 Sides MRZ
NL — Netherlands (Nederland) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
NL — Netherlands (Nederland) driver_license Rijbewijs DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
NL — Netherlands (Nederland) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
BE — Belgium (België / Belgique) national_id Belgian eID Card IDENTITY_CARD 1.586:1 • 2 Sides MRZ
BE — Belgium (België / Belgique) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
BE — Belgium (België / Belgique) driver_license Driver's License (Rijbewijs) DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
BE — Belgium (België / Belgique) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
AT — Austria (Österreich) national_id Personalausweis IDENTITY_CARD 1.586:1 • 2 Sides MRZ
AT — Austria (Österreich) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
AT — Austria (Österreich) driver_license Führerschein DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
AT — Austria (Österreich) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
CH — Switzerland (Schweiz / Suisse) national_id Swiss Identity Card (IDK) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
CH — Switzerland (Schweiz / Suisse) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
CH — Switzerland (Schweiz / Suisse) driver_license Führerausweis / Permis de conduire DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
CH — Switzerland (Schweiz / Suisse) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
PL — Poland (Polska) national_id Dowód Osobisty IDENTITY_CARD 1.586:1 • 2 Sides MRZ
PL — Poland (Polska) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
PL — Poland (Polska) driver_license Prawo Jazdy DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
PL — Poland (Polska) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
RO — Romania (România) national_id Carte de Identitate IDENTITY_CARD 1.586:1 • 2 Sides MRZ
RO — Romania (România) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
RO — Romania (România) driver_license Permis de Conducere DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
RO — Romania (România) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
SE — Sweden (Sverige) national_id Nationellt Identitetskort IDENTITY_CARD 1.586:1 • 2 Sides MRZ
SE — Sweden (Sverige) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
SE — Sweden (Sverige) driver_license Körkort DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
SE — Sweden (Sverige) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
NO — Norway (Norge) national_id Nasjonalt ID-kort IDENTITY_CARD 1.586:1 • 2 Sides MRZ
NO — Norway (Norge) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
NO — Norway (Norge) driver_license Førerkort DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
NO — Norway (Norge) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
DK — Denmark (Danmark) passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
DK — Denmark (Danmark) driver_license Driver's License (Kørekort) DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
FI — Finland (Suomi) national_id Henkilökortti (National ID) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
FI — Finland (Suomi) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
FI — Finland (Suomi) driver_license Ajokortti (Driver's License) DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
FI — Finland (Suomi) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
IE — Ireland ie_passport_card Irish Passport Card IDENTITY_CARD 1.586:1 • 2 Sides MRZ
IE — Ireland passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
IE — Ireland driver_license Irish Driving Licence DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
GR — Greece (Ελλάδα) national_id Greek National ID Card (Modern Latin/Greek) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
GR — Greece (Ελλάδα) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
GR — Greece (Ελλάδα) driver_license Greek Driving Licence DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
GR — Greece (Ελλάδα) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
BG — Bulgaria (България) national_id Bulgarian ID Card (Лична карта) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
BG — Bulgaria (България) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
BG — Bulgaria (България) driver_license Driving Licence DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
BG — Bulgaria (България) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
CZ — Czechia (Česko) national_id Občanský průkaz IDENTITY_CARD 1.586:1 • 2 Sides MRZ
CZ — Czechia (Česko) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
CZ — Czechia (Česko) driver_license Řidičský průkaz DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
CZ — Czechia (Česko) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
HR — Croatia (Hrvatska) national_id Osobna iskaznica IDENTITY_CARD 1.586:1 • 2 Sides MRZ
HR — Croatia (Hrvatska) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
HR — Croatia (Hrvatska) driver_license Vozačka dozvola DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
HR — Croatia (Hrvatska) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
HU — Hungary (Magyarország) national_id Személyazonosító igazolvány IDENTITY_CARD 1.586:1 • 2 Sides MRZ
HU — Hungary (Magyarország) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
HU — Hungary (Magyarország) driver_license Vezetői engedély DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
HU — Hungary (Magyarország) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
SK — Slovakia (Slovensko) national_id Občiansky preukaz IDENTITY_CARD 1.586:1 • 2 Sides MRZ
SK — Slovakia (Slovensko) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
SK — Slovakia (Slovensko) driver_license Vodičský preukaz DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
SK — Slovakia (Slovensko) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
SI — Slovenia (Slovenija) national_id Osebna izkaznica IDENTITY_CARD 1.586:1 • 2 Sides MRZ
SI — Slovenia (Slovenija) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
SI — Slovenia (Slovenija) driver_license Vozniško dovoljenje DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
SI — Slovenia (Slovenija) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
GB — United Kingdom passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
GB — United Kingdom gb_driver_license UK Photocard Driving Licence DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
GB — United Kingdom gb_brp Biometric Residence Permit (BRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
US — United States passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
US — United States us_driver_license US State Driver's License / State ID DRIVER_LICENSE 1.586:1 • 2 Sides Barcode
US — United States us_passport_card US Passport Card IDENTITY_CARD 1.586:1 • 2 Sides MRZ
US — United States us_green_card Permanent Resident Card (Green Card) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
CA — Canada passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
CA — Canada ca_driver_license Provincial Driver's Licence / Photo Card DRIVER_LICENSE 1.586:1 • 2 Sides Barcode
CA — Canada ca_pr_card Permanent Resident Card RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
AU — Australia passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
AU — Australia au_driver_license Australian Driver Licence / Photo Card DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
BR — Brazil (Brasil) passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
BR — Brazil (Brasil) national_id CIN / RG (Carteira de Identidade) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
BR — Brazil (Brasil) driver_license CNH (Driver's License) DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
MX — Mexico (México) passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
MX — Mexico (México) national_id INE / IFE Credential IDENTITY_CARD 1.586:1 • 2 Sides MRZ
AR — Argentina national_id DNI (Documento Nacional) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
AR — Argentina passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
AR — Argentina driver_license Licencia de Conducir DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
AR — Argentina residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
CL — Chile national_id Cédula de Identidad IDENTITY_CARD 1.586:1 • 2 Sides MRZ
CL — Chile passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
CL — Chile driver_license Licencia de Conducir DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
CL — Chile residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
CO — Colombia national_id Cédula de Ciudadanía IDENTITY_CARD 1.586:1 • 2 Sides MRZ
CO — Colombia passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
CO — Colombia driver_license Licencia de Conducción DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
CO — Colombia residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
TR — Turkey (Türkiye) national_id Turkish ID Card (Kimlik Kartı) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
TR — Turkey (Türkiye) passport Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
TR — Turkey (Türkiye) driver_license Sürücü Belgesi DRIVER_LICENSE 1.586:1 • 2 Sides Visual OCR
TR — Turkey (Türkiye) residence_permit Residence Permit (eRP) RESIDENCE_PERMIT 1.586:1 • 2 Sides MRZ
AE — United Arab Emirates passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
AE — United Arab Emirates ae_emirates_id Emirates ID (Bilingual Arabic/English) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
UA — Ukraine (Україна) passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
UA — Ukraine (Україна) national_id Ukrainian ID Card (Bilingual) IDENTITY_CARD 1.586:1 • 2 Sides MRZ
JP — Japan (日本) passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
JP — Japan (日本) jp_residence_card Residence Card (Zairyu Card — Bilingual) RESIDENCE_PERMIT 1.586:1 • 2 Sides Visual OCR
KR — South Korea (대한민국) passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
CN — China (中国) passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
IN — India passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
SA — Saudi Arabia passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
RU — Russia passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
TH — Thailand passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
OTHER — Other Country (International) passport International Passport (Bio-Data Page) PASSPORT 1.42:1 • 1 Side MRZ
OTHER — Other Country (International) intl_national_id National ID Card (Latin/MRZ Standard ID-1) IDENTITY_CARD 1.586:1 • 2 Sides MRZ

4. Server Configuration & Browser Permissions

Because the capture widget runs inside a cross-origin <iframe>, your host website must allow camera access delegation via the Permissions-Policy HTTP header (e.g., in Apache .htaccess or Nginx):

# Allow iframe camera access for the Identity Provider domain
Header set Permissions-Policy "camera=(self \"https://identityprovider.myetv.tv\")"

5. Integration Methods

Method A: Frontend SDK (Recommended)

The drop-in JavaScript SDK embeds the capture widget iframe, manages secure cross-origin messaging, converts captured Base64 images to binary FormData blobs, and forwards them (along with selfie_image, document_country, and document_type) to your backend proxy.

Frontend Integration (HTML/JS)

<!-- 1. Include the SDK -->
<script src="https://identityprovider.myetv.tv/sdk/mip_sdk.js"></script>

<!-- 2. Create a container for the widget -->
<div id="identity-verification-container" style="width:100%; min-height:600px;"></div>

<script>
    // Define your secure backend proxy endpoint
    var processUrl = "https://[YOURDOMAINURL]/process_identity_verification.php";

    // 3. Initialize the SDK
    MyETVIdentity.init({
        apiKey: 'myetv_live_YOUR_API_KEY', // Required: validates domain, country list & biometrics
        defaultCountry: 'IT',              // Optional: pre-selects country (auto-detected if omitted)
        backendEndpoint: processUrl,
        
        onSuccess: function(result) {
            console.log("Verification Complete!", result);
            alert("Success: " + (result.message || "Verified!"));
        },
        onError: function(error) {
            console.error("Verification Failed:", error);
            alert("Error: " + (error.details || error.message));
        }
    });

    // 4. Mount the widget
    MyETVIdentity.mount('identity-verification-container');
</script>

Your Backend Proxy / Processor (PHP Example)

Your backend handler receives multipart/form-data from the SDK, attaches your secret headers, and forwards the payload to the verification endpoint with a 120-second timeout to safely allow Vision AI inference.

<?php
// process_identity_verification.php (Your Backend Proxy Example)
session_start();
$apiKey    = 'myetv_live_YOUR_API_KEY';
$apiSecret = 'YOUR_API_SECRET';
$endpoint  = 'https://identityprovider.myetv.tv/api/v1/verify.php';

// Ensure primary document image has been uploaded successfully
if (!isset($_FILES['document_front']) || $_FILES['document_front']['error'] !== UPLOAD_ERR_OK) {
    http_response_code(400);
    echo json_encode(['status' => 'error', 'error' => 'missing_front_document']);
    exit;
}

$postFields = [
    'document_front' => new CURLFile(
        $_FILES['document_front']['tmp_name'],
        mime_content_type($_FILES['document_front']['tmp_name']),
        $_FILES['document_front']['name']
    )
];

if (isset($_FILES['document_back']) && $_FILES['document_back']['error'] === UPLOAD_ERR_OK) {
    $postFields['document_back'] = new CURLFile(
        $_FILES['document_back']['tmp_name'],
        mime_content_type($_FILES['document_back']['tmp_name']),
        $_FILES['document_back']['name']
    );
}

if (isset($_FILES['selfie_image']) && $_FILES['selfie_image']['error'] === UPLOAD_ERR_OK) {
    $postFields['selfie_image'] = new CURLFile(
        $_FILES['selfie_image']['tmp_name'],
        mime_content_type($_FILES['selfie_image']['tmp_name']),
        $_FILES['selfie_image']['name']
    );
}

// Forward optional country and document type metadata selected in the widget
if (!empty($_POST['document_country'])) {
    $postFields['document_country'] = $_POST['document_country'];
}
if (!empty($_POST['document_type'])) {
    $postFields['document_type'] = $_POST['document_type'];
}

// Initialize cURL with extended timeout (120s)
$ch = curl_init($endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-API-KEY: ' . $apiKey,
    'X-API-SECRET: ' . $apiSecret
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    $data = json_decode($response, true);
    
    // TODO: Store verified attributes securely in your database
    echo json_encode([
        'status'  => 'success',
        'message' => 'Identity verified and data extracted successfully.',
        'data'    => $data
    ]);
} else {
    http_response_code($httpCode ?: 500);
    echo $response;
}
?>

Method B: Direct Backend REST API (Advanced)

If you build your own camera UI or integrate from a native iOS/Android app, call the verification endpoint directly via POST with multipart/form-data and authentication headers X-API-KEY and X-API-SECRET.

Server-Side MRZ & Barcode Decoding: You do not need to parse PDF417 barcodes or MRZ lines on the client side. Our verification engine decodes barcodes and MRZ natively on the server.
Parameter Type Description
document_front Required File (JPG/PNG/WEBP, ≤10MB) Front side of an ID card/license, or bio-data page of a Passport.
document_back Optional File (JPG/PNG/WEBP, ≤10MB) Back side of 2-sided documents (required if strict MRZ/Barcode rules are enabled for cards).
selfie_image Optional File (JPG/PNG/WEBP, ≤10MB) Live selfie photo (required when Enable Face Matching is active on the API Key).
document_country Optional String (ISO Alpha-2) Issuing country code (e.g., IT, FR, US). Checked against the key's allowed countries and used for AI layout context.
document_type Optional String Catalog document ID (e.g., it_cie, passport, driver_license) to provide layout context.
barcode_data Optional String Client-decoded barcode payload (used as fallback if server-side barcode decoding finds nothing).

cURL Examples

# Example 1: 2-Sided Electronic ID Card (with Face Match)
curl -X POST https://identityprovider.myetv.tv/api/v1/verify.php \
  -H "X-API-KEY: myetv_live_YOUR_API_KEY" \
  -H "X-API-SECRET: YOUR_API_SECRET" \
  -F "document_country=IT" \
  -F "document_type=it_cie" \
  -F "document_front=@/path/to/cie_front.jpg" \
  -F "document_back=@/path/to/cie_back.jpg" \
  -F "selfie_image=@/path/to/selfie.jpg"

# Example 2: 1-Sided Passport Bio-Data Page
curl -X POST https://identityprovider.myetv.tv/api/v1/verify.php \
  -H "X-API-KEY: myetv_live_YOUR_API_KEY" \
  -H "X-API-SECRET: YOUR_API_SECRET" \
  -F "document_country=GB" \
  -F "document_type=passport" \
  -F "document_front=@/path/to/passport_biodata.jpg"

6. JSON Response Structure & Extracted Fields

On success (HTTP 200 OK), the verification endpoint returns a JSON object containing the fields configured on your API Key, normalized ISO dates (YYYY-MM-DD), computed age (years_old), and forensic flags.

{
  "document_type": "IDENTITY_CARD",
  "first_name": "Mario",
  "last_name": "Rossi",
  "date_of_birth": "1995-03-23",
  "place_of_birth": "Roma (RM)",
  "gender": "M",
  "nationality": "ITA",
  "document_number": "CA12345XY",
  "country_of_issuance": "ITA",
  "address": "Via Roma 1, 00100 Roma (RM)",
  "fiscal_code": "RSSMRA85R23H501W",
  "expiration_date": "2030-05-15",
  "mrz_code": "C<ITACA12345XY1<<<<<<<<<<<<<<<9503235M3005158ITA<<<<<<<<<<<4ROSSI<<MARIO<<<<<<<<<<<<<<<<<",
  "is_digitally_forged": false,
  "is_screen_photo": false,
  "face_match_confidence": 96,
  "face_match_passed": true,
  "error": null,
  "years_old": 31
}

Extracted Fields Reference

JSON Key Type Notes
first_name / last_namestring | nullExtracted from document front/MRZ.
date_of_birthstring (YYYY-MM-DD) | nullNormalized to ISO-8601; prioritizes cryptographic MRZ date when available.
place_of_birthstring | nullBirthplace printed on the document.
genderstring | nullTypically M or F.
nationality / country_of_issuancestring | nullNationality and issuing state printed on the document.
addressstring | nullResidential address (present on ID cards; typically absent on passports).
document_typestringClassified as PASSPORT, IDENTITY_CARD, DRIVER_LICENSE, or RESIDENCE_PERMIT.
document_number / fiscal_codestring | nullOfficial document number and national tax/fiscal code if present.
expiration_datestring | nullDocument expiry date.
mrz_codestring | nullRaw MRZ string (returned when MRZ check is Opportunistic or Required).
years_oldint | nullServer-computed age in years derived from date_of_birth.
is_digitally_forged / is_screen_photobooleanELA tampering and monitor Moiré detection flags.
face_match_passed / face_match_confidenceboolean / int (0–100)Included when Enable Face Matching is active.

Age Verification Only Mode Response (JSON)

When Age Verification Only is enabled on the API Key, personal fields are omitted:

{
  "years_old": 31,
  "is_digitally_forged": false,
  "is_screen_photo": false,
  "face_match_passed": true,
  "face_match_confidence": 96
}

How to Parse Extracted Fields in PHP

<?php
$resultData = json_decode($apiResponseString, true);

if (is_array($resultData) && empty($resultData['error'])) {
    $firstName      = $resultData['first_name'] ?? '';
    $lastName       = $resultData['last_name'] ?? '';
    $dateOfBirth    = $resultData['date_of_birth'] ?? '';
    $placeOfBirth   = $resultData['place_of_birth'] ?? '';
    $documentNumber = $resultData['document_number'] ?? '';
    $fiscalCode     = $resultData['fiscal_code'] ?? '';
    $yearsOld       = $resultData['years_old'] ?? null;

    if (!empty($documentNumber)) {
        // Save verified user data securely
    }
}
?>

7. HTTP Error Codes & Troubleshooting

HTTP Status Error / Reason Codes Cause & Resolution
400 Bad Request missing_front_document, missing_selfie_image Missing primary document upload, or Face Matching is enabled without sending selfie_image.
401 Unauthorized Unauthorized: Missing/Invalid Key/Secret Verify X-API-KEY and X-API-SECRET headers and ensure the key is active.
403 Forbidden country_not_allowed, Domain Not Authorized The document's issuing country is not in the key's allowed countries whitelist, or the embedding domain is not authorized.
415 Unsupported Media Type invalid_file Image exceeds 10 MB or is not JPG, PNG, or WEBP.
422 Unprocessable Entity document_rejected, mrz_missing_or_invalid, mrz_validation_failed, barcode_mismatch, image_manipulation_detected, document_unreadable_or_invalid Document is blurry, handwritten/paper fake, edited in Photoshop/GIMP, failed MRZ date cross-check, or missed essential required fields.
429 Too Many Requests rate_limit_exceeded, monthly_quota_exceeded IP brute-force protection triggered, plan burst window reached, or monthly plan quota exhausted.
502 / 500 Server Error ai_engine_unreachable, internal_server_error Temporary Vision AI node unavailability or database error. Ensure client cURL timeout is at least 120 seconds.