Quickstart

This guide walks you through the complete flow: authenticate, create a family, add a child, generate policies, connect a platform, and trigger enforcement.

Prerequisites

Set your API key as an environment variable:

bash
export PHOSRA_API_KEY="phosra_live_sk_your_key_here"

Option A: Quick Setup (One Call)

The fastest path. Creates everything in a single request:

bash
curl -X POST https://phosra-api.fly.dev/api/v1/setup/quick \
  -H "Authorization: Bearer $PHOSRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "child_name": "Emma",
    "birth_date": "2016-03-15",
    "strictness": "recommended"
  }'

This returns a family, child, active policy, all 45 rules configured for the child's age, and a summary of key settings.

Option B: Step-by-Step

For more control over each stage.

Step 1: Create a Family

bash
curl -X POST https://phosra-api.fly.dev/api/v1/families \
  -H "Authorization: Bearer $PHOSRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Doe Family"}'

Step 2: Add a Child

bash
curl -X POST https://phosra-api.fly.dev/api/v1/families/$FAMILY_ID/children \
  -H "Authorization: Bearer $PHOSRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Emma",
    "birth_date": "2016-03-15"
  }'

Step 3: Create a Policy and Generate Rules

bash
# Create policy
curl -X POST https://phosra-api.fly.dev/api/v1/children/$CHILD_ID/policies \
  -H "Authorization: Bearer $PHOSRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Default Policy"}'
 
# Generate age-appropriate rules
curl -X POST https://phosra-api.fly.dev/api/v1/policies/$POLICY_ID/generate-from-age \
  -H "Authorization: Bearer $PHOSRA_API_KEY"
 
# Activate the policy
curl -X POST https://phosra-api.fly.dev/api/v1/policies/$POLICY_ID/activate \
  -H "Authorization: Bearer $PHOSRA_API_KEY"

Step 4: Connect a Platform

bash
curl -X POST https://phosra-api.fly.dev/api/v1/compliance \
  -H "Authorization: Bearer $PHOSRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "family_id": "'$FAMILY_ID'",
    "platform_id": "nextdns",
    "credentials": "your-nextdns-api-key"
  }'

Step 5: Trigger Enforcement

bash
curl -X POST https://phosra-api.fly.dev/api/v1/children/$CHILD_ID/enforce \
  -H "Authorization: Bearer $PHOSRA_API_KEY"

Step 6: Check Enforcement Results

bash
curl https://phosra-api.fly.dev/api/v1/enforcement/jobs/$JOB_ID/results \
  -H "Authorization: Bearer $PHOSRA_API_KEY"

Next Steps