> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phosra.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cookbook

> Multi-endpoint recipes that chain the Phosra API into one working flow — onboard a household, tune an age-appropriate policy per child, push a change to a live platform, connect and disconnect services. Every recipe runs verbatim against the open sandbox.

The single-task [guides](/guides/first-time-setup) each teach **one** endpoint. The **Cookbook**
is different: every recipe here chains **several** endpoints into one real task a household
integration actually performs — onboarding a family with two kids of different ages, tightening a
rule and pushing it to a connected console, connecting and cleanly disconnecting a platform.

Each recipe is a straight line you can copy-paste top to bottom. Every request runs against the
open sandbox with **no API key and nothing to install**, and every response shown is **verbatim
live output** captured while writing the page. Each step links to the exact
[API reference](/api-reference/overview) page for the call it makes.

<Info>
  **Sandbox-first.** Recipes run against `https://phosra-api-sandbox-production.up.railway.app` with
  no credential — nothing you create touches a real family. The request shapes are identical in
  production: swap the base URL for `https://prodapi.phosra.com` and add a `phosra_live_…` key.
</Info>

## Build a family

<CardGroup cols={2}>
  <Card title="End-to-end walkthrough" icon="route" href="/guides/end-to-end-walkthrough">
    The whole family lifecycle in ten calls — create a family, link two platforms, unlink one, prove
    the other survives, and relink. The flagship recipe.
  </Card>

  <Card title="Onboard a multi-child household" icon="users" href="/guides/recipes/multi-child-household">
    One family, two kids of different ages, two distinct age-appropriate policies — generated,
    activated, and cross-checked against each child's rating ceiling.
  </Card>

  <Card title="Change a rule and enforce it" icon="bolt" href="/guides/recipes/policy-change-and-enforce">
    Tighten a screen-time limit, push it to a connected console, and read back exactly which rules
    landed, which were guided, and which the platform can't enforce.
  </Card>

  <Card title="Connect & disconnect a platform" icon="link-slash" href="/guides/disconnect-reconnect">
    The link → verify → disconnect → reconnect lifecycle for a single service, with per-service
    isolation proven at every step.
  </Card>
</CardGroup>

## Operate & recover

The recipes above build a family; these keep it running when things go wrong — a rate limit, a
leaked secret, a dropped platform, a roster that drifted out of sync.

<CardGroup cols={2}>
  <Card title="Back off and retry a 429" icon="clock-rotate-left" href="/guides/recipes/backoff-retry-429">
    Read the live rate-limit headers, drive a real `429`, and wrap every call in a reset-aware retry
    that waits exactly as long as the server says.
  </Card>

  <Card title="Rotate a compromised key" icon="key" href="/guides/recipes/rotate-compromised-key">
    Re-mint your endpoint to rotate the `connect_secret` and `endpoint_id_label` in one signed call —
    the old pair dies, your stable endpoint id survives, enforcement never stops.
  </Card>

  <Card title="Recover a disconnected platform" icon="plug-circle-exclamation" href="/guides/recipes/recover-disconnected-platform">
    Detect a dropped link from the compliance list, re-establish it, re-enforce the current policy,
    and confirm the platform is caught up.
  </Card>

  <Card title="Reconcile family drift" icon="users-gear" href="/guides/recipes/reconcile-family-drift">
    Pull the Phosra roster and the platform's profiles, diff them, and add the children Phosra is
    missing so the two families match.
  </Card>
</CardGroup>

## How a recipe is built

Every recipe follows the same shape, so once you have run one you can read the rest at a glance:

<Steps>
  <Step title="One base URL, set once">
    Every recipe opens with `export PHOSRA_BASE="https://phosra-api-sandbox-production.up.railway.app"`
    so every call below is copy-paste.
  </Step>

  <Step title="IDs chain forward">
    The `id` a call returns is carried into the next call. In cURL you `export` it; in TypeScript
    and Python it is a variable. No step references a value it didn't already receive.
  </Step>

  <Step title="Three languages, identical result">
    Every step has a **cURL**, **TypeScript**, and **Python** tab. All three make the same request
    and produce the same response — pick your stack and read one column.
  </Step>

  <Step title="Real responses, linked reference">
    The JSON under each call is the live sandbox response. The endpoint name links to its API
    reference page, where every field and error is documented.
  </Step>
</Steps>

## Before you start

You need nothing but a terminal (or a TypeScript / Python runtime). There is no signup, no key, and
no install for the sandbox. If you want the seeded family, reference providers, and Trust List these
recipes build on, start with [Test in the sandbox](/guides/test-in-sandbox).

<Note>
  The sandbox is shared and public. IDs you see in these pages were real when captured but the rows
  are periodically reset — **run the calls yourself** and use the IDs your own requests return.
</Note>
