Family SDK

Results and errors

The result shape every Family SDK call returns, the KidError codes, and what to show the parent.

Calls never throw. Each returns { ok: true, ... } or { ok: false, error }, and a hook's error is a KidError or null. A hook's error is for a failed load; a save, approval or removal reports its own failure in the result it returns, so check each one.

A KidError has:

FieldMeaning
codeOne of the codes below (KidErrorCode).
messageA fixed developer message for the code.
statusThe HTTP status, or 0 when no response arrived or the SDK refused the call itself.
detailOptional. What the code refers to, when the code alone is ambiguous.
retryAfterOptional, on rate_limited. The whole seconds to wait before trying again.

Don't show message to parents

message is a fixed developer message, and anyone can read it in the browser console. Show the parent strings.errors[code] from useKidStrings() instead; the widgets already do.

Error codes

CodeMessage
invalid_requestThe request was invalid.
unauthorizedInvalid publishable key or origin.
invalid_tokenSession not found or expired.
invalid_jurisdictionUnknown or invalid jurisdiction code.
invalid_otpInvalid or expired code.
not_foundChild not found.
rate_limitedToo many requests. Please wait and try again.
unavailableSomething went wrong on our side. Please try again.
child_limit_reachedChild limit reached.
grant_access_disabledThis feature isn't enabled for this product.

Error details

detail says what the code refers to when the code alone is ambiguous. These are the only values:

CodeDetail
invalid_tokenlink: an email link's own token is expired, used or invalid. setup: the setup's token is missing or expired. None for the parent's session.
unauthorizedemail: an email link sent to another parent, or for a child this parent doesn't manage. None for the key or origin.
unavailablefeature_disabled: a capability the request needs is turned off, for example trusted-adult linking for an invite link.
invalid_jurisdictionThe jurisdiction code that was sent.
invalid_requestThe permission name, document ID, preference name, product ID or kuid that was refused; irrevocable, revoke_applies or unlink_applies for the wrong kind of access removal; above_access_age, dependent_products or unsupported for a blocked revoke.

Setup outcomes such as already_completed, invite_cancelled and expired are statuses on useKidChildSetup().status, not errors. See Setup status.

Key and origin problems

If a key isn't registered for the page's origin, or a live key for its host, parents see the generic sign-in error, and the SDK logs one console warning with the real reason. Check:

  • The page's origin is listed under Domains for the key's mode in Compliance Studio, including the port for localhost.
  • A live key's baseUrl is your own CNAME'd subdomain, not a k-id.com host.
  • A live key's baseUrl is on the same registrable domain as the page.
  • A test key's baseUrl is https://family.test.k-id.com.
  • Your Content-Security-Policy allows the baseUrl origin in connect-src and frame-src, and the live-key bot check (see the Quickstart).
  • Your app calls baseUrl directly, not through a proxy of your own.

On this page