Launching soon
The managed service is not open yet: https://app.cleardp.in does not accept requests and accounts cannot be created. These pages describe the API as it ships. Join the waitlist to hear when it opens.
The rules
- You decide who is a child. Under the Act a child is anyone under 18 (s.2(f)). The banner never asks a visitor's age; tell it with
data-is-child="true"orsetChild()(see the SDK guide), or sendprincipal.isChild: truefrom your server. Once set, it cannot be unset through the API. To send a child to the page where a guardian verifies, setdata-guardian-urlon the script tag: the banner shows that link to a child whose consent is waiting (see SDK: Children). - Some purposes are never for children. A consent purpose with
allowedForChildren: falseis shown to a child but cannot be granted, and no guardian can change that (the Act bars tracking, behavioural monitoring and targeted advertising aimed at children: DPDP Act s.9(3)). A GRANT is refused withchild-purpose-blocked. - Everything else waits for a guardian. A child's GRANT is refused with
guardian-verification-requireduntil a guardian link for them isVERIFIEDand unexpired (24 months by default). - Refusing is never gated. DENY and WITHDRAW always work for a child.
Setting it up
In the console's setup guide, the purposes step ends with an optional Children block. Answer Yes, they can to see the consent purposes no guardian can unlock, which verification methods your deployment offers, and (as an Admin) switch manual declaration on. To offer a purpose to children, give it a new version with Allowed for children ticked.
Verification methods
| Method | What the guardian does | How it is turned on |
|---|---|---|
DIGILOCKER | Is redirected to DigiLocker and signs in; the result comes back to ClearDP on its own. | Configured by whoever runs the deployment (CLEARDP_GUARDIAN_DIGILOCKER_ENDPOINT, _CLIENT_ID, _CLIENT_SECRET). On the managed service, ask support. |
VIRTUAL_TOKEN | Enters a token issued to them by a token provider; your server submits it. | Configured by the deployment (CLEARDP_GUARDIAN_VT_ENDPOINT). |
MANUAL_DECLARATION | Reads a declaration that they are the child's parent or lawful guardian, ticks it, and types their name. | Off by default. An Admin turns it on with Allow manual declaration in the setup guide's Children block, or Allow manual guardian declaration in Settings. Every use is written to the audit log. |
Your organization's settings report which of the first two are available as guardianMethodsAvailable. Asking for one that is not gets guardian-method-unavailable.
Verifying a guardian
Start a guardian link from your server
With a secret key, name the child and how to reach the guardian, and pick a method. The answer says what happens next.
// Your server, once you know the user is a child (a date of birth at sign-up, say). const r = await fetch('https://api.cleardp.in/v1/guardian-links', { method: 'POST', headers: { Authorization: 'Bearer ' + process.env.CLEARDP_SECRET_KEY, 'Content-Type': 'application/json', 'Idempotency-Key': crypto.randomUUID(), }, body: JSON.stringify({ child: { externalId: child.id, isChild: true }, guardianContact: { email: guardian.email }, verificationMethod: 'DIGILOCKER', // or 'VIRTUAL_TOKEN', 'MANUAL_DECLARATION' }), }); const link = await r.json(); // link.start.action === 'REDIRECT': send the guardian to link.start.redirectUrl // link.start.action === 'COLLECT': collect the answer from the guardian (below)
Let the guardian verify
REDIRECT (DigiLocker): send the guardian to
start.redirectUrl; the link completes when they come back. COLLECT (virtual token, manual declaration): show the guardian a page of your own, then submit what they entered. The guardian completes this page, never the child, and the method comes from the link: the request cannot switch to a weaker one.// The GUARDIAN fills this in, on a page you show them (not the child). await fetch('https://api.cleardp.in/v1/guardian-links/' + link.id + '/verify', { method: 'POST', headers: { Authorization: 'Bearer ' + process.env.CLEARDP_SECRET_KEY, 'Content-Type': 'application/json', }, // VIRTUAL_TOKEN: the token your token issuer gave the guardian // body: JSON.stringify({ token }) // MANUAL_DECLARATION: the guardian's own declaration and typed name body: JSON.stringify({ declaration: { accepted: true, guardianName: typedName } }), });
Check the status
GET /v1/guardian-links/{id}answersPENDING,VERIFIED,FAILEDorEXPIRED. The banner readsguardianVerifiedon the child and lets them grant once it is true. A verified guardian also sees the child in their privacy portal and can manage the child's consent there.
Errors
| Problem type | Means | What to do |
|---|---|---|
child-purpose-blocked | A child tried to grant a purpose not allowed for children. | Nothing a guardian can fix. Do not offer it, or allow it for children in a new purpose version. |
guardian-verification-required | A child's GRANT before any verified, unexpired guardian link. | Start or renew a guardian link, then ask again. |
guardian-method-unavailable | The method is not configured on this deployment, or manual declaration is off. | Pick an available method (see guardianMethodsAvailable). |
guardian-contact-required | POST /v1/guardian-links without a guardian email or phone. | Send the guardian's email or phone. |
guardian-callback-required | /verify was called on a DigiLocker link, which completes through its redirect, not this call. | Send the guardian through the redirectUrl instead. |
All are 422 application/problem+json. Calling /verify on a link that is already verified, failed or expired returns 409 conflict. The full request and response shapes are in the API reference.