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.
Get final approved questions for a video
path Parameters
| video_id required | string |
query Parameters
| companion | string Enum: "bunny" "pig" "alligator" |
Responses
Response samples
- 200
Content type
application/json
{- "success": true,
- "segments": [
- {
- "segment_range_start": 0,
- "segment_range_end": 0,
- "question": "string",
- "answer": "string",
- "llm_ranking": 0,
- "expert_ranking": 0
}
], - "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
- Payload
Content type
application/json
{- "expected": "string",
- "user": "string",
- "question": "string"
}Response samples
- 200
Content type
application/json
{- "similarity": 0,
- "expected": "string",
- "user": "string",
- "is_numeric": true,
- "status": "correct",
- "reason": "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
- Payload
Content type
application/json
{- "child_id": "string",
- "video_id": "string",
- "percentage": 0,
- "total_retries": 0,
- "watch_minutes": 0,
- "interaction_mode": "string",
- "details": [
- { }
]
}Response samples
- 200
Content type
application/json
{ }Response samples
- 200
Content type
application/json
{- "success": true,
- "segments": [
- {
- "segment_range_start": 0,
- "segment_range_end": 0,
- "question": "string",
- "answer": "string",
- "llm_ranking": 0,
- "expert_ranking": 0
}
], - "error": "string"
}Create a new expert account
Request Body schema: application/json
| expert_id required | string |
| display_name required | string |
| password required | string |
Responses
Request samples
- Payload
Content type
application/json
{- "expert_id": "string",
- "display_name": "string",
- "password": "string"
}Response samples
- 200
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
- Payload
Content type
application/json
{- "expert_id": "string",
- "first_name": "string",
- "last_name": "string",
- "icon_key": "string",
- "interaction_mode": "strict"
}Response samples
- 200
Content type
application/json
{ }List all downloaded videos with frame/question status
query Parameters
| include_without_frames | boolean |
Responses
Response samples
- 200
Content type
application/json
{- "success": true,
- "count": 0,
- "videos": [
- {
- "video_id": "string",
- "title": "string",
- "duration_seconds": 0,
- "duration_formatted": "string",
- "has_frames": true,
- "frame_count": 0,
- "has_questions": true,
- "frames_dir": "string",
- "question_file": "string"
}
], - "message": "string"
}Download a YouTube video via yt-dlp
Request Body schema: application/x-www-form-urlencoded
| url required | string |
Responses
Response samples
- 200
Content type
application/json
{- "success": true,
- "message": "string",
- "video_id": "string",
- "title": "string",
- "thumbnail": "string",
- "files": [
- "string"
], - "duration": 0,
- "local_path": "string",
- "subtitle_warning": "string",
- "error_code": "string",
- "recovery_hint": "string",
- "auth_source": "browser",
- "used_player_client": [
- "string"
]
}Submit AI-generated questions for a video
Request Body schema: application/json
| video_id required | string |
required | Array of objects |
Responses
Request samples
- Payload
Content type
application/json
{- "video_id": "string",
- "questions": [
- { }
]
}Response samples
- 200
Content type
application/json
{- "success": true,
- "message": "string",
- "file_url": "string",
- "file_path": "string"
}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
- Payload
Content type
application/json
{- "text": "string",
- "voice": "sage",
- "speed": 0.75,
- "format": "mp3"
}Response samples
- 200
- 400
- 502
Content type
application/json
{- "success": true,
- "audio": "string",
- "format": "string",
- "voice": "string",
- "message": "string"
}