baseball-engine / backend /docs /reference /frontend_spec_examples.md
github-actions[bot]
Automated Deploy: 0d5b759d8eca219a25b3ab717925e73a66bbf4a4
2756f0f
|
Raw History Blame
1.91 kB

JSON examples from the frontend spec (camelCase there; our API uses snake_case for the same fields)

A1 register request/response: { "email": "ahmed@example.com", "password": "correct-horse-9", "role": "player" } 201 { "user": { "id", "email", "role": "player", "focus": "both", "profile": { "name": "", "age": null, "heightCm": null, "weightKg": null, "bats": "R", "throws": "R", "level": "High school" }, "unit": "imperial", "plan": "free", "privateVideos": true, "teamCode": null, "createdAt" }, "tokens": { "accessToken", "refreshToken", "expiresIn": 3600 } }

Error: { "error": { "code": "EMAIL_TAKEN", "message": "An account with this email already exists." } }

B1 GET /me: { "user": {...same as A1 user...}, "team": { "code": "KDA-4821", "name": "Karachi Diamond Academy", "coachId", "coachName": "Imran Baig", "coaching": "both", "createdAt" }, "entitlement": { "plan": "free", "weeklyLimit": 3, "usedThisWeek": 1, "left": 2, "windowDays": 7 } }

B2 PATCH /me request (all optional): { "role": "coach", "focus": "h", "unit": "metric", "privateVideos": false, "profile": { "name": "Ahmed Rehman", "age": 15, "heightCm": 168, "weightKg": 60, "bats": "R", "throws": "R", "level": "High school" } }

D2 POST /sessions request: { "uploadId": "u9...", "thumbUploadId": "u10...", "mode": "h", "isSelf": true, "athlete": null, "durationSec": 3.87, "fps": 30, "marks": { "contactFrame": 84, "contactOffset": -2, "contactSource": "detected", "strideStartFrame": 58, "strideEndFrame": 79, "pitcherDir": { "from": [0.56, 0.86], "to": [0.90, 0.64] } }, "clientCreatedAt": "2026-10-22T10:12:03Z" }

F1 roster item: { "id", "name": "Ahmed Rehman", "email", "focus": "h", "level": "High school", "joinedAt", "pendingCount": 1, "last": { "h": { "sessionId", "score": 71, "delta": 3, "createdAt", "topFix": "Pelvis load" }, "p": null }, "recent": { "h": [71, 68, 69] } }