201.
Verified copy-paste. Every command on this page was run on 2026-07-06 against
the hosted spec at
https://phosra-api-sandbox-production.up.railway.app/openapi.yaml
with openapi-generator-cli 7.23.0, openapi-typescript 7.13.0, and
openapi-fetch 0.13. The TypeScript, Python, and Go clients each made the same
live POST /setup/quick call and printed the same three lines:
Emma's Family / preteen / 20.Which spec do I generate from?
Phosra publishes three OpenAPI documents. Pick the one that matches what you are building — generating from the wrong spec gives you endpoints you can’t call.| Spec | Generate from | Use it when you are… |
|---|---|---|
Product API (openapi.yaml) | https://phosra-api-sandbox-production.up.railway.app/openapi.yaml | Building a parental-controls app — families, children, policies, rules, enforcement, quick-setup. This is the one almost everyone wants. Also mirrored at docs.phosra.com/openapi.yaml. |
Control plane (openapi.control-plane.yaml) | https://docs.phosra.com/openapi.control-plane.yaml | Managing your provider account — developer orgs, API keys, federation, advisors. Server-to-server, phosra_ key required. |
Data plane (openapi.data-plane.yaml) | https://docs.phosra.com/openapi.data-plane.yaml | Building an OCSS gatekeeper / resolver — signed profile reads, binding, §8.3.8 confirmations. See the signing caveat below before you generate. |
The sandbox host serves the product API spec (
/openapi.yaml) so generated
clients can point straight at a live server. The two split specs
(openapi.control-plane.yaml, openapi.data-plane.yaml) are served from the docs
site. All three are the same documents that drive the API Reference.Prerequisites
For TypeScript
Node.js 18+. Uses
openapi-typescript (types) + openapi-fetch (runtime). No
Java, no code to vendor — types only.For Python / Go / Java / others
Java 11+ on your
PATH (the openapi-generator engine is a JAR) plus Node
to run npx @openapitools/openapi-generator-cli. Check with java -version.TypeScript — openapi-typescript + openapi-fetch
The idiomatic TS path is types-only generation paired with a tiny typed fetch
wrapper — no generated client code to vendor, and full autocomplete on every path,
body, and response.
Generate the types
phosra.d.ts describing all 80 paths. The /setup/quick entry looks
exactly like this (excerpt from the real generated file):phosra.d.ts (generated)
Python — openapi-generator-cli
Generate the client
*_api.py module per tag
(quick_setup_api.py, families_api.py, policies_api.py, …) plus Pydantic models
for every schema (QuickSetupRequest, QuickSetupResponse, …).Go — openapi-generator-cli
Generate the client
The generator writes a placeholder module path
(
github.com/GIT_USER_ID/GIT_REPO_ID). Edit the first line of
go-client/go.mod to your real module path (below it is example.com/phosra) so
you can import it.Java and everything else
The sameopenapi-generator-cli produces clients for
60+ languages — swap the -g flag.
Java, for example:
-g csharp, -g rust, -g kotlin, -g php, -g ruby,
-g swift5. List every generator with
npx @openapitools/openapi-generator-cli list.
Authenticating a generated client
The verified calls above hit the open sandboxPOST /setup/quick, which needs no
key — that is the sandbox-first path. Real product routes live under /developer/* and
need a phosra_test_ (sandbox) or phosra_live_ (production) key sent as
Authorization: Bearer. Wire it into the generated client’s config:
Get a sandbox key
Mint a
phosra_test_… key on the Keys page. See Authentication
for the full header rules (Authorization: Bearer is canonical; X-Api-Key is
accepted as an equivalent).The data-plane signing caveat
If you generate fromopenapi.data-plane.yaml, be aware that those endpoints are
not plain REST:
For anything on the data plane, use the maintained SDKs that implement the signing:
@openchildsafety/ocss— RFC 9421 sign/verify, sealed envelopes, trust-list verification.@phosra/gatekeeper— the platform-side decision engine that drives the data plane end-to-end (verify profiles, enforce, send §8.3.8 receipts).
openapi.yaml) has no such
caveat — a generated client calls it directly, as shown above.
Pin your generator version
Generators evolve; output can shift between major versions. For reproducible builds, pin the exact version instead of lettingnpx pull latest:
The spec is versioned by the
/api/v1 path and evolves additively (see
Versioning). Re-run the generator after a spec change to pick up new
fields; a regeneration never silently changes an existing field’s type without a
version bump.Next steps
Quickstart
Zero-to-enforcement against the open sandbox — no key needed.
TypeScript SDK
The hand-maintained
PhosraClient if you’d rather not generate.Authentication
Keys, headers, and the
phosra_test_ vs phosra_live_ split.API Reference
Every endpoint, field, and error — the same spec you just generated from.