Skip to main content

Getting Started

Launch PrivateAV biometric age verification on your site in minutes. This quick start focuses on the JavaScript SDK. A production integration still needs server-side session validation or authenticated webhook processing before granting access.

:::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

  1. Log in to the PrivateAV Dashboard
  2. Click API Keys in the sidebar
  3. Copy your publishable key (pk_…)

Step 2 — Install the SDK

Option A: CDN

<script src="https://cdn.jsdelivr.net/npm/@privateav/sdk@3.5.6/sdk.min.js"></script>

Option B: npm

npm install @privateav/sdk@3.5.6

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.6/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') {
// Convenience signal only. Send sessionId to your server and grant
// access only after private-key validation or an authenticated webhook.
console.log('Verification callback received:', sessionId);
} else if (status === 'failed') {
document.body.insertAdjacentHTML('beforeend', '<p>Verification failed.</p>');
}
</script>
</body>
</html>

Step 4 — Understand the user flow

  1. The SDK creates a session with your publishable key
  2. The user grants camera access and captures a selfie
  3. Depending on your verification mode, an ID scan may be requested
  4. PrivateAV redirects back to your returnUrl with non-authoritative status and sessionId notifications
  5. Your server validates sessionId with a secret key, or consumes the authenticated webhook, before changing access

What's Next?

ResourceDescription
JavaScript SDKFull SDK reference with all options
Server IntegrationAPI-based integration with validation
Sessions APIAPI endpoint reference
Verification ModesL1 vs L2 comparison
Code ExamplesAsk support for ready-to-run examples

Need Help?

  • Email: support@privateav.com