# Workout Sessions API

Every completed workout session is stored server-side, tied to the `userId` the SDK was initialized with (sessions are persisted when the workout is launched with `shouldSendStats: true`). Fetch the history to build progress screens, completed-workout lists, or analytics.

```
GET https://data.kinestex.com/api/workout-sessions
```

**Headers:**

| Header | Description |
|--------|-------------|
| `x-api-key` | Your company API key (server-side only) |
| `x-user-id` | The user's id — **always send it**; it must match the SDK's `userId` |

**Query params (all optional):** `page` (default 1), `limit` (default 20, max 50), `sort` (default `started_at_desc`).

**Response** (trimmed to the most useful fields):

```json
{
  "sessions": [
    {
      "id": 4978,
      "content_title": "Fitness Lite",
      "content_image_url": "https://cdn.kinestex.com/uploads%2F...webp",
      "content_difficulty": "Medium",
      "calories_burned": 1.03,
      "actual_duration_seconds": 12,
      "completion_percentage": 0.67,
      "total_exercises": 10
    }
  ],
  "pagination": { "page": 1, "limit": 20, "total": 1, "total_pages": 1, "has_more": false }
}
```

Each session also carries `planned_exercises[]` (with per-exercise thumbnails and rep/time targets), `accuracy_score`, `efficiency_score`, `total_mistakes`, and timestamps.

**Key rules:**
- The values are **actuals**: `calories_burned` is what the user really burned and `actual_duration_seconds` is real time spent (in seconds — format it; don't show "0 min" for short sessions).
- `completion_percentage` (0–100, can be fractional like `0.67`) is authoritative — never derive completion from exercise counts, since `total_exercises` includes untouched exercises.
- **Errors:** `401` invalid `x-api-key` · `404` `x-user-id` not found for your company · `400` bad query param.

To open a full session summary in your app, pass the session `id` to the SDK's custom component view with route `session/{id}`. The complete card-building walkthrough (Swift + Kotlin) is in [Displaying completed workouts](/docs/guides/guide-completed-workouts).

---
Source: https://www.kinestex.com/docs/trainer-api/trainer-api-workout-sessions · Index: https://www.kinestex.com/llms.txt
