Compliance APIs
Section 9 - Age Gate & Verifiable Parental Consent (VPC)
DPDP Act 2023 Section 9 mandates verifiable parental consent before processing personal data of children (under 18). The age-gate endpoint is the SDK entry point - it evaluates declared age, blocks restricted purposes, and routes minors into the guardian VPC flow.
POST https://api.dpdpashield.in/api/v1/children/age-gate/verify
Package Architecture & Capabilities
Single entry point: /age-gate/verify routes adults and minors automatically
Fail-closed by default - restricted purposes blocked immediately for children
Auto-initiates VPC request when guardian contact is provided
Section 9(2): analytics, marketing, profiling always blocked for minors
DigiLocker / Aadhaar OTP guardian verification (24h token link)
SHA-256 tamper-evident evidence hash per consent event
Step 1 - Age Gate: Verify Date of Birth
typescript// Called from your onboarding / sign-up flow with the user's date of birth.
// Server computes age, applies tenant threshold (default 18), returns routing decision.
const sessionId = crypto.randomUUID();
const res = await fetch('https://api.dpdpashield.in/api/v1/children/age-gate/verify', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.DPDPA_SHIELD_API_KEY
},
body: JSON.stringify({
sessionId, // client-generated UUID for this onboarding session
dob: '2010-05-14' // user's date of birth
})
});
const { data } = await res.json();
// data.isMinor === true → route to guardian consent flow
// data.isMinor === false → proceed with standard adult consent flow
// data.route: 'GUARDIAN_VPC_FLOW' | 'DIRECT_FLOW'
console.log(data.isMinor, data.route);Step 2 - Initiate Parental Consent (minor path)
typescript// Only called when data.isMinor === true.
// Hash the guardian's email on-device before sending (no plaintext PII in transit).
async function sha256(str) {
const buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(str));
return Array.from(new Uint8Array(buf)).map(b => b.toString(16).padStart(2,'0')).join('');
}
const dataPrincipalHash = await sha256(guardianEmail.toLowerCase().trim());
const res = await fetch('https://api.dpdpashield.in/api/v1/children/parental-consent/initiate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.DPDPA_SHIELD_API_KEY
},
body: JSON.stringify({
sessionId, // same UUID from Step 1
guardianEmail, // guardian's email - OTP is sent here
dataPrincipalHash, // SHA-256 of guardian email
dob: '2010-05-14'
})
});
const { data } = await res.json();
// data.consentId - store this to verify OTP in Step 3
// Guardian receives OTP via email
console.log('Consent ID:', data.consentId);Step 3 - Guardian Submits OTP
typescript// Guardian enters the 6-digit OTP from their email.
// On success: result.success === true, plus childAccountId and restrictions.
const res = await fetch('https://api.dpdpashield.in/api/v1/children/parental-consent/verify', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.DPDPA_SHIELD_API_KEY
},
body: JSON.stringify({
consentId: data.consentId, // from Step 2
otp: '482931' // 6-digit OTP entered by guardian
})
});
const { data: result } = await res.json();
if (result.success) {
// Store result.childAccountId as the child's DPDPA account reference
// Apply result.restrictions - purposes always blocked for child accounts:
// ['PURPOSE_ANALYTICS','PURPOSE_MARKETING','PURPOSE_TRACKING',
// 'PURPOSE_BEHAVIORAL_ADS','PURPOSE_PROFILING']
console.log('Child account ID:', result.childAccountId);
console.log('Restrictions applied:', result.restrictions);
console.log('Evidence hash (SHA-256):', result.evidenceHash);
} else {
// Show error - OTP invalid or expired
}Step 4 - Revoke Parental Consent (Section 6(4))
typescript// Guardian can withdraw consent at any time - same ease as granting (Section 6(4)).
// After revocation your system must stop all non-essential processing.
await fetch('https://api.dpdpashield.in/api/v1/children/vpc/revoke', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.DPDPA_SHIELD_API_KEY
},
body: JSON.stringify({
requestId: data.consentId,
reason: 'Guardian requested revocation via privacy portal.'
})
});
// Account transitions to fail-closed state automatically.
// Cascade withdrawal to downstream processors.Configuration Parameters
| Parameter | Type | Description |
|---|---|---|
| sessionId | string (Required) | Client-generated UUID for this onboarding session. Ties age-gate and parental consent steps together. |
| dob | string (Required) | User's date of birth in ISO 8601 format (e.g. 2010-05-14). Server computes age against the tenant's configured threshold (default 18). |
| guardianEmail | string (Required for minors) | Guardian's email address. A 6-digit OTP is sent here for verification. Never stored in plaintext - hash before sending. |
| dataPrincipalHash | string (Required for minors) | SHA-256 of the guardian's email (lowercased, trimmed). Computed client-side so no plaintext PII crosses the wire. |
| consentId | string (Required for OTP step) | Returned by /parental-consent/initiate. References the VPC record being verified. |
Need sandbox API keys for testing?
Create a free developer assessment account in under 60 seconds.