Body Alignment API
Endpoints
GET /api/body-alignment— List all body alignment results for the authenticated user/client.GET /api/body-alignment/[bodyAlignmentResultId]— Fetch a specific body alignment result by its unique ID.POST /api/body-alignment/report— Generate an AI analysis report for a body alignment result.
GET /api/body-alignment
List all body alignment results for the authenticated user/client.
Query Parameters
clientId: string (required) — The client identifier. If not found, a 500 error is returned.
Headers:
Authorization: Bearer <JWT>
Response
200 OK:{ data: Array<BodyAlignmentResult> }401 Unauthorized:{ error: string }500 Internal Server Error:{ error: 'Client ID not found' | string }
Each BodyAlignmentResult object includes:
id: string — Unique result IDclientId: string — Client IDuserId: string — User IDcreatedAt: string (ISO date or Firestore timestamp)measurements: BodyAlignmentMap — Map of body part to measurement (see below)score: number — Overall alignment score (0-1)notes: string (optional)
GET /api/body-alignment/[bodyAlignmentResultId]
Fetch a body alignment result by its unique ID.
Headers:
Authorization: Bearer <JWT>
Path Parameters:
bodyAlignmentResultId: string (required) — The unique result identifier
Response:
200 OK:{ bodyAlignmentResult: BodyAlignmentResult }404 Not Found:{ error: string }401 Unauthorized:{ error: string }500 Internal Server Error:{ error: string }
BodyAlignmentMap Example
{
"shoulder": {
"angle": 5.2,
"deviation": 0.1,
"status": "normal"
},
"hip": {
"angle": 3.8,
"deviation": 0.05,
"status": "normal"
}
}
Sample BodyAlignmentResult Object
{
"id": "align123",
"clientId": "gofa",
"userId": "user456",
"createdAt": "2024-05-24T10:00:00.000Z",
"measurements": {
"shoulder": { "angle": 5.2, "deviation": 0.1, "status": "normal" },
"hip": { "angle": 3.8, "deviation": 0.05, "status": "normal" }
},
"score": 0.92,
"notes": "Good alignment overall."
}
note
The actual schema may include additional fields. For the most up-to-date schema, refer to the body alignment result and measurement models/interfaces in your codebase.
All fields may not be present on every result. Optional and nullable fields are indicated above.
POST /api/body-alignment/report
Generate an AI analysis report for a body alignment result using DeepSeek AI.
Headers:
Content-Type: application/json
Request Body:
{
"bodyAlignmentResult": {
"id": "align123",
"clientId": "gofa",
"userId": "user456",
"createdAt": "2024-05-24T10:00:00.000Z",
"measurements": {
"shoulder": { "angle": 5.2, "deviation": 0.1, "status": "normal" },
"hip": { "angle": 3.8, "deviation": 0.05, "status": "normal" }
},
"score": 0.92,
"notes": "Good alignment overall."
}
}
Response:
200 OK:
{
"report": "string (AI-generated analysis report)"
}
500 Internal Server Error:{ error: "failed to analyze body alignment" }
Notes:
- This endpoint uses DeepSeek AI to generate a detailed analysis report based on the body alignment measurements.
- The report includes insights about posture, potential areas of concern, and recommendations.