Family SDK

Approving a child

Run the consent setup with KidChildSetup, track its status, confirm the result on your backend, and build your own setup screens.

The consent setup is how a parent approves a child for your product. It runs the Family Portal's steps inside your app and writes the consent to k-ID.

Opening a setup

Every child flow sits inside a <KidChildProvider>. How you open it decides the entry:

import { KidChildProvider, KidChildSetup } from '@k-id/family-react'

// A parent starting from your app: they pick one of their children or add a new one.
<KidChildProvider>
  <KidChildSetup onComplete={(result) => {}} onExit={() => {}} onDone={() => {}} />
</KidChildProvider>

// A specific child the parent already manages (for example to finish an abandoned setup).
<KidChildProvider kuid={kuid}>...</KidChildProvider>

// The token from a k-ID email link (KidFamilyRouter does this for you).
<KidChildProvider token={token}>...</KidChildProvider>

Pass at most one of kuid and token. jurisdiction on KidChildProvider overrides the provider's default; an email link carries its own. For email links, use KidFamilyRouter rather than reading the token yourself.

What the setup does

<KidChildSetup> runs the Family Portal's steps in order: overview, child, disclosures, permissions, preferences and screen time, the parent's verification, and the completion screen. The steps shown depend on your product's configuration and the child's jurisdiction.

A child who is already approved for your product finishes straight away, and onComplete still fires. If your product approves other products with it, the setup covers them all. See Multi-product approval.

CallbackWhen
onComplete(result)The child is consented, by this setup or because they already were. result is { ok: true, kuid, claimToken? }.
onExit()The parent left without finishing, after the request is dismissed.
onDone()The completion screen's Done button. The button is shown only when you pass this.
onManageChildren()The completion screen's follow-up to your management view.

Setup status

useKidChildSetup().status tells you where the setup is:

StatusMeaning
loadingThe setup is starting.
child_requiredThe parent picks one of their children or adds one.
consent_requiredThe parent is reviewing and approving.
consentedThe child is approved.
prohibitedThe child is below your product's minimum age.
already_completedThe email link's request was already answered.
invite_cancelledThe invite in the email link was cancelled.
expiredThe email link expired or is not valid. No retry can open it.

<KidChildSetup> shows the Family Portal's page for each of these.

When an email link opens the setup, already_completed, invite_cancelled and expired are statuses, not errors: error stays null.

useKidChildSetup().request.type says what an email link is for: 'consent', 'jurisdiction_update' or 'upgrade'. Declining an upgrade calls onExit and leaves the request pending.

Confirming the result on your backend

When the parent started the setup from your app, the result carries a claimToken. Your backend exchanges it with k-ID for the child's sessionId by calling /client/claim with your secret API key, rather than trusting the kuid the browser reports.

sessionId is a k-ID session like any other approval's. Read it with the usual session APIs.

  • A claim token can be redeemed once. Treat it as opaque; its format can change.
  • A setup opened from a k-ID email link has no claimToken. It answers your product's own challenge, whose result you read through the challenge's status or the Challenge.StateChange webhook.

Never trust the browser's kuid

Anyone can call your backend with a kuid of their choosing. Unlock features only for a session your backend got from /client/claim, a challenge result, or a webhook.

Building your own setup screens

Each step is also a widget you can place yourself, inside the same KidChildProvider, in your own layout:

StepWidget
OverviewKidSetupOverview
ChildKidSetChild
DisclosuresKidAcceptDisclosures
PermissionsKidSetPermissions
Preferences and screen timeKidSetAllowances, or KidSetPreferences and KidSetScreentimeControls separately
Parent's verificationKidVerifyAge (see Parent verification)
CompletionKidSetupComplete

For a fully custom UI, useKidChildSetup() holds the same state the widgets use:

FieldFor
status, isLoaded, entry, kuid, errorWhere the setup is, how it was opened ('new', 'kuid' or 'token'), and the last failure.
children, canAddChild, atChildLimit, prefill, addChild(input), selectChild(kuid)The child step. Each child has selectable and, when it can't be picked, unselectableReason.
steps, products, setProductRemoved(id, removed)The steps this setup walks, and the products it approves.
legalDocuments, dataNotices, acceptAll(), setDisclosureAccepted(id, accepted)The disclosures step.
permissions, decisions, setPermission(name, enabled)The permissions step.
offeredAllowances, allowances, setAllowances(update)Preferences and screen time.
verificationThe parent's age check: required, verified, methods, start(method) and handleMessage(event).
canSubmit, issues, submit(), submittingApproving. issues says why canSubmit is false.
import { useKidChildSetup } from '@k-id/family-react'

function ApproveButton() {
  const setup = useKidChildSetup()
  return (
    <button disabled={!setup.canSubmit || setup.submitting} onClick={() => setup.submit()}>
      Approve
    </button>
  )
}

Preferences and screen time are seeded from your product's defaults and sent on approval even if you never show them. @k-id/family-react/rules exports the Family Portal's own checks, validateChildInput, validateAllowances and validateSchedule, for your own forms.

On this page