Dashboard

SDK Documentation

Official SDKs for integrating VerifyHuman in Python, Node.js, and PHP.

Overview

VerifyHuman provides official SDKs to simplify integration in popular programming languages. Each SDK handles authentication, request formatting, and error handling automatically.

Available SDKs:


Python SDK

Installation

pip install verifyhuman

Quick Start

from verifyhuman import VerifyHumanClient

# Initialize client
client = VerifyHumanClient(api_key='vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6')

# Verify a human
with open('selfie.jpg', 'rb') as image_file:
    result = client.verify_human(image_file)

if result.status == 'PASS':
    print(f"Verified! Confidence: {result.confidence}%")
else:
    print(f"Failed: {result.error}")

VerifyHuman

# Basic verification
result = client.verify_human('path/to/image.jpg')

# With file object
with open('selfie.jpg', 'rb') as f:
    result = client.verify_human(f)

# Response
print(result.status)        # 'PASS' or 'FAIL'
print(result.confidence)    # 0-100
print(result.token)         # JWT token for backend validation
print(result.verification_id)

VerifyAge

from verifyhuman import VerifyAgeClient

client = VerifyAgeClient(api_key='vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6')

# Two-step verification
session = client.init_verification(
    use_case='alcohol',
    min_age=21,
    state='CA'
)

# Step 1: Age estimation
step1_result = client.verify_age_estimation(
    session_id=session.id,
    selfie_path='selfie.jpg'
)

# Step 2: ID verification (if needed)
if step1_result.requires_id:
    step2_result = client.verify_id(
        session_id=session.id,
        id_front_path='id_front.jpg',
        id_back_path='id_back.jpg'  # Optional
    )

print(f"Age verified: {step2_result.age_verified}")
print(f"Estimated age: {step2_result.estimated_age}")

VerifyIdentity

from verifyhuman import VerifyIdentityClient

client = VerifyIdentityClient(api_key='vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6')

# Full identity verification
result = client.verify_identity(
    selfie_path='selfie.jpg',
    id_front_path='id_front.jpg',
    id_back_path='id_back.jpg',  # Optional
    verify_face_match=True
)

# Extracted data
print(f"Name: {result.extracted_data.full_name}")
print(f"DOB: {result.extracted_data.date_of_birth}")
print(f"ID Number: {result.extracted_data.id_number}")
print(f"Face Match: {result.face_match_confidence}%")

VerifyTrust

from verifyhuman import VerifyComplianceClient

client = VerifyComplianceClient(api_key='vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6')

# KYC with compliance screening
result = client.verify_compliance(
    selfie_path='selfie.jpg',
    id_front_path='id_front.jpg',
    first_name='John',
    last_name='Doe',
    date_of_birth='1990-01-15',
    country='US'
)

# Compliance screening results
screening = result.compliance_screening
print(f"Total hits: {screening.total_hits}")

if screening.total_hits > 0:
    for match in screening.matches:
        print(f"Category: {match.category}")  # PEP, Sanctions, AML, RCA
        print(f"Name: {match.name}")
        print(f"Score: {match.score}")

    # Generate encrypted PDF report
    pdf_bytes = client.generate_report(result.verification_id)
    with open('compliance_report.pdf', 'wb') as f:
        f.write(pdf_bytes)

Token Validation

# Validate JWT token from frontend
is_valid = client.validate_token(token)

# Get full validation details
validation = client.validate_token_details(token)
print(f"Valid: {validation.valid}")
print(f"Status: {validation.status}")
print(f"User ID: {validation.user_id}")
print(f"Timestamp: {validation.timestamp}")

Error Handling

from verifyhuman.exceptions import (
    InvalidAPIKeyError,
    InsufficientCreditsError,
    RateLimitError,
    VerificationError
)

try:
    result = client.verify_human('selfie.jpg')
except InvalidAPIKeyError:
    print("API key is invalid or expired")
except InsufficientCreditsError as e:
    print(f"Need {e.credits_required} credits, have {e.credits_available}")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after} seconds")
except VerificationError as e:
    print(f"Verification failed: {e.message}")

Configuration

client = VerifyHumanClient(
    api_key='vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6',
    timeout=30,  # Request timeout in seconds
    max_retries=3,  # Automatic retry on network errors
    base_url='https://app.verifyhuman.io'  # Custom base URL
)

Async Support

from verifyhuman import AsyncVerifyHumanClient

async def verify_user():
    async with AsyncVerifyHumanClient(api_key='vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6') as client:
        result = await client.verify_human('selfie.jpg')
        return result

# Use with asyncio
import asyncio
result = asyncio.run(verify_user())

Node.js SDK

Installation

npm install @verifyhuman/sdk

Or with Yarn:

yarn add @verifyhuman/sdk

Quick Start

const { VerifyHumanClient } = require('@verifyhuman/sdk');
const fs = require('fs');

// Initialize client
const client = new VerifyHumanClient({ apiKey: 'vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' });

// Verify a human
const image = fs.createReadStream('selfie.jpg');
const result = await client.verifyHuman(image);

if (result.status === 'PASS') {
  console.log(`Verified! Confidence: ${result.confidence}%`);
} else {
  console.log(`Failed: ${result.error}`);
}

VerifyHuman

const { VerifyHumanClient } = require('@verifyhuman/sdk');

const client = new VerifyHumanClient({ apiKey: 'vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' });

// From file path
const result = await client.verifyHuman('./selfie.jpg');

// From buffer
const imageBuffer = fs.readFileSync('./selfie.jpg');
const result = await client.verifyHuman(imageBuffer);

// From stream
const imageStream = fs.createReadStream('./selfie.jpg');
const result = await client.verifyHuman(imageStream);

// Response
console.log(result.status);        // 'PASS' or 'FAIL'
console.log(result.confidence);    // 0-100
console.log(result.token);         // JWT token
console.log(result.verificationId);

VerifyAge

const { VerifyAgeClient } = require('@verifyhuman/sdk');

const client = new VerifyAgeClient({ apiKey: 'vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' });

// Two-step verification
const session = await client.initVerification({
  useCase: 'alcohol',
  minAge: 21,
  state: 'CA'
});

// Step 1: Age estimation
const step1 = await client.verifyAgeEstimation({
  sessionId: session.id,
  selfie: './selfie.jpg'
});

// Step 2: ID verification (if needed)
if (step1.requiresId) {
  const step2 = await client.verifyId({
    sessionId: session.id,
    idFront: './id_front.jpg',
    idBack: './id_back.jpg'  // Optional
  });

  console.log('Age verified:', step2.ageVerified);
  console.log('Estimated age:', step2.estimatedAge);
}

VerifyIdentity

const { VerifyIdentityClient } = require('@verifyhuman/sdk');

const client = new VerifyIdentityClient({ apiKey: 'vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' });

// Full identity verification
const result = await client.verifyIdentity({
  selfie: './selfie.jpg',
  idFront: './id_front.jpg',
  idBack: './id_back.jpg',  // Optional
  verifyFaceMatch: true
});

// Extracted data
console.log('Name:', result.extractedData.fullName);
console.log('DOB:', result.extractedData.dateOfBirth);
console.log('ID Number:', result.extractedData.idNumber);
console.log('Face Match:', result.faceMatchConfidence + '%');

VerifyTrust

const { VerifyComplianceClient } = require('@verifyhuman/sdk');

const client = new VerifyComplianceClient({ apiKey: 'vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' });

// KYC with compliance screening
const result = await client.verifyCompliance({
  selfie: './selfie.jpg',
  idFront: './id_front.jpg',
  firstName: 'John',
  lastName: 'Doe',
  dateOfBirth: '1990-01-15',
  country: 'US'
});

// Compliance screening results
const screening = result.complianceScreening;
console.log('Total hits:', screening.totalHits);

if (screening.totalHits > 0) {
  for (const match of screening.matches) {
    console.log('Category:', match.category);  // PEP, Sanctions, AML, RCA
    console.log('Name:', match.name);
    console.log('Score:', match.score);
  }

  // Generate encrypted PDF report
  const pdfBuffer = await client.generateReport(result.verificationId);
  fs.writeFileSync('compliance_report.pdf', pdfBuffer);
}

Token Validation

// Validate JWT token from frontend
const isValid = await client.validateToken(token);

// Get full validation details
const validation = await client.validateTokenDetails(token);
console.log('Valid:', validation.valid);
console.log('Status:', validation.status);
console.log('User ID:', validation.userId);
console.log('Timestamp:', validation.timestamp);

Error Handling

const {
  InvalidAPIKeyError,
  InsufficientCreditsError,
  RateLimitError,
  VerificationError
} = require('@verifyhuman/sdk');

try {
  const result = await client.verifyHuman('./selfie.jpg');
} catch (error) {
  if (error instanceof InvalidAPIKeyError) {
    console.error('API key is invalid or expired');
  } else if (error instanceof InsufficientCreditsError) {
    console.error(`Need ${error.creditsRequired} credits, have ${error.creditsAvailable}`);
  } else if (error instanceof RateLimitError) {
    console.error(`Rate limited. Retry after ${error.retryAfter} seconds`);
  } else if (error instanceof VerificationError) {
    console.error(`Verification failed: ${error.message}`);
  }
}

Configuration

const client = new VerifyHumanClient({
  apiKey: 'vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6',
  timeout: 30000,  // Request timeout in milliseconds
  maxRetries: 3,   // Automatic retry on network errors
  baseUrl: 'https://app.verifyhuman.io'  // Custom base URL
});

TypeScript Support

import { VerifyHumanClient, VerificationResult } from '@verifyhuman/sdk';

const client = new VerifyHumanClient({ apiKey: 'vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' });

const result: VerificationResult = await client.verifyHuman('./selfie.jpg');

if (result.status === 'PASS') {
  console.log(`Confidence: ${result.confidence}`);
}

PHP SDK

Installation

composer require verifyhuman/sdk

Quick Start

<?php
require 'vendor/autoload.php';

use VerifyHuman\Client;

// Initialize client
$client = new Client('vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6');

// Verify a human
$result = $client->verifyHuman('selfie.jpg');

if ($result->status === 'PASS') {
    echo "Verified! Confidence: {$result->confidence}%\n";
} else {
    echo "Failed: {$result->error}\n";
}

VerifyHuman

<?php
use VerifyHuman\Client;

$client = new Client('vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6');

// From file path
$result = $client->verifyHuman('path/to/selfie.jpg');

// From uploaded file
$result = $client->verifyHuman($_FILES['selfie']['tmp_name']);

// Response
echo $result->status;           // 'PASS' or 'FAIL'
echo $result->confidence;       // 0-100
echo $result->token;            // JWT token
echo $result->verificationId;

VerifyAge

<?php
use VerifyHuman\VerifyAgeClient;

$client = new VerifyAgeClient('vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6');

// Two-step verification
$session = $client->initVerification([
    'useCase' => 'alcohol',
    'minAge' => 21,
    'state' => 'CA'
]);

// Step 1: Age estimation
$step1 = $client->verifyAgeEstimation([
    'sessionId' => $session->id,
    'selfie' => 'selfie.jpg'
]);

// Step 2: ID verification (if needed)
if ($step1->requiresId) {
    $step2 = $client->verifyId([
        'sessionId' => $session->id,
        'idFront' => 'id_front.jpg',
        'idBack' => 'id_back.jpg'  // Optional
    ]);

    echo "Age verified: {$step2->ageVerified}\n";
    echo "Estimated age: {$step2->estimatedAge}\n";
}

VerifyIdentity

<?php
use VerifyHuman\VerifyIdentityClient;

$client = new VerifyIdentityClient('vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6');

// Full identity verification
$result = $client->verifyIdentity([
    'selfie' => 'selfie.jpg',
    'idFront' => 'id_front.jpg',
    'idBack' => 'id_back.jpg',  // Optional
    'verifyFaceMatch' => true
]);

// Extracted data
echo "Name: {$result->extractedData->fullName}\n";
echo "DOB: {$result->extractedData->dateOfBirth}\n";
echo "ID Number: {$result->extractedData->idNumber}\n";
echo "Face Match: {$result->faceMatchConfidence}%\n";

VerifyTrust

<?php
use VerifyHuman\VerifyComplianceClient;

$client = new VerifyComplianceClient('vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6');

// KYC with compliance screening
$result = $client->verifyCompliance([
    'selfie' => 'selfie.jpg',
    'idFront' => 'id_front.jpg',
    'firstName' => 'John',
    'lastName' => 'Doe',
    'dateOfBirth' => '1990-01-15',
    'country' => 'US'
]);

// Compliance screening results
$screening = $result->complianceScreening;
echo "Total hits: {$screening->totalHits}\n";

if ($screening->totalHits > 0) {
    foreach ($screening->matches as $match) {
        echo "Category: {$match->category}\n";  // PEP, Sanctions, AML, RCA
        echo "Name: {$match->name}\n";
        echo "Score: {$match->score}\n";
    }

    // Generate encrypted PDF report
    $pdfData = $client->generateReport($result->verificationId);
    file_put_contents('compliance_report.pdf', $pdfData);
}

Token Validation

<?php
// Validate JWT token from frontend
$isValid = $client->validateToken($token);

// Get full validation details
$validation = $client->validateTokenDetails($token);
echo "Valid: {$validation->valid}\n";
echo "Status: {$validation->status}\n";
echo "User ID: {$validation->userId}\n";
echo "Timestamp: {$validation->timestamp}\n";

Error Handling

<?php
use VerifyHuman\Exceptions\InvalidAPIKeyException;
use VerifyHuman\Exceptions\InsufficientCreditsException;
use VerifyHuman\Exceptions\RateLimitException;
use VerifyHuman\Exceptions\VerificationException;

try {
    $result = $client->verifyHuman('selfie.jpg');
} catch (InvalidAPIKeyException $e) {
    echo "API key is invalid or expired\n";
} catch (InsufficientCreditsException $e) {
    echo "Need {$e->getCreditsRequired()} credits, have {$e->getCreditsAvailable()}\n";
} catch (RateLimitException $e) {
    echo "Rate limited. Retry after {$e->getRetryAfter()} seconds\n";
} catch (VerificationException $e) {
    echo "Verification failed: {$e->getMessage()}\n";
}

Configuration

<?php
$client = new Client('vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6', [
    'timeout' => 30,  // Request timeout in seconds
    'maxRetries' => 3,  // Automatic retry on network errors
    'baseUrl' => 'https://app.verifyhuman.io'  // Custom base URL
]);

Laravel Integration

<?php
// config/services.php
return [
    'verifyhuman' => [
        'api_key' => env('VERIFYHUMAN_API_KEY'),
    ],
];

// In your controller
use VerifyHuman\Client;

class VerificationController extends Controller
{
    protected $client;

    public function __construct()
    {
        $this->client = new Client(config('services.verifyhuman.api_key'));
    }

    public function verify(Request $request)
    {
        $result = $this->client->verifyHuman($request->file('selfie')->path());

        if ($result->status === 'PASS') {
            auth()->user()->update(['verified' => true]);
            return redirect()->route('dashboard')->with('success', 'Verified!');
        }

        return back()->withErrors(['verification' => $result->error]);
    }
}

SDK Comparison

Feature Python Node.js PHP
Async Support
TypeScript
Streaming Uploads
Auto Retry
Error Types
Token Validation
Webhook Helpers

Common Patterns

Caching Verification Results

# Python with Redis
import redis
from verifyhuman import VerifyHumanClient

cache = redis.Redis(host='localhost', port=6379)
client = VerifyHumanClient(api_key='vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6')

def verify_cached(user_id, image_path):
    cache_key = f'verification:{user_id}'
    cached = cache.get(cache_key)

    if cached:
        return json.loads(cached)

    result = client.verify_human(image_path)
    cache.setex(cache_key, 3600, json.dumps(result.to_dict()))  # 1 hour cache
    return result

Webhook Signature Verification

// Node.js
const { VerifyHumanClient } = require('@verifyhuman/sdk');

const client = new VerifyHumanClient({ apiKey: 'vhk-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' });

app.post('/webhook', (req, res) => {
  const signature = req.headers['x-verifyhuman-signature'];
  const payload = JSON.stringify(req.body);

  if (client.verifyWebhookSignature(payload, signature)) {
    console.log('Webhook verified:', req.body);
    res.sendStatus(200);
  } else {
    res.sendStatus(401);
  }
});

Installation from Source

Python

git clone https://github.com/verifyhuman/python-sdk.git
cd python-sdk
pip install -e .

Node.js

git clone https://github.com/verifyhuman/node-sdk.git
cd node-sdk
npm install
npm link

PHP

git clone https://github.com/verifyhuman/php-sdk.git
cd php-sdk
composer install

SDK Repositories


Contributing

We welcome contributions! See CONTRIBUTING.md in each SDK repository.


Support

SDK-specific issues:

General support:


Last Updated: November 16, 2025
SDK Versions: