Complete integration guide for Agemin age verification. From quick setup to advanced implementations, we've got you covered with code examples, best practices, and interactive testing tools.
Get started with just 3 lines of code
Mean Absolute Error as low as 1.1 years
Privacy-first architecture
Sign up at agemin.com to get started
Navigate to Dashboard → Websites and register your domain
You'll receive an Asset ID like: ast_5b08b274353b92f4
Go to Dashboard → API Keys
age_pk_live_xxxPublic key for frontend SDKage_sk_live_xxxPrivate key for backend API (keep secret!)User completes age verification through SDK (selfie or email)
SDK returns a session token upon completion
Your server validates the session token with our API
Ensures verification is genuine and prevents tampering
Never trust frontend-only verification. Always validate results server-side to prevent billing fraud and ensure compliance.
npm install @bynn-intelligence/agemin-sdk<script src="https://unpkg.com/@bynn-intelligence/agemin-sdk/dist/agemin-sdk.umd.js"></script>import Agemin from '@bynn-intelligence/agemin-sdk';
// Initialize SDK (v5.0.0+ uses singleton pattern)const agemin = new Agemin({ assetId: 'ast_YOUR_ASSET_ID', // From Dashboard → Websites referenceId: generateUniqueId(), // Your unique reference mode: 'modal' // or 'redirect'});
// Start verificationagemin.verify({ onAgePass: (result) => { // User passed age verification console.log('Session token:', result.sessionToken); // Send token to your backend for validation sendToBackend(result.sessionToken); }, onAgeFail: () => { // User is underage window.location.href = '/age-restricted'; }});// Backend validation endpointapp.post('/verify-age', async (req, res) => { const { sessionToken } = req.body; // Validate with Agemin API - check status to prevent injection attacks const response = await fetch(`https://api.agemin.com/v1/agemin/check/status/${sessionToken}`, { method: 'GET', headers: { 'Authorization': 'Bearer age_sk_live_YOUR_PRIVATE_KEY' } }); const data = await response.json(); if (data.status === 'ok' && data.result.passed) { // Grant access req.session.ageVerified = true; res.json({ success: true }); } else { // Deny access res.status(403).json({ error: 'Age verification failed' }); }});Use test API keys to develop without affecting production data:
Public Test Key: age_pk_test_xxxxxPrivate Test Key: age_sk_test_xxxxxUpload any adult face photo or use test email:
test-pass@agemin.comUpload any child face photo or use test email:
test-fail@agemin.com• Test mode always shows a "TEST MODE" banner
• Results are not stored permanently
• Rate limits are lower than production
Verify age before allowing purchase of restricted items
// Check age before checkoutif (cartHasRestrictedItems()) { agemin.verify({ onAgePass: () => { proceedToCheckout(); }, onAgeFail: () => { showRestrictedItemsMessage(); } });}Automatic age verification on app launch
// Auto-verify on game startwindow.addEventListener('load', async () => { const result = await agemin.validateSession({ onAgePass: () => { loadGame(); }, onAgeFail: () => { showParentalControls(); } }); if (result === true) { // User already verified in previous session loadGame(); }});Verify age for mature content
// Check age for mature contentfunction playVideo(videoId) { if (isMatcureContent(videoId)) { agemin.verify({ metadata: { videoId }, // Track what triggered verification onAgePass: () => { startStreaming(videoId); }, onAgeFail: () => { suggestFamilyContent(); } }); } else { startStreaming(videoId); }}Note: Always consult with your legal team to ensure compliance with local regulations. Agemin provides the tools, but implementation must align with your specific requirements.
Follow these guidelines to ensure secure integration.
Our developer support team is here to help you integrate Agemin successfully.