Skip to main content

Piggyback Learning API

Piggyback Learning API (0.2.0)

Download OpenAPI specification:Download

OpenAPI contract for Piggyback Learning FastAPI backend. Auth uses session cookies: parent/expert login via POST /api/expert/login, child login via POST /api/learners/parents/login, admin via POST /api/admin/verify-access.

auth

Login and logout for all roles

Verify admin/expert password (legacy)

Request Body schema: application/x-www-form-urlencoded
user_type
required
string
Enum: "admin" "expert"
password
required
string

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "redirect": "string",
  • "message": "string"
}

Admin login with ADMIN_PASSWORD

Request Body schema: application/json
password
required
string

Responses

Request samples

Content type
application/json
{
  • "password": "string"
}

Response samples

Content type
application/json
{ }

Parent/expert login with personal access code

Request Body schema: application/json
access_code
required
string

Responses

Request samples

Content type
application/json
{
  • "access_code": "string"
}

Response samples

Content type
application/json
{ }

Expert logout

Responses

Response samples

Content type
application/json
{ }

Child login - enter parent access code and get linked child profiles

Request Body schema: application/json
access_code
required
string

Responses

Request samples

Content type
application/json
{
  • "access_code": "string"
}

Response samples

Content type
application/json
{ }

kids

Child-facing quiz and video routes

Get children assigned to an expert

path Parameters
expert_id
required
string

Responses

Response samples

Content type
application/json
{ }

Get report for a child

path Parameters
child_id
required
string

Responses

Response samples

Content type
application/json
{ }

Get videos available for a child

path Parameters
child_id
required
string

Responses

Response samples

Content type
application/json
{ }

List all locally available videos for kids

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "count": 0,
  • "videos": [
    ]
}

Get final approved questions for a video

path Parameters
video_id
required
string
query Parameters
companion
string
Enum: "bunny" "pig" "alligator"

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "segments": [
    ],
  • "error": "string"
}

Evaluate a child's voice answer against the expected answer

Request Body schema: application/json
expected
required
string
user
required
string
question
string

Responses

Request samples

Content type
application/json
{
  • "expected": "string",
  • "user": "string",
  • "question": "string"
}

Response samples

Content type
application/json
{
  • "similarity": 0,
  • "expected": "string",
  • "user": "string",
  • "is_numeric": true,
  • "status": "correct",
  • "reason": "string"
}

Transcribe uploaded audio to text

Request Body schema: multipart/form-data
file
required
string <binary>

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "text": "string",
  • "error": "string"
}

Save a completed quiz attempt for a child

Request Body schema: application/json
child_id
required
string
video_id
required
string
percentage
number
total_retries
integer
watch_minutes
number
interaction_mode
string
Array of objects

Responses

Request samples

Content type
application/json
{
  • "child_id": "string",
  • "video_id": "string",
  • "percentage": 0,
  • "total_retries": 0,
  • "watch_minutes": 0,
  • "interaction_mode": "string",
  • "details": [
    ]
}

Response samples

Content type
application/json
{ }

Get all quiz attempts for a child

path Parameters
child_id
required
string

Responses

Response samples

Content type
application/json
{ }

Get frontend quiz configuration (thresholds, skip prevention)

Responses

Response samples

Content type
application/json
{
  • "skip_prevention": true,
  • "thresholds": { }
}

expert

Parent/expert question review and video management

Get the logged-in expert's current access code

Responses

Response samples

Content type
application/json
{ }

Update the logged-in expert's own login code

Request Body schema: application/json
login_code
required
string

Responses

Request samples

Content type
application/json
{
  • "login_code": "string"
}

Response samples

Content type
application/json
{ }

List all parents managed by the logged-in expert

Responses

Response samples

Content type
application/json
{ }

List children linked to a parent

path Parameters
parent_id
required
string

Responses

Response samples

Content type
application/json
{ }

Update a parent's login/access code

path Parameters
parent_id
required
string
Request Body schema: application/json
login_code
required
string

Responses

Request samples

Content type
application/json
{
  • "login_code": "string"
}

Response samples

Content type
application/json
{ }

Get the child progress report for the logged-in expert

Responses

Response samples

Content type
application/json
{ }

List all processed videos available to experts

Responses

Response samples

Content type
application/json
{ }

List videos not yet claimed by any expert

Responses

Response samples

Content type
application/json
{ }

Claim a video for expert review

path Parameters
video_id
required
string

Responses

Response samples

Content type
application/json
{ }

Unclaim a video from the expert

path Parameters
video_id
required
string

Responses

Response samples

Content type
application/json
{ }

Get final questions for a video

path Parameters
video_id
required
string

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "segments": [
    ],
  • "error": "string"
}

Save edited questions for a video

path Parameters
video_id
required
string
Request Body schema: application/json
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

Regenerate a single question for a video using AI

path Parameters
video_id
required
string
Request Body schema: application/json
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

Get companion-variant questions for a video

path Parameters
video_id
required
string

Responses

Response samples

Content type
application/json
{ }

Generate companion-variant questions for a video

path Parameters
video_id
required
string
Request Body schema: application/json
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

Generate companion-variant questions from a question list

Request Body schema: application/json
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

List downloaded videos (shared expert/admin view)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "videos": [
    ],
  • "message": "string"
}

Get AI-generated questions for a video (pre-review)

path Parameters
video_id
required
string

Responses

Response samples

Content type
application/json
{ }

Save expert question payload

Request Body schema: application/json
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

Save final expert-approved questions

Request Body schema: application/json
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

Save expert annotations payload

Request Body schema: application/json
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

Expert edit page for a video (HTML)

path Parameters
video_id
required
string

Responses

admin

Admin-only routes for video processing and account management

List all expert accounts

Responses

Response samples

Content type
application/json
{ }

Create a new expert account

Request Body schema: application/json
expert_id
required
string
display_name
required
string
password
required
string

Responses

Request samples

Content type
application/json
{
  • "expert_id": "string",
  • "display_name": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{ }

Update an expert account

path Parameters
expert_id
required
string
Request Body schema: application/json
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

Delete an expert account

path Parameters
expert_id
required
string

Responses

Response samples

Content type
application/json
{ }

Deactivate an expert account

path Parameters
expert_id
required
string

Responses

Response samples

Content type
application/json
{ }

List all children

query Parameters
expert_id
string
include_inactive
boolean

Responses

Response samples

Content type
application/json
{ }

Create a new child profile

Request Body schema: application/json
expert_id
required
string
first_name
required
string
last_name
string
icon_key
string
interaction_mode
string
Enum: "strict" "flexible" "passive"

Responses

Request samples

Content type
application/json
{
  • "expert_id": "string",
  • "first_name": "string",
  • "last_name": "string",
  • "icon_key": "string",
  • "interaction_mode": "strict"
}

Response samples

Content type
application/json
{ }

Update a child profile

path Parameters
child_id
required
string
Request Body schema: application/json
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{ }

Delete a child profile

path Parameters
child_id
required
string

Responses

Response samples

Content type
application/json
{ }

Deactivate a child profile

path Parameters
child_id
required
string

Responses

Response samples

Content type
application/json
{ }

Unlink a child from their parent

path Parameters
child_id
required
string

Responses

Response samples

Content type
application/json
{ }

List all downloaded videos with frame/question status

query Parameters
include_without_frames
boolean

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "count": 0,
  • "videos": [
    ],
  • "message": "string"
}

List video-to-expert assignments

Responses

Response samples

Content type
application/json
{ }

Assign a video to an expert

Request Body schema: application/json
video_id
required
string
expert_id
required
string

Responses

Request samples

Content type
application/json
{
  • "video_id": "string",
  • "expert_id": "string"
}

Response samples

Content type
application/json
{ }

Download a YouTube video via yt-dlp

Request Body schema: application/x-www-form-urlencoded
url
required
string

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "video_id": "string",
  • "title": "string",
  • "thumbnail": "string",
  • "files": [
    ],
  • "duration": 0,
  • "local_path": "string",
  • "subtitle_warning": "string",
  • "error_code": "string",
  • "recovery_hint": "string",
  • "auth_source": "browser",
  • "used_player_client": [
    ]
}

Extract frames from a downloaded video

path Parameters
video_id
required
string

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "files": [
    ],
  • "video_id": "string",
  • "output_dir": "string",
  • "count": 0
}

Submit AI-generated questions for a video

Request Body schema: application/json
video_id
required
string
required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "video_id": "string",
  • "questions": [
    ]
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "file_url": "string",
  • "file_path": "string"
}

Get full report for a child (admin view)

path Parameters
child_id
required
string

Responses

Response samples

Content type
application/json
{ }

media

Text-to-speech and media utilities

Generate TTS audio

Request Body schema: application/json
text
required
string
voice
string
Default: "sage"
speed
number
Default: 0.75
format
string
Default: "mp3"

Responses

Request samples

Content type
application/json
{
  • "text": "string",
  • "voice": "sage",
  • "speed": 0.75,
  • "format": "mp3"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "audio": "string",
  • "format": "string",
  • "voice": "string",
  • "message": "string"
}