Family SDK

Email links

Open k-ID's consent, invite and management emails straight into your app with KidFamilyRouter.

k-ID emails parents when a child asks for consent, when they're invited to link to a child, and with screen-time, purchase and activity updates. Set a Redirect URL under Developer > Family SDK in Compliance Studio, and those emails link to your app instead of the k-ID Family Portal.

Add the router

Put <KidFamilyRouter> on the page you registered as the Redirect URL. It reads the query string and shows the right flow: sign-in, the consent setup, or family management.

import { KidFamilyRouter } from '@k-id/family-react'

export function FamilyPage() {
  return <KidFamilyRouter fallback={<YourNormalPage />} />
}

The page must be inside your KidFamilyProvider, and listed under Domains for the same mode (test or live) as the Redirect URL.

On a server-rendered page, pass the request's query string as search, so the server and the browser's first render show the same thing. Without it the router reads location.search, which the server doesn't have, and React reports a hydration mismatch. A page that renders only in the browser can leave search out.

k-ID's emails link to your Redirect URL with one of these query strings:

LinkOpens
?flow=setup&token=... (sometimes with &kuid=...)A consent request, parent invite or upgrade: sign-in if needed, then the consent setup.
?flow=manage&kuid=...&tab=screentime (or transactions, activity)That child's management, with the tab selected.
?flow=manageThe parent's list of children.

A query string the router can't parse renders fallback (nothing by default). A setup link whose token has expired or been changed still opens as a setup, and k-ID's answer decides what the parent sees: the email-and-code sign-in, or a setup status such as expired.

Sign-in from a link. KidFamilyRouter signs the parent in from the link, or shows the email-and-code sign-in, so the Redirect URL page needs no sign-in of its own.

Router props

Everything works without them. Each one lets you take over a step.

PropDefault without itWith it
onSetupComplete(result)NothingCalled once the child is consented.
onSetupDone()No Done button on the completion screenShows Done and calls this.
onSetupExit()Shows the family list in place after the parent exits the requestYou decide where they go.
onManageChild(kuid)Opens that child's management in place, with BackYou handle the navigation.
searchReads location.searchRoutes on a query string you pass, for example from your router.
fallbackRenders nothingRenders this for any link the router doesn't handle.

A setup opened from an email link answers your product's own challenge, so result carries no claimToken. Read the outcome from the challenge's status or the Challenge.StateChange webhook.

Routing it yourself

If you route yourself, parseKidFamilyRoute(search) returns the same KidFamilyRoute the router uses, or null:

import { parseKidFamilyRoute } from '@k-id/family-react'

const route = parseKidFamilyRoute(window.location.search)
// { flow: 'setup', token, kuid }
// { flow: 'manage', kuid, tab }   tab: 'screentime' | 'transactions' | 'activity'
// { flow: 'manage', kuid: null, tab: null }
// null

Open a setup route with <KidChildProvider token={route.token}>. Open a manage route that names a child with <KidChildProvider kuid={route.kuid}>. When route.kuid is null, show <KidChildList> and open the child the parent picks. Routing yourself skips the link's own sign-in, so render these inside <KidSignedIn> and show <KidTrustedAdultAuth> inside <KidSignedOut> (see Parent sign-in).

On this page