Getting Started
Launch PrivateAV biometric age verification on your site in minutes. This quick start focuses on the JavaScript SDK so you can ship without standing up server infrastructure.
:::tip Need Server-Side Control? This guide covers the JavaScript SDK. For API-based integration with server-side session creation and validation, see the Server Integration Guide. :::
:::info Using PHP or WordPress? If your backend is PHP (including WordPress), start with the Server Integration Guide and follow the WordPress Integration Guide for WordPress-specific patterns. :::
Prerequisites
- PrivateAV account (sign up)
- Access to the PrivateAV Dashboard to copy keys
- A web page where you will launch verification (camera access required)
Frontend Quick Start (SDK)
Step 1 — Copy your publishable key
- Log in to the PrivateAV Dashboard
- Click API Keys in the sidebar
- Copy your publishable key (
pk_…)
Step 2 — Install the SDK
Option A: CDN
<script src="https://cdn.jsdelivr.net/npm/@privateav/sdk@3.5.3/sdk.min.js"></script>
Option B: npm
npm install @privateav/sdk
Step 3 — Launch verification
:::warning Local Server Required
You must serve this page from a web server (http://localhost:...). Opening the HTML file directly (file://) won't work because the verification redirect cannot return to local files. Use any of these:
npx serve .python3 -m http.server 8000- Your framework's dev server (
npm run dev) :::
<!DOCTYPE html>
<html>
<head>
<title>Age Verification</title>
<script src="https://cdn.jsdelivr.net/npm/@privateav/sdk@3.5.3/sdk.min.js"></script>
</head>
<body>
<h1>Age Restricted Content</h1>
<button id="verify-btn">Verify Your Age</button>
<script>
// Check if running from a local file (won't work - need a server)
if (window.location.protocol === 'file:') {
document.getElementById('verify-btn').disabled = true;
document.getElementById('verify-btn').textContent = 'Requires local server';
document.body.insertAdjacentHTML('beforeend',
'<p style="color: red;">This page must be served from http://localhost. ' +
'Run: npx serve . or python3 -m http.server 8000</p>');
} else {
// Initialize with your publishable key (pk_...)
const sdk = new PrivateAV({
apiKey: 'pk_your_key_here',
returnUrl: window.location.origin + window.location.pathname
});
document.getElementById('verify-btn').onclick = () => {
// Creates the verification session and opens the PrivateAV flow
sdk.verify();
// Optional: tie the session to your own user ID
// sdk.verify({ externalUserId: currentUserId });
};
}
// Check the status parameter that PrivateAV adds on redirect
const params = new URLSearchParams(window.location.search);
const status = params.get('status');
const sessionId = params.get('sessionId');
if (status === 'verified') {
// User passed verification - show success UI
document.body.insertAdjacentHTML('beforeend', '<p>Age verified!</p>');
// IMPORTANT: For production, validate sessionId server-side
// Client-side status can be forged. See Server Integration Guide.
console.log('Session ID for server validation:', sessionId);
} else if (status === 'failed') {
document.body.insertAdjacentHTML('beforeend', '<p>Verification failed.</p>');
}
</script>
</body>
</html>
Step 4 — Understand the user flow
- The SDK creates a session with your publishable key
- The user grants camera access and captures a selfie
- Depending on your verification mode, an ID scan may be requested
- PrivateAV redirects back to your
returnUrlwithstatus, andsessionId
What's Next?
| Resource | Description |
|---|---|
| JavaScript SDK | Full SDK reference with all options |
| Server Integration | API-based integration with validation |
| Sessions API | API endpoint reference |
| Verification Modes | L1 vs L2 comparison |
| Code Examples | Ask support for ready-to-run examples |
Need Help?
- Email: support@privateav.com