Complete reference for all API endpoints and SDK functions
These endpoints require your API key and should be called from your backend.
Compare a reference photo with a selfie for face verification.
POST /api/v2/verify
Content-Type: multipart/form-data
Authorization: Bearer API_KEY
Parameter | Type | Description |
---|---|---|
reference | File | The reference photo to verify against (JPEG, PNG, GIF, WebP) |
selfie | File | The selfie photo to verify (JPEG, PNG, GIF, WebP) |
{
"match": true|false,
"confidence": 95.5,
"message": "Face match successful",
"is_spoof": false,
"selfie_image": "base64_encoded_optimized_selfie"
}
Check if a photo is genuine or a spoof attempt.
POST /api/v2/spoof
Content-Type: multipart/form-data
Authorization: Bearer API_KEY
Parameter | Type | Description |
---|---|---|
photo | File | The photo to check for spoofing (JPEG, PNG, GIF, WebP) |
{
"is_spoof": true|false,
"message": "Image appears to be genuine"
}
Detect face in photo and return an optimized crop.
POST /api/v2/optimize
Content-Type: multipart/form-data
Authorization: Bearer API_KEY
Parameter | Type | Description |
---|---|---|
photo | File | The photo to optimize (JPEG, PNG, GIF, WebP) |
{
"success": true,
"image": "base64_encoded_image",
"mime_type": "image/jpeg",
"size": 12345,
"width": 600,
"height": 600
}
Our camera.js library provides an easy way to capture high-quality selfies with real-time face detection.
<script src="/camera.js"></script>
// Initialize camera with callback for when photo is taken
const camera = new VerifyCamera((photoData) => {
if (photoData) {
// photoData contains base64 encoded image
console.log('Photo captured successfully');
}
});
// Start camera interface
await camera.start();
// Camera interface will automatically:
// - Show fullscreen camera view
// - Detect face in real-time
// - Show visual indicator when face is detected
// - Capture optimized photo when face is properly positioned
// - Call callback function with captured photo
// - Close camera interface
// Manually stop camera if needed
camera.stop();
try {
await camera.start();
} catch (error) {
if (error.name === 'NotAllowedError') {
console.error('Camera permission denied');
} else if (error.name === 'NotFoundError') {
console.error('No camera available');
} else {
console.error('Camera error:', error);
}
}