# Customization Parameters

This section describes every launch parameter the KinesteX SDK accepts, what each one does, and **which integration option(s) it applies to**. A parameter sent to an integration that does not read it is ignored, so check the **Applies to** column first.

**How parameters reach KinesteX:**
- **SDK arguments**: credentials, `UserDetails`, `IStyle` and the view's own arguments (workout name, exercise list, ...) of the SDK's create call.
- **Custom params**: everything else, as a flat key/value map: Swift `customParams: [String: Any]`, Kotlin `customParams = mutableMapOf(...)`, Flutter `customParams: Map<String, dynamic>`, React Native and React `data.customParameters` (the SDK merges its keys into the top level of the launch message).
- **HTML/JS**: every parameter is a top-level key of the launch object you `postMessage` to the iframe.
- **URL query string**: most parameters can also go in the launch URL, one by one or as a single `?data=` payload. A value sent by postMessage overrides the URL value, except `?style=` and `?delegate=`, where the URL wins. See [URL Parameters](/docs/customization-parameters/url-parameters).

Launch parameters are read once, when the launch is verified (`kinestex_launched`). To control a running session, send the messages in [Workout Activity Actions](/docs/customization-parameters/workout-activity-actions).

**Integration scope labels used throughout this section:**

| Label | Integration option (SDK method) | Internal route |
|-------|--------------------------------|----------------|
| **All** | Every integration option | - |
| **Main** | Complete UX: `createMainView` (Swift `createCategoryView`) | `/` |
| **Workout** | `createWorkoutView` | `/workout/{id}` |
| **Plan** | `createPlanView` | `/plan/{id}` |
| **Personalized Plan** | `createPersonalizedPlanView` | `/personalized-plan` |
| **Custom Workout** | `createCustomWorkoutView` | `/custom-workout` |
| **Workout player** | Shorthand for every flow that runs the KinesteX exercise player and results screen: Main, Workout, Plan, Personalized Plan, Custom Workout and AI Trainer workouts (Challenge where noted) | - |
| **Gym Log** | The set logger the workout player uses when AI motion tracking is off | `/workout/gym-log` |
| **Challenge** | `createChallengeView` | `/challenge` |
| **Leaderboard** | `createLeaderboardView` | `/leaderboard` |
| **Experiences (Games)** | `createExperienceView` (Kotlin `createExperiencesView`) with `balloonpop`, `colorchase`, `aliensquatshooter` | `/experiences/assessment` |
| **Assessments** | `createExperienceView` with experience `assessment` | `/experiences/assessment` |
| **Camera** | `createCameraComponent` (Swift `createCameraView`) | `/camera` |
| **Plan Onboarding** | `createCustomComponentView` with route `plan-onboarding` | `/plan-onboarding` |
| **AI Trainer** | [AI Trainer Chat](/docs/ai-trainer-chat) | `/trainer` |

**Quick task index:**
- Test the integration **without physically performing exercises**: [`videoURL`, Testing & Simulation](/docs/customization-parameters/testing-simulation)
- Save workout results to the KinesteX backend: [`shouldSendStats`](/docs/customization-parameters/session-data)
- Jump into the middle of a workout: [`start_from_exercise`](/docs/customization-parameters/workout-configuration)
- Switch exercises at runtime in the Camera component: [Camera Component parameters](/docs/customization-parameters/camera-component-params)
- Get reps, form state, presence and gestures as they happen: [Real-Time Motion Events](/docs/customization-parameters/realtime-motion-params)
- Control a running session (pause, mute, camera off, reset): [Workout Activity Actions](/docs/customization-parameters/workout-activity-actions)

## Required Parameters

These parameters are mandatory for a successful launch. **Applies to: All integrations.**

| Parameter | Type | Description |
|-----------|------|-------------|
| userId | string | Unique identifier of your user. Nothing is verified without it, and a value shorter than 2 characters posts `error_occurred` (`severity: "critical"`, `"User ID is missing: ..."`). Used for progress, analytics and personalization |
| company | string | Your company name. Compared in lowercase. The value as you sent it is the default `themeName` |
| key | string | Your API key, sent as the `x-api-key` header of the verify call. Required unless you send `session` |
| session | string | A short-lived session id created by your backend with your API key ([Sessions API](/docs/trainer-api/trainer-api-sessions)), sent as the `x-session-id` header. Send it instead of `key` so the key never ships inside your app. When both are present, `session` is used. On session launches the backend's subscription status overrides `isSubscribed` |

**Replies:** `kinestex_launched` when the launch is verified, or `error_occurred` (`severity: "critical"`, `"Cannot verify: ..."`) when it is not.

**SDK Support:**
- **Swift, Kotlin, Flutter:** `apiKey`, `companyName` and `userId` are arguments of the SDK setup. For session auth, leave out `apiKey` and pass `"session"` in `customParams` of the create call.
- **React Native:** `data.key` or `data.session`, plus `data.company` and `data.userId`.
- **React (`kinestex-sdk-react-ts`):** `key`, `company` and `userId` are required. This SDK has no session field.
- **HTML/JS:** top-level keys of the launch object.

**Required Parameters Setup**

_Swift (iOS)_
```swift
// API key
let kinestex = KinesteXAIKit(
    apiKey: "YOUR_API_KEY",
    companyName: "YOUR_COMPANY",
    userId: "unique-user-id"
)

// Session auth: leave out apiKey and pass the session in customParams of the create call,
// e.g. customParams: ["session": sessionId]
let kinestexWithSession = KinesteXAIKit(
    companyName: "YOUR_COMPANY",
    userId: "unique-user-id"
)
```

_Kotlin (Android)_
```kotlin
// API key. For session auth, leave out apiKey and pass
// customParams = mutableMapOf("session" to sessionId) to the create call.
KinesteXSDK.initialize(
    context = this,
    apiKey = "YOUR_API_KEY",
    companyName = "YOUR_COMPANY",
    userId = "unique-user-id"
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY', // or session: sessionId
  userId: 'unique-user-id',
  company: 'YOUR_COMPANY',
};
```

_Flutter_
```dart
// API key. For session auth, leave out apiKey and pass
// customParams: {"session": sessionId} to the create call.
await KinesteXAIFramework.initialize(
  apiKey: "YOUR_API_KEY",
  companyName: "YOUR_COMPANY",
  userId: "unique-user-id",
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "unique-user-id",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY", // or session: sessionId
};
```

_React (TypeScript)_
```tsx
// kinestex-sdk-react-ts requires key (no session field)
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'unique-user-id',
  company: 'YOUR_COMPANY',
};
```

## Testing & Simulation (videoURL)

**How to test the integration without physically performing the exercises.**

**Applies to: Workout player, Challenge, Camera, Assessments.** Not supported by the games (Balloon Pop, Color Chase, Alien Squat Shooter): they always use the live camera.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| videoURL | string | none | Workout player, Challenge, Camera, Assessments | Replaces the live camera as the motion-tracking input. Instead of opening the device camera, the SDK plays the URL in its internal `<video>` element and runs the full pose-tracking pipeline on it: rep counting, form analysis, accuracy scoring and statistics all work as if a person were moving in front of the camera |

**Behavior details:**
- The video **loops** until the session ends, so reps keep counting for as long as the exercise runs.
- The video is loaded with `crossOrigin="anonymous"`, so the URL must be **CORS-accessible** (served with `Access-Control-Allow-Origin`), otherwise landmark extraction fails.
- Pose processing runs on the main thread when `videoURL` is set (the web-worker path is only used for the live camera). This does not change results.
- No camera permission is needed for the video itself.
- The video should show one fully visible person performing the target exercise, filmed like a normal front-facing camera feed. The exercise's own demo video from the [Content API](/docs/content-api) (`video_URL` field) works as a ready-made input.

**Recommended testing recipe:**
1. Pass `videoURL` pointing at a recording of the exercise being performed.
2. Pass `shouldSendStats: true` if you want the simulated session saved to the backend ([Session & Data Saving](/docs/customization-parameters/session-data)) so you can check it in the Workout Sessions API.
3. Optionally add `showSilhouette: false` to skip the positioning (check frame) screen, or `immediateShowSkip: true` to show its Skip button at once.
4. Optionally use `start_from_exercise` (with `completed_exercises` and `start_from_rest: true`) to jump to a later part of the workout ([Workout Configuration](/docs/customization-parameters/workout-configuration)).

**When NOT to use `videoURL`:** if you only need to click through screens without tracking data, `motionTrackingEnabled: false` (see [Motion Tracking Settings](/docs/customization-parameters/motion-tracking-settings)) turns the camera off. Users then log their sets by hand in the Gym Log (or get auto-advancing timers with `selfModeEnabled: false`), and **no pose-based accuracy or form data is produced**. Use `videoURL` when you need realistic tracking data without a person.

**Simulate a workout with a prerecorded video**

_Swift (iOS)_
```swift
// The full tracking pipeline runs on the video
kinestex.createWorkoutView(
    workout: "Fitness Lite",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "videoURL": "https://cdn.yourapp.com/test/squats-demo.mp4",
        "shouldSendStats": true // save the simulated session
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
// The full tracking pipeline runs on the video
KinesteXSDK.createWorkoutView(
    context = this,
    workoutName = "Fitness Lite",
    customParams = mutableMapOf(
        "videoURL" to "https://cdn.yourapp.com/test/squats-demo.mp4",
        "shouldSendStats" to true // save the simulated session
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
// The full tracking pipeline runs on the video
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'test-user-1',
  company: 'YOUR_COMPANY',
  customParameters: {
    videoURL: 'https://cdn.yourapp.com/test/squats-demo.mp4',
    shouldSendStats: true, // save the simulated session
  },
};
```

_Flutter_
```dart
// The full tracking pipeline runs on the video
KinesteXAIFramework.createWorkoutView(
  workoutName: "Fitness Lite",
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  customParams: {
    "videoURL": "https://cdn.yourapp.com/test/squats-demo.mp4",
    "shouldSendStats": true, // save the simulated session
  },
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
// The full tracking pipeline runs on the video
const postData = {
  userId: "test-user-1",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  videoURL: "https://cdn.yourapp.com/test/squats-demo.mp4",
  shouldSendStats: true, // save the simulated session
};
```

_React (TypeScript)_
```tsx
// The full tracking pipeline runs on the video
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'test-user-1',
  company: 'YOUR_COMPANY',
  customParameters: {
    videoURL: 'https://cdn.yourapp.com/test/squats-demo.mp4',
    shouldSendStats: true, // save the simulated session
  },
};
```

## User Profile

Parameters that describe the user, for calorie estimates, profile sync and AI Trainer prefill.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| age | number | 30 | All | An **age** (1 to 120) or a **birth year** (1900 to the current year); both are converted to a birth year. Sent to the verify call as `birth_year`, used for calorie (BMR) estimates and the profile sync below, and prefills the AI Trainer |
| gender | string | "male" | All | `"male"` or `"female"` (the AI Trainer also takes `"other"`). Used for calorie estimates, the profile sync and the AI Trainer prefill. Demo videos are picked by `content_gender` instead ([Language & Localization](/docs/customization-parameters/language-localization)) |
| height | number | 160 | All | Height in **cm**. Used for calorie estimates, the profile sync and the AI Trainer prefill |
| weight | number | 70 | All | Weight in **kg**. Used for calorie estimates, the profile sync and the AI Trainer prefill |
| lifestyle | string | "lightly_active" | Main, Personalized Plan | `"sedentary"`, `"lightly_active"`, `"active"`, `"moderately_active"` or `"very_active"` (any letter case). Sent to the verify call and used by the profile sync below. React Native and React: send it in `customParameters` |
| body_parts | string[] | [] | AI Trainer | Prefills the trainer's target areas when the user has none yet. Values (any letter case): Full Body, Upper body, Lower body, Shoulders, Abs, Ex.oblique, Chest, Biceps, Triceps, Forearms, Traps, Lats, Lower back, Glutes, Quads, Hamstrings, Adductors, Abductors, Calves. Unknown values are dropped |

**Defaults vs. provided values:** the SDK tracks which of `age`, `gender`, `height` and `weight` you *explicitly* passed. Calorie estimates (Mifflin-St Jeor BMR) and the AI Trainer prefill only use **explicitly provided** values: if any of weight, height, age or gender is missing, calories fall back to a fixed default BMR instead of using the defaults above. A complete profile gives noticeably more accurate calorie numbers.

**Backend profile sync:** on Main, Personalized Plan and personalized assessment launches, when `age` (valid), `height` > 0, `weight` > 0 and a `lifestyle` from the list above are all provided, the SDK saves them once per user and company to the KinesteX user profile (used by personalized plans). Partial profiles are never synced, so existing server data is not overwritten with defaults.

**AI Trainer:** `age`, `gender`, `height` and `weight` prefill the trainer's profile step. The trainer also uses the user's BMI when it recommends fitness goals. See [AI Trainer parameters](/docs/customization-parameters/ai-trainer-params).

**SDK Support:** Swift, Kotlin and Flutter take a `UserDetails` object on the create call. React Native and React take `age`, `height`, `weight` and `gender` in `data`. HTML/JS: top-level keys.

**User Profile Configuration**

_Swift (iOS)_
```swift
let user = UserDetails(
    age: 30,
    height: 180, // cm
    weight: 75, // kg
    gender: .Male,
    lifestyle: .Active
)

kinestex.createWorkoutView( // same user argument on every create*View method
    workout: "Fitness Lite",
    user: user,
    style: nil,
    isLoading: $isLoading,
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
val userDetails = UserDetails(
    age = 30,
    height = 180, // cm
    weight = 75, // kg
    gender = Gender.MALE,
    lifestyle = Lifestyle.ACTIVE
)

KinesteXSDK.createWorkoutView( // same user argument on every create*View method
    context = this,
    workoutName = "Fitness Lite",
    user = userDetails,
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  age: 30,
  height: 180, // cm
  weight: 75, // kg
  gender: 'male',
  customParameters: {
    lifestyle: 'active',
  },
};
```

_Flutter_
```dart
final userDetails = UserDetails(
  age: 30,
  height: 180, // cm
  weight: 75, // kg
  gender: Gender.Male,
  lifestyle: Lifestyle.Active,
);

KinesteXAIFramework.createWorkoutView( // same user argument on every create*View method
  workoutName: "Fitness Lite",
  user: userDetails,
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  age: 30,
  height: 180, // cm
  weight: 75, // kg
  gender: "male",
  lifestyle: "active",
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  age: 30,
  height: 180, // cm
  weight: 75, // kg
  gender: 'male',
  customParameters: {
    lifestyle: 'active',
  },
};
```

## Theme & Appearance

Control the visual appearance of the application. **Applies to: All integrations.**

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| style | "dark" or "light" | "dark" | All | Theme mode requested from the backend at verification. It switches the whole UI color scheme |
| themeName | string | the `company` value | All | Which theme (managed in the Admin Dashboard) to load. The resolved theme is cached in the WebView and only downloaded again when its version changes |

**Precedence note:** a `?style=dark` or `?style=light` in the launch URL **wins over the `style` value sent by postMessage**. The SDKs send `IStyle` in the launch URL. If you see the wrong mode, check the launch URL first.

**SDK Support:**
- **Swift, Kotlin, Flutter:** the `IStyle` object of the create call (`style`, `themeName`, plus the [loading screen colors](/docs/customization-parameters/loading-screen))
- **React Native, React:** the `style` object in `data`
- **HTML/JS:** top-level keys of the launch object, or the iframe URL (`?style=light`)

**Theme Configuration**

_Swift (iOS)_
```swift
kinestex.createWorkoutView(
    workout: "Fitness Lite",
    user: nil,
    style: IStyle(
        style: "light",
        themeName: "CustomBrand"
    ),
    isLoading: $isLoading,
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView(
    context = this,
    workoutName = "Fitness Lite",
    style = IStyle(
        style = "light",
        themeName = "CustomBrand" // theme name from the Admin Dashboard (default: company name)
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  style: {
    style: 'light', // 'dark' or 'light'
    themeName: 'CustomBrand',
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView(
  workoutName: "Fitness Lite",
  style: IStyle(
    style: 'light', // 'dark' or 'light'
    themeName: 'CustomBrand',
  ),
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  style: "light",
  themeName: "CustomBrand",
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  style: {
    style: 'light', // 'dark' or 'light'
    themeName: 'CustomBrand',
  },
};
```

## Language & Localization

Configure the language for all UI text, voice prompts and content.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| language | string | "en" | All | Loads the UI locale, sets the `Language` header on later KinesteX API calls (so backend content arrives translated) and selects the language of the spoken audio cues. Changing the language between sessions clears the cached speech audio. A code the UI does not support shows the UI in English |
| voiceActor | string | "Glinda" | All views with spoken audio | Text-to-speech voice for all spoken coaching cues (speech files are fetched per voice). Changing it clears the cached speech audio so the new voice is downloaded |
| content_gender | string | "female" | Workout player, Challenge, Leaderboard, Assessments, AI Trainer | `"male"` or `"female"`. Selects which exercise **demo video** is shown (in workouts, plans, assessments and the AI Trainer chat cards, the thumbnail too): `"male"` uses the exercise's male media where it exists, otherwise the default (female) media. This is about the on-screen instructor, not the user's own gender |

**Warmup launches:** the warmup the Kotlin and Flutter SDKs load on `initialize` (and React Native's `KinestexWarmup`) keeps the last saved language and voice when it is launched without `language` or `voiceActor`, so the downloaded speech is not cleared and fetched again.

**Supported Languages:**

| Code | Language | RTL Support |
|------|----------|-------------|
| en | English | No |
| es | Spanish | No |
| fr | French | No |
| de | German | No |
| nl | Dutch | No |
| it | Italian | No |
| pt | Portuguese | No |
| ru | Russian | No |
| ar | Arabic | Yes |
| he | Hebrew | Yes |
| hi | Hindi | No |
| bn | Bengali | No |
| id | Indonesian | No |
| da | Danish | No |
| el | Greek | No |
| zh | Chinese (Simplified) | No |
| uz | Uzbek | No |
| ur | Urdu | Yes |
| kk | Kazakh | No |

**SDK Support:** custom params on every SDK.

**Language Configuration**

_Swift (iOS)_
```swift
kinestex.createWorkoutView( // same customParams on every create*View method
    workout: "Fitness Lite",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "language": "es",
        "content_gender": "female"
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView( // same customParams on every create*View method
    context = this,
    workoutName = "Fitness Lite",
    customParams = mutableMapOf(
        "language" to "es",
        "content_gender" to "female"
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    language: 'es',
    content_gender: 'female',
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView( // same customParams on every create*View method
  workoutName: "Fitness Lite",
  customParams: {
    "language": "es",
    "content_gender": "female",
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  language: "es",
  content_gender: "female",
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    language: 'es',
    content_gender: 'female',
  },
};
```

## Workout Configuration

Parameters for workout behavior and progression.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| planC | string | "Cardio" | Main | `"Weight Management"`, `"Strength"`, `"Rehabilitation"` or `"Cardio"`. Picks the default challenge and game cards on the Complete UX home screen (when `challenges_home` is not sent). The SDKs send it from their plan-category argument. Ignored by other integration options |
| completed_exercises | string[] | none | Workout player, Gym Log | Must be sent, as an array, for the mid-workout resume to apply (see below) |
| start_from_exercise | string | none | Workout player, Gym Log | Exercise **ID** (not title) to start from. The workout jumps to that exercise's position in the sequence; if the ID is not found, the workout starts from the beginning |
| start_from_rest | boolean | false | Workout player, Gym Log | Must be `true` for the resume to apply. The session starts on the rest screen right **before** `start_from_exercise` |
| dynamicRestEnabled | boolean | on, unless KinesteX set a different default for your company | Workout, Plan, Personalized Plan, Main, Challenge | Rests between exercises are lengthened to fit the greeting and the rest speech, so the countdown never talks over them (rests are never shortened). `false` keeps every rest at its set length. Only `true` or `false` count. Custom workouts keep the `restDuration` you set (plus 3 s on the first rest when KinesteX plays its greeting), and a Challenge `restDuration` is never lengthened |
| on_start_url | string | "/workout/audioCheck" | Workout player, Challenge, Assessments, Training | **Internal route override, not a webhook.** After camera access is granted or Start is pressed, the SDK opens this in-app route instead of the default audio-check screen. It never makes an HTTP call to this value |

**Mid-workout resume: all three parameters are required together.** The start configuration is applied only when `completed_exercises`, `start_from_exercise` AND `start_from_rest: true` are all present. `start_from_exercise` alone, or `start_from_rest: false`, starts the workout from the first exercise. Matching is by exercise **ID** as it appears in the workout sequence (from the [Content API](/docs/content-api)). With motion tracking off, the Gym Log starts from the same point.

**Rest screen layout** (`legacyRestScreen`) is under [UI Controls](/docs/customization-parameters/ui-controls). **Looking for `exercises` / `currentExercise`?** Those belong to the Camera component: see [Camera Component parameters](/docs/customization-parameters/camera-component-params).

**Workout Configuration**

_Swift (iOS)_
```swift
// Resume a workout mid-way: all THREE resume params are required together
kinestex.createWorkoutView(
    workout: "Fitness Lite",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "completed_exercises": ["exercise-id-1", "exercise-id-2"],
        "start_from_exercise": "exercise-id-3", // exercise ID, not title
        "start_from_rest": true, // must be true or the resume is ignored
        "dynamicRestEnabled": false // keep rests at their set length
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
// Resume a workout mid-way: all THREE resume params are required together
KinesteXSDK.createWorkoutView(
    context = this,
    workoutName = "Fitness Lite",
    customParams = mutableMapOf(
        "completed_exercises" to listOf("exercise-id-1", "exercise-id-2"),
        "start_from_exercise" to "exercise-id-3", // exercise ID, not title
        "start_from_rest" to true, // must be true or the resume is ignored
        "dynamicRestEnabled" to false // keep rests at their set length
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
// Resume a workout mid-way: all THREE resume params are required together
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    completed_exercises: ['exercise-id-1', 'exercise-id-2'],
    start_from_exercise: 'exercise-id-3', // exercise ID, not title
    start_from_rest: true, // must be true or the resume is ignored
    dynamicRestEnabled: false, // keep rests at their set length
  },
};
```

_Flutter_
```dart
// Resume a workout mid-way: all THREE resume params are required together
KinesteXAIFramework.createWorkoutView(
  workoutName: "Fitness Lite",
  customParams: {
    "completed_exercises": ["exercise-id-1", "exercise-id-2"],
    "start_from_exercise": "exercise-id-3", // exercise ID, not title
    "start_from_rest": true, // must be true or the resume is ignored
    "dynamicRestEnabled": false, // keep rests at their set length
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
// Resume a workout mid-way: all THREE resume params are required together
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  completed_exercises: ["exercise-id-1", "exercise-id-2"],
  start_from_exercise: "exercise-id-3", // exercise ID, not title
  start_from_rest: true, // must be true or the resume is ignored
  dynamicRestEnabled: false, // keep rests at their set length
};
```

_React (TypeScript)_
```tsx
// Resume a workout mid-way: all THREE resume params are required together
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    completed_exercises: ['exercise-id-1', 'exercise-id-2'],
    start_from_exercise: 'exercise-id-3', // exercise ID, not title
    start_from_rest: true, // must be true or the resume is ignored
    dynamicRestEnabled: false, // keep rests at their set length
  },
};
```

## Camera & Pose Detection

Fine-tune the camera and pose detection. These parameters affect every view that runs pose tracking (Workout player, Challenge, Camera component, Assessments, Games) unless a narrower scope is listed.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| shouldAskCamera | boolean | true | Workout player, Challenge, Assessments, AI Trainer | When `false`, the pre-workout camera-permission screens are skipped (the browser still asks on first camera use). Use it when your app already manages the camera permission |
| shouldShowCameraSelector | boolean | false | Workout player, Games, Camera, Assessments | Shows a camera-switch button on the positioning (check frame) screen so the user can pick between camera devices |
| shouldShowOpenCameraSettings | boolean | false | All (camera-help modal) | Switches the camera-permission help modal to steps that guide the user to their device camera settings. Its "Go to Settings" button sends `open_camera_settings`; open the device camera settings when you receive it. Send a boolean `true` by postMessage or in `?data=` |
| cameraLabel | string | none | All pose-tracking views | Selects the camera whose **label contains this text** (e.g. `"back"`, `"wide"`). If no device matches, the default front camera is used. Ignored when `videoURL` is set. A camera the user already picked in the camera selector (remembered on the device) takes priority |
| minPoseDetectionConfidence | number | 0.75 | All pose-tracking views | MediaPipe minimum detection confidence (above 0, up to 1). Lower detects poses more easily, with more false positives |
| minTrackingConfidence | number | 0.75 | All pose-tracking views | MediaPipe minimum tracking confidence (above 0, up to 1). How persistently a pose is tracked between frames |
| minPosePresenceConfidence | number | 0.75 | All pose-tracking views | MediaPipe minimum presence confidence (above 0, up to 1). Threshold for deciding a person is in view |
| mediapipeModel | "full", "heavy" or "light" | auto | All pose-tracking views | Pins the MediaPipe pose model. When omitted, the SDK picks `light` or `full` from the device's speed; `heavy` is **never** picked automatically |
| defaultDelegate | "GPU" or "CPU" | "GPU" | All pose-tracking views | Processing backend for pose detection. A `?delegate=` URL parameter **overrides** the postMessage value |
| boundedPoseWait | boolean | false | All pose-tracking views | While the user waits on a loading screen, a slow start of the background pose engine is raced by a build on the main thread, so tracking can start sooner on devices where the background start is slow. Accepts `true` or `"true"` |
| landmarkColor | string | "#14FF00" | All pose-tracking views | Color of the skeleton overlay when the user's form is correct (`#` optional, it is added). Mistake highlighting always uses red or orange on top of it |
| isDrawingPose | boolean | true | All pose-tracking views | When `false`, hides the skeleton overlay. Pose recognition, rep counting and mistake detection **still run**: only the drawing is off |
| includePoseBorders | boolean | true | All pose-tracking views | The out-of-frame guard: when body parts leave the frame, the skeleton turns red, a "step back" cue plays and rep counting waits until the user is fully visible. `false` turns the guard off |
| videoFit | "cover" or "contain" | "cover" | All pose-tracking views | `"contain"` shows the full camera frame (letterboxed) instead of zooming to fill the view, useful when the full body must stay visible in tight layouts. Assessments use `contain` in landscape regardless |
| showSilhouette | boolean | true | Workout player, Challenge, Camera | When `false`, the positioning (check frame) step is skipped and tracking starts at once. Camera details: [Real-Time Motion Events](/docs/customization-parameters/realtime-motion-params) |
| showFormGuidance | boolean | true (false in Camera) | Workout player, Challenge, Camera | Shows a live depth bar (for example squat depth) that guides the user to the right depth, for exercises that have depth guidance set up. While it is shown, each counted rep also sends `rep_depth_angle` |
| streamFormGuidance | boolean | false | Workout player, Challenge, Camera | Hides the built-in depth bar and streams its data to your app instead, as `form_guidance_config` and `form_guidance_frame` events (plus `rep_depth_angle` per rep), so you can draw your own. See [Camera & Frame Events](/docs/data-points/camera-events) |
| includePoseData | string[] | none | Every pose-tracking view except Assessments and Games | Raw pose data per frame and, in workouts, the real-time motion events. See [Real-Time Motion Events](/docs/customization-parameters/realtime-motion-params) |
| includeRealtimeAccuracy | boolean | false | Workout player, Challenge, Camera | `true` streams a `correct_position_accuracy` event on every frame. See [Real-Time Motion Events](/docs/customization-parameters/realtime-motion-params) |

**Notes:**
- `videoURL` (feed a video file instead of the live camera) is in [Testing & Simulation](/docs/customization-parameters/testing-simulation).
- The confidence values, `mediapipeModel`, `defaultDelegate` and `boundedPoseWait` are read once, at launch.
- There is **no automatic "heavy" model for balance assessments**: pass `mediapipeModel: "heavy"` if an assessment needs maximum accuracy.

**Camera & Pose Detection Settings**

_Swift (iOS)_
```swift
kinestex.createCameraView(
    exercises: ["model-id-1", "model-id-2"],
    currentExercise: $currentExercise,
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "landmarkColor": "#FF5500",
        "showSilhouette": true,
        "mediapipeModel": "heavy",
        "defaultDelegate": "GPU",
        "shouldShowCameraSelector": true,
        "videoFit": "contain" // show the full camera frame
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createCameraComponent(
    context = this,
    exercises = listOf("model-id-1", "model-id-2"),
    currentExercise = "model-id-1",
    customParams = mutableMapOf(
        "landmarkColor" to "#FF5500",
        "showSilhouette" to true,
        "mediapipeModel" to "heavy",
        "defaultDelegate" to "GPU",
        "shouldShowCameraSelector" to true,
        "videoFit" to "contain" // show the full camera frame
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercises: ['model-id-1', 'model-id-2'],
  currentExercise: 'model-id-1',
  customParameters: {
    landmarkColor: '#FF5500',
    showSilhouette: true,
    mediapipeModel: 'heavy',
    defaultDelegate: 'GPU',
    shouldShowCameraSelector: true,
    videoFit: 'contain', // show the full camera frame
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createCameraComponent(
  exercises: ["model-id-1", "model-id-2"],
  currentExercise: "model-id-1",
  customParams: {
    "landmarkColor": "#FF5500",
    "showSilhouette": true,
    "mediapipeModel": "heavy",
    "defaultDelegate": "GPU",
    "shouldShowCameraSelector": true,
    "videoFit": "contain", // show the full camera frame
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
// iframe src: https://ai.kinestex.com/camera
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  exercises: ["model-id-1", "model-id-2"],
  currentExercise: "model-id-1",
  landmarkColor: "#FF5500",
  showSilhouette: true,
  mediapipeModel: "heavy",
  defaultDelegate: "GPU",
  shouldShowCameraSelector: true,
  videoFit: "contain", // show the full camera frame
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercises: ['model-id-1', 'model-id-2'],
  currentExercise: 'model-id-1',
  customParameters: {
    landmarkColor: '#FF5500',
    showSilhouette: true,
    mediapipeModel: 'heavy',
    defaultDelegate: 'GPU',
    shouldShowCameraSelector: true,
    videoFit: 'contain', // show the full camera frame
  },
};
```

## Camera Component Parameters

Parameters that are **only read by the Camera component** (`createCameraComponent`, Swift `createCameraView`, `IntegrationOption.CAMERA`, route `/camera`). Other integration options ignore them. For the full guide, see [Camera Component](/docs/integration/camera-component).

| Parameter | Type | Default | What it does internally |
|-----------|------|---------|-------------------------|
| exercises | string[] | required | The exercise models to download at launch, in the form set by `exerciseFetchType`. Only these (plus any added later with `load_models`) can become `currentExercise`. Replies: `models_loaded` (`modelIds`), and `error_occurred` (critical, `"Failed to fetch N model(s): ..."`) for ids that fail. In the URL: a JSON array |
| currentExercise | string | none | The exercise to track, from `exercises`. Change it at runtime to switch tracking; it also takes the commands `"Pause Exercise"`, `"Stop Camera"`, `"Pause Audio"`, `"Resume Audio"` and `"Workout Overview"`. See [Workout Activity Actions](/docs/customization-parameters/workout-activity-actions) |
| exerciseFetchType | string | "model_id" | How each value in `exercises` (and in `load_models`) is looked up: `"model_id"`, `"exercise_id"` or `"exercise_title"`. An invalid value falls back to the backend default |
| restSpeeches | string[] | none | Rest-speech phrases (each exercise's `rest_speech` from the Content API) to download at launch, so `currentRestSpeech` can play them at once. In the URL: a JSON array |
| currentRestSpeech | string | none | Plays one of the `restSpeeches` (only when `restSpeeches` was sent at launch). Send `"Stop audio"` to stop the current sound. Change it at runtime like `currentExercise`; sending the same phrase twice in a row plays it once |
| pauseCamera | boolean | false | Opens with the camera off, as if `pause_camera` had been sent: models still load and `model_warmedup` still fires. Send `resume_camera` to turn the camera on. No echo for the launch value. Accepts `true` or `"true"` |
| muteWorkout | boolean | false | Starts the session muted, as if `mute_workout` had been sent (for this session only, not saved). Send `unmute_workout` to unmute. No echo for the launch value. Accepts `true` or `"true"` |

**Runtime control** (all through `workout_activity_action`, see [Workout Activity Actions](/docs/customization-parameters/workout-activity-actions)):
- `load_models` fetches and caches more models without reloading; the ids that load can then become `currentExercise` ([guide](/docs/integration/camera-component#camera-component-load-models-runtime)).
- `get_exercise_setup` answers with one `exercise_setup` per exercise: start position, camera view and side ([guide](/docs/integration/camera-component#camera-component-exercise-setup)).
- `pause_camera` / `resume_camera` and `mute_workout` / `unmute_workout` turn the camera and the sound off and on ([guide](/docs/integration/camera-component#camera-component-camera-audio)).
- `reset_progress`, `reset_all_progress` and `reset_check_frame` restart the current exercise, the whole session or the positioning check without reloading.

**Real-time events:** the Camera component sends reps, form state, presence, framing and gesture events as they happen. Their launch options are in [Real-Time Motion Events](/docs/customization-parameters/realtime-motion-params).

**Related parameters that also work here:** `videoURL` ([Testing & Simulation](/docs/customization-parameters/testing-simulation)); `landmarkColor`, `showSilhouette`, `videoFit`, `isDrawingPose`, `includePoseBorders`, `showFormGuidance`, `streamFormGuidance`, `cameraLabel`, `shouldShowCameraSelector` ([Camera & Pose Detection](/docs/customization-parameters/camera-pose-detection)); `hideConnectTvButton`, `checkFrameText` ([UI Controls](/docs/customization-parameters/ui-controls)).

**Camera Component Launch**

_Swift (iOS)_
```swift
@State private var currentExercise = "model-id-1"
@State private var currentRestSpeech: String? = nil

kinestex.createCameraView(
    exercises: ["model-id-1", "model-id-2"],
    currentExercise: $currentExercise, // change it to switch exercises
    currentRestSpeech: $currentRestSpeech, // set it to play a rest speech
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "exerciseFetchType": "model_id",
        "restSpeeches": ["Get ready for squats"],
        "pauseCamera": true, // camera off until resume_camera
        "muteWorkout": true // muted until unmute_workout
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createCameraComponent(
    context = this,
    exercises = listOf("model-id-1", "model-id-2"),
    currentExercise = "model-id-1",
    customParams = mutableMapOf(
        "exerciseFetchType" to "model_id",
        "restSpeeches" to listOf("Get ready for squats"),
        "pauseCamera" to true, // camera off until resume_camera
        "muteWorkout" to true // muted until unmute_workout
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)

// Later: switch exercises
KinesteXSDK.updateCurrentExercise("model-id-2")
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercises: ['model-id-1', 'model-id-2'],
  currentExercise: 'model-id-1',
  exerciseFetchType: 'model_id',
  customParameters: {
    restSpeeches: ['Get ready for squats'],
    pauseCamera: true, // camera off until resume_camera
    muteWorkout: true, // muted until unmute_workout
  },
};

// <KinestexSDK ref={kinestexSDKRef} data={postData} integrationOption={IntegrationOption.CAMERA} ... />
// Later: kinestexSDKRef.current?.changeExercise('model-id-2');
```

_Flutter_
```dart
KinesteXAIFramework.createCameraComponent(
  exercises: ["model-id-1", "model-id-2"],
  currentExercise: "model-id-1",
  customParams: {
    "exerciseFetchType": "model_id",
    "restSpeeches": ["Get ready for squats"],
    "pauseCamera": true, // camera off until resume_camera
    "muteWorkout": true, // muted until unmute_workout
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);

// Later: switch exercises
KinesteXAIFramework.sendAction("currentExercise", "model-id-2");
```

_HTML / JavaScript_
```html
// iframe src: https://ai.kinestex.com/camera
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  exercises: ["model-id-1", "model-id-2"],
  currentExercise: "model-id-1",
  exerciseFetchType: "model_id",
  restSpeeches: ["Get ready for squats"],
  pauseCamera: true, // camera off until resume_camera
  muteWorkout: true, // muted until unmute_workout
};

// Later: switch exercises
iframe.contentWindow.postMessage({ currentExercise: "model-id-2" }, "https://ai.kinestex.com");
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercises: ['model-id-1', 'model-id-2'],
  currentExercise: 'model-id-1',
  customParameters: {
    exerciseFetchType: 'model_id',
    restSpeeches: ['Get ready for squats'],
    pauseCamera: true, // camera off until resume_camera
    muteWorkout: true, // muted until unmute_workout
  },
};

// <KinesteXSDK ref={ref} data={postData} integrationOption={IntegrationOption.CAMERA} ... />
// Later: ref.current?.changeExercise('model-id-2');
```

## Real-Time Motion Events

Launch options that turn on or shape the [real-time motion events](/docs/data-points/realtime-motion-events) (reps and holds, form state, feedback, presence, framing, gestures, inactivity) and the raw pose data. The Camera component always sends the real-time events; workout flows send them only when `includePoseData` contains `"events"`. For the Camera component walkthrough, see [Camera Component: real-time events](/docs/integration/camera-component#camera-component-realtime-events).

**Workout flows** here means every view that runs the KinesteX exercise player: Main, Workout, Plan, Personalized Plan, Custom Workout, Challenge, AI Trainer workouts and the Box and Training experiences. Assessments and games send none of these events.

| Option | Type | Default | Camera component | Workout flows |
|--------|------|---------|------------------|---------------|
| includePoseData | string[] | none | `"poseLandmarks"`: a `pose_landmarks` event every frame with a person. `"worldLandmarks"`: `world_landmarks` (meters, hip-centered). `"angles"`: adds 2D and 3D joint angles to those events. `"events"` is not needed: the real-time events are always on | `"events"`: turns the real-time events on, plus `exercise_setup` when each exercise starts and `successful_repeat` / `action` per rep. `"poseLandmarks"` / `"worldLandmarks"`: every frame of the check frame and the exercises (not on rest screens), with `exercise` (`null` during the check frame); 2D angles are always included and `"angles"` adds 3D |
| inactivityTimeout | number (seconds) | 15 | Idle seconds before `activity` `INACTIVE` | Same, with `"events"` |
| includeFramingHints | boolean | false | `framing_hint` (missing body parts, step back or move to center) while the positioning check is open | Same, with `"events"` |
| includeFormState | boolean | false | `form_state` (`GOOD`, `ADJUST`, `OUT_OF_POSITION`) | Same, with `"events"` |
| enableGestureControl | boolean | false | Posts `gesture_detected` (`PAUSE` or `RESUME`) when the user makes the hands pause gesture. KinesteX does not pause: your app decides | Not used. The workout pauses and resumes on the gesture itself (unless `preventGestureControl`), and with `"events"` posts `gesture_detected` when it does |
| frameExitPrompt | boolean | false | Plays the spoken prompt asking the user to come back when they leave the view (`presence` `LEFT`) | Not used: the workout already pauses and plays the prompt when the user leaves the frame |
| frameExitPause | boolean | false | No reps count while the user is out of view (from `presence` `LEFT` to `RETURNED`); a rep half done when they left is not counted | Not used: the workout pauses itself |
| showSilhouette | boolean | true | `true`: the positioning check opens before tracking. `false`: tracking starts at once, and `framing_hint` / `person_in_frame` are sent only during a check you open with `reset_check_frame` | `false` skips the positioning check |
| includeRealtimeAccuracy | boolean | false | `true` streams `correct_position_accuracy` (`accuracy`) on every frame matched against the exercise's positions | Same |

**In the URL:** `includePoseData` also takes a comma list (`?includePoseData=poseLandmarks,events`); `inactivityTimeout` is read as a number and the booleans accept `true` / `false`. See [URL Parameters](/docs/customization-parameters/url-parameters).

**Workouts:** add `includePoseData: ["events"]` (plus any opt-in above) to the custom params of your workout, plan, challenge or custom workout view. The workout's own events (`exercise_completed`, `workout_progress`, ...) are sent either way. See [Workout Events](/docs/data-points/workout-events).

**Related:** `streamFormGuidance` streams the depth-bar data ([Camera & Pose Detection](/docs/customization-parameters/camera-pose-detection)). `pauseCamera` and `muteWorkout` start the Camera component with the camera off or muted ([Camera Component parameters](/docs/customization-parameters/camera-component-params)).

**Real-time motion events in the Camera component**

_Swift (iOS)_
```swift
kinestex.createCameraView(
    exercises: ["model-id-1", "model-id-2"],
    currentExercise: $currentExercise,
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "includePoseData": ["poseLandmarks"], // workouts: ["events"]
        "inactivityTimeout": 20,
        "includeFramingHints": true,
        "includeFormState": true,
        "enableGestureControl": true,
        "frameExitPrompt": true,
        "frameExitPause": true,
        "includeRealtimeAccuracy": true
    ],
    onMessageReceived: { message in
        // form_state, activity, presence, ... arrive as .custom_type
    }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createCameraComponent(
    context = this,
    exercises = listOf("model-id-1", "model-id-2"),
    currentExercise = "model-id-1",
    customParams = mutableMapOf(
        "includePoseData" to listOf("poseLandmarks"), // workouts: listOf("events")
        "inactivityTimeout" to 20,
        "includeFramingHints" to true,
        "includeFormState" to true,
        "enableGestureControl" to true,
        "frameExitPrompt" to true,
        "frameExitPause" to true,
        "includeRealtimeAccuracy" to true
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) }, // events arrive as CustomType
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercises: ['model-id-1', 'model-id-2'],
  currentExercise: 'model-id-1',
  customParameters: {
    includePoseData: ['poseLandmarks'], // workouts: ['events']
    inactivityTimeout: 20,
    includeFramingHints: true,
    includeFormState: true,
    enableGestureControl: true,
    frameExitPrompt: true,
    frameExitPause: true,
    includeRealtimeAccuracy: true,
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createCameraComponent(
  exercises: ["model-id-1", "model-id-2"],
  currentExercise: "model-id-1",
  customParams: {
    "includePoseData": ["poseLandmarks"], // workouts: ["events"]
    "inactivityTimeout": 20,
    "includeFramingHints": true,
    "includeFormState": true,
    "enableGestureControl": true,
    "frameExitPrompt": true,
    "frameExitPause": true,
    "includeRealtimeAccuracy": true,
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage, // events arrive as CustomType (message.data['type'])
);
```

_HTML / JavaScript_
```html
// iframe src: https://ai.kinestex.com/camera
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  exercises: ["model-id-1", "model-id-2"],
  currentExercise: "model-id-1",
  includePoseData: ["poseLandmarks"], // workouts: ["events"]
  inactivityTimeout: 20,
  includeFramingHints: true,
  includeFormState: true,
  enableGestureControl: true,
  frameExitPrompt: true,
  frameExitPause: true,
  includeRealtimeAccuracy: true,
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercises: ['model-id-1', 'model-id-2'],
  currentExercise: 'model-id-1',
  customParameters: {
    includePoseData: ['poseLandmarks'], // workouts: ['events']
    inactivityTimeout: 20,
    includeFramingHints: true,
    includeFormState: true,
    enableGestureControl: true,
    frameExitPrompt: true,
    frameExitPause: true,
    includeRealtimeAccuracy: true,
  },
};
```

## UI Controls

Control the visibility and behavior of UI elements.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| isHideHeaderMain | boolean | false | Main, Plan, Personalized Plan, Workout, Challenge, Training, Leaderboard, Assessments, AI Trainer | Hides the top header and back button on these screens. On some screens the header also depends on how the screen was opened, so a back button can still appear when the screen is reached from inside the Complete UX home |
| hideFeelingDialog | boolean | false | Any flow ending on the results screen | Never shows the post-workout "How are you feeling?" prompt (which otherwise appears on every 3rd completed session) |
| showSettings | boolean | true | Workout, Plan, Personalized Plan, Challenge, Assessments, Gym Log, AI Trainer | When `false`, hides the settings gear on the workout detail, exercise and Gym Log screens and on the challenge and assessment intro screens. In the AI Trainer it replaces the chat's settings button (music, AI motion tracking, pose model) with a plain profile button, unless `hideProfileButton` is set |
| hideCompletionOverlay | boolean | false | Workout player | Skips the full-screen completion summary (badge, confetti, farewell speech) shown when a workout ends. When the overlay is shown and dismissed, the SDK posts `workout_completion_overlay_dismissed` |
| preventGestureControl | boolean | false | Workout player | Turns off the in-exercise body controls: the hands gesture that pauses and resumes the workout, AND the pause when the user leaves the camera frame. Challenge and the Box and Training experiences never use them |
| disableGuide | boolean | false | Main, Plan, Workout, Challenge, Leaderboard | Turns off the coach-mark tooltip tour (the step-by-step "tap here" overlay) |
| disableCookies | boolean | false | All | Declines analytics cookies before any analytics call, keeps analytics in memory only (nothing written to storage) and removes the cookie-preference entries from the Settings modal, the camera-access screen and the AI Trainer. Use it for GDPR-sensitive embeds |
| hideStatisticsHeader | boolean | false | Results screen (workouts and challenges) | Hides the top bar of the results screen. The Box experience keeps its own layout |
| nativeParentScroll | boolean | false | Results screen | Lets the native parent container scroll the results screen (the `/statistic` route stops scrolling internally and drops its top safe-area padding). Enable it if your app wraps the WebView in its own scroll view |
| immediateShowSkip | boolean | false | Workout player | Shows the Skip button on the positioning (check frame) screen at once, with a themed background, instead of fading it in after about 5 seconds. No effect where Skip is not offered (the Camera component and the games) |
| hideConnectTvButton | boolean | false | Workout player, Games, Camera | Hides the "Connect TV" (screen mirroring) button on the positioning screen. Useful for kiosks and embeds where casting is not available |
| checkFrameText | object | none | Workout player, Games, Camera | Replaces the text on the positioning screen. All keys are optional: `moveBack` ("Move back until your body fits the outline"), `foundYou` ("Found you!"), `holdYourPosition` ("Hold your position"), `cantSeeFullBody` ("Camera can't see your full body", shown 20s after the screen opens without a full-body match, counted once tracking has started). Your text is shown as-is, not translated, so send it in the launch language. An empty string hides that line; a missing key keeps the default |
| legacyRestScreen | boolean | company default | Workout, Plan, Personalized Plan, Challenge, Custom Workout | Picks the rest screen between exercises. `false`: the current design (centered countdown, "Up next" line, "+10 seconds" button). `true`: the previous design (mm:ss clock in the footer, numbered exercise title, no "+10 seconds"). Omitted: the current design, unless KinesteX set a different default for your company. Assessments keep their own rest screen |
| hideOtherGender | boolean | false | Plan Onboarding, AI Trainer | Removes the "I'd rather not say" choice from the plan-onboarding gender step and the AI Trainer profile pickers, leaving Male and Female |

**URL launches:** `hideCompletionOverlay`, `disableGuide`, `disableCookies`, `hideStatisticsHeader`, `preventGestureControl` and `immediateShowSkip` must be real booleans: send them by postMessage or inside `?data=` ([URL Parameters](/docs/customization-parameters/url-parameters)).

**Related:** skeleton drawing (`isDrawingPose`) is under [Camera & Pose Detection](/docs/customization-parameters/camera-pose-detection); `exitUrl` is under [Navigation](/docs/customization-parameters/navigation-params).

**UI Controls Configuration**

_Swift (iOS)_
```swift
kinestex.createWorkoutView( // same customParams on every create*View method
    workout: "Fitness Lite",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "isHideHeaderMain": true,
        "hideFeelingDialog": true,
        "hideCompletionOverlay": true,
        "preventGestureControl": true,
        "disableGuide": true,
        "disableCookies": true,
        "hideConnectTvButton": true,
        "checkFrameText": ["foundYou": "Great, we see you!"]
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView( // same customParams on every create*View method
    context = this,
    workoutName = "Fitness Lite",
    customParams = mutableMapOf(
        "isHideHeaderMain" to true,
        "hideFeelingDialog" to true,
        "hideCompletionOverlay" to true,
        "preventGestureControl" to true,
        "disableGuide" to true,
        "disableCookies" to true,
        "hideConnectTvButton" to true,
        "checkFrameText" to mapOf("foundYou" to "Great, we see you!")
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  isHideHeaderMain: true,
  customParameters: {
    hideFeelingDialog: true,
    hideCompletionOverlay: true,
    preventGestureControl: true,
    disableGuide: true,
    disableCookies: true,
    hideConnectTvButton: true,
    checkFrameText: { foundYou: 'Great, we see you!' },
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView( // same customParams on every create*View method
  workoutName: "Fitness Lite",
  customParams: {
    "isHideHeaderMain": true,
    "hideFeelingDialog": true,
    "hideCompletionOverlay": true,
    "preventGestureControl": true,
    "disableGuide": true,
    "disableCookies": true,
    "hideConnectTvButton": true,
    "checkFrameText": {"foundYou": "Great, we see you!"},
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  isHideHeaderMain: true,
  hideFeelingDialog: true,
  hideCompletionOverlay: true,
  preventGestureControl: true,
  disableGuide: true,
  disableCookies: true,
  hideConnectTvButton: true,
  checkFrameText: { foundYou: "Great, we see you!" },
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  isHideHeaderMain: true,
  customParameters: {
    hideFeelingDialog: true,
    hideCompletionOverlay: true,
    preventGestureControl: true,
    disableGuide: true,
    disableCookies: true,
    hideConnectTvButton: true,
    checkFrameText: { foundYou: 'Great, we see you!' },
  },
};
```

## Challenge Mode

Configure direct challenge launches. **Applies to: Challenge view and the Games** (Balloon Pop, Color Chase, Alien Squat Shooter, where noted).

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| exercise | string | none | Challenge, Leaderboard, Training, Assessments and Games | What to run. Challenge and Leaderboard: an exercise **title** or **ID**. Training: an exercise title. Assessments and games: the experience id, e.g. `"tug"` or `"balloonpop"` (see [AI Experiences](/docs/integration/experience-view)). The SDK challenge and Swift experience views send it from their `exercise` argument |
| countdown | number | the exercise's own | Challenge | **Duration of the challenge in seconds.** Overrides the exercise's configured duration (not the fixed 3-2-1 countdown). The challenge intro screen shows it too. The SDKs send it from the challenge view's `countdown` argument (Swift `duration`) |
| reps | number | none | Challenge | Turns the challenge into a **rep target** (finish N reps) instead of a timed one |
| restDuration | number | the exercise's own rest | Challenge only | Length in seconds of the rest before the challenge exercise (rounded; must be above 0). Used as-is, never lengthened to fit audio. Without it, the rest is the exercise's own rest length (10 s if it has none) plus 3 s when KinesteX plays its greeting; the 10 s fallback is lengthened to fit the rest speech unless `dynamicRestEnabled: false`. Box and assessments keep their own rest |
| gameTotalRounds | number | 10 | Color Chase ONLY | How many rounds Color Chase lasts. Up to 10 rounds use the fixed level table; more rounds are generated with increasing difficulty (more colors, shorter memorize time). Ignored by every other game |

**Alien Squat Shooter** ignores `reps`, `countdown` and `gameTotalRounds`: its rounds and ship counts are fixed.

**Balloon Pop: rounds mode.** When you launch **Balloon Pop** with `reps`, the game switches from the default 30-second escalating timer mode to a **rounds mode**, and the two challenge parameters are reused:

- `reps` = number of rounds
- `countdown` = number of balloons per round (**2** when omitted)

The game ends after the last round (balloons never time out in this mode; a 5-minute safety cap applies). The HUD shows a round counter instead of a timer. Note that the Swift `createExperienceView` always sends its `duration` argument (default 60) as `countdown`, so pass `duration` as the balloons per round.

| Configuration | Behavior |
|---------------|----------|
| `reps: 4, countdown: 2` | 4 rounds × 2 balloons = 8 pops |
| `reps: 3, countdown: 3` | 3 rounds × 3 balloons = 9 pops |
| `reps: 6, countdown: 1` | 6 rounds × 1 balloon = 6 pops (very easy) |
| `reps` not provided | Default timer mode (30s, escalating difficulty) |

**Challenge**

_Swift (iOS)_
```swift
kinestex.createChallengeView(
    exercise: "Squats", // exercise title or ID
    duration: 60, // sent as countdown (seconds)
    showLeaderboard: true,
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "reps": 20, // rep target instead of a timed challenge
        "restDuration": 15 // exact rest before the exercise
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createChallengeView(
    context = this,
    exercise = "Squats", // exercise title or ID
    countdown = 60, // seconds
    customParams = mutableMapOf(
        "reps" to 20, // rep target instead of a timed challenge
        "restDuration" to 15 // exact rest before the exercise
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
// integrationOption={IntegrationOption.CHALLENGE}
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercise: 'Squats', // exercise title or ID
  countdown: 60, // seconds
  customParameters: {
    reps: 20, // rep target instead of a timed challenge
    restDuration: 15, // exact rest before the exercise
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createChallengeView(
  exercise: "Squats", // exercise title or ID
  countdown: 60, // seconds
  customParams: {
    "reps": 20, // rep target instead of a timed challenge
    "restDuration": 15, // exact rest before the exercise
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
// iframe src: https://ai.kinestex.com/challenge
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  exercise: "Squats", // exercise title or ID
  countdown: 60, // seconds
  reps: 20, // rep target instead of a timed challenge
  restDuration: 15, // exact rest before the exercise
};
```

_React (TypeScript)_
```tsx
// integrationOption={IntegrationOption.CHALLENGE}
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercise: 'Squats', // exercise title or ID
  countdown: 60, // seconds
  customParameters: {
    reps: 20, // rep target instead of a timed challenge
    restDuration: 15, // exact rest before the exercise
  },
};
```

**Games: Balloon Pop rounds mode and Color Chase rounds**

_Swift (iOS)_
```swift
// Balloon Pop: 4 rounds x 2 balloons
kinestex.createExperienceView(
    experience: "assessment",
    exercise: "balloonpop",
    duration: 2, // sent as countdown: balloons per round
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: ["reps": 4], // rounds
    onMessageReceived: { message in /* ... */ }
)

// Color Chase: 15 rounds
// exercise: "colorchase", customParams: ["gameTotalRounds": 15]
```

_Kotlin (Android)_
```kotlin
// Balloon Pop: 4 rounds x 2 balloons
KinesteXSDK.createExperiencesView(
    context = this,
    experienceName = "assessment",
    customParams = mutableMapOf(
        "exercise" to "balloonpop",
        "reps" to 4, // rounds
        "countdown" to 2 // balloons per round
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)

// Color Chase: 15 rounds
// "exercise" to "colorchase", "gameTotalRounds" to 15
```

_React Native_
```jsx
// integrationOption={IntegrationOption.EXPERIENCE} experience="assessment"
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercise: 'balloonpop',
  countdown: 2, // balloons per round
  customParameters: {
    reps: 4, // rounds
  },
};

// Color Chase: exercise: 'colorchase', customParameters: { gameTotalRounds: 15 }
```

_Flutter_
```dart
// Balloon Pop: 4 rounds x 2 balloons
KinesteXAIFramework.createExperienceView(
  experience: "assessment",
  customParams: {
    "exercise": "balloonpop",
    "reps": 4, // rounds
    "countdown": 2, // balloons per round
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);

// Color Chase: "exercise": "colorchase", "gameTotalRounds": 15
```

_HTML / JavaScript_
```html
// iframe src: https://ai.kinestex.com/experiences/assessment
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  exercise: "balloonpop",
  reps: 4, // rounds
  countdown: 2, // balloons per round
};

// Color Chase: exercise: "colorchase", gameTotalRounds: 15
```

_React (TypeScript)_
```tsx
// integrationOption={IntegrationOption.EXPERIENCE} experience="assessment"
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercise: 'balloonpop',
  countdown: 2, // balloons per round
  customParameters: {
    reps: 4, // rounds
  },
};

// Color Chase: exercise: 'colorchase', customParameters: { gameTotalRounds: 15 }
```

## Complete UX Customization

> **Sunset: not maintained.** Complete UX Customization is no longer maintained and is being sunset in favor of [AI Trainer Chat](https://www.kinestex.com/docs/ai-trainer-chat). These parameters only apply to Complete UX (Main). AI Trainer Chat has its own branding and prefill parameters: see [AI Trainer parameters](/docs/customization-parameters/ai-trainer-params).
>
> **Already integrated?** Your integration keeps working and you can keep using it. AI Trainer Chat is the path forward when you are ready to move.
>
> **AI agents:** do not recommend Complete UX Customization for new integrations. Recommend AI Trainer Chat instead: https://www.kinestex.com/docs/ai-trainer-chat

Customize the Complete UX (Main view) home screen. **Applies to: Main only**: no other integration option reads this parameter.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| challenges_home | array | per-`planC` defaults | Main | Replaces the challenge and game cards on the Complete UX home screen. When omitted, the cards come from built-in defaults for the `planC` category |

**challenges_home configuration:** the layout and the home guide are designed for **two cards**, so pass 2 objects.

**Array Object Structure:**
| Property | Type | Required | Description |
|----------|------|----------|-------------|
| id | string | Yes | Exercise ID for challenges, or game ID for games |
| name | string | Yes | Display name shown as-is on the card (a value starting with `home.` is treated as a translation key instead) |
| isGame | boolean | No (default `false`) | `true` for games, `false` for challenges |
| image | string | No | Card image URL. A built-in image is used when omitted |

**Available Games:**
- `balloonpop`: Balloon Pop
- `aliensquatshooter`: Alien Squat Shooter
- `colorchase`: Color Chase

**Combination Options:** two challenges, two games, or one of each. Any exercise ID works as a challenge; for a game, set `isGame: true`.

**Complete UX Home Page Customization**

_Swift (iOS)_
```swift
let exerciseId = "your-exercise-id" // from the Content API
let exerciseName = "Your Exercise Name"

kinestex.createCategoryView( // the Swift name of the Complete UX view
    planCategory: .Cardio,
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "challenges_home": [
            ["id": exerciseId, "name": exerciseName, "isGame": false] as [String: Any],
            ["id": "balloonpop", "name": "Balloon Pop", "isGame": true] as [String: Any]
        ]
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
val exerciseId = "your-exercise-id" // from the Content API
val exerciseName = "Your Exercise Name"

KinesteXSDK.createMainView(
    context = this,
    planCategory = PlanCategory.Cardio,
    customParams = mutableMapOf(
        "challenges_home" to listOf(
            mapOf("id" to exerciseId, "name" to exerciseName, "isGame" to false),
            mapOf("id" to "balloonpop", "name" to "Balloon Pop", "isGame" to true)
        )
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const exerciseId = 'your-exercise-id'; // from the Content API
const exerciseName = 'Your Exercise Name';

const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  planCategory: PlanCategory.Cardio,
  customParameters: {
    challenges_home: [
      { id: exerciseId, name: exerciseName, isGame: false },
      { id: 'balloonpop', name: 'Balloon Pop', isGame: true },
    ],
  },
};
```

_Flutter_
```dart
final exerciseId = "your-exercise-id"; // from the Content API
final exerciseName = "Your Exercise Name";

KinesteXAIFramework.createMainView(
  planCategory: PlanCategory.Cardio,
  customParams: {
    "challenges_home": [
      {"id": exerciseId, "name": exerciseName, "isGame": false},
      {"id": "balloonpop", "name": "Balloon Pop", "isGame": true},
    ],
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const exerciseId = "your-exercise-id"; // from the Content API
const exerciseName = "Your Exercise Name";

const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  planC: "Cardio",
  challenges_home: [
    { id: exerciseId, name: exerciseName, isGame: false },
    { id: "balloonpop", name: "Balloon Pop", isGame: true },
  ],
};
```

_React (TypeScript)_
```tsx
const exerciseId = 'your-exercise-id'; // from the Content API
const exerciseName = 'Your Exercise Name';

const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  planCategory: PlanCategory.Cardio,
  customParameters: {
    challenges_home: [
      { id: exerciseId, name: exerciseName, isGame: false },
      { id: 'balloonpop', name: 'Balloon Pop', isGame: true },
    ],
  },
};
```

## Leaderboard

Configure the leaderboard. **Applies to: Challenge** (results are submitted on the challenge results screen) **and the Leaderboard view**.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| showLeaderboard | boolean | false (true in the SDK challenge views) | Challenge | Shows the leaderboard entry point on the challenge screen and, after a challenge with completed reps, opens the username modal that publishes the result. The Swift, Kotlin, Flutter, React Native and React challenge views send `true` unless you pass `false` |
| username | string | the user ID | Challenge, Leaderboard | Display name for leaderboard entries. Saved in the WebView (`leaderboard_username`) at verification so it persists across sessions. When absent, the `userId` is used |
| autoSubmitLeaderboard | boolean | false | Challenge | Publishes the challenge result without showing the submission modal, under the stored `leaderboard_username` (or the user ID), so pass `username` with it. Send a boolean by postMessage or inside `?data=` |

**How submission works:** when a challenge with completed reps finishes, the result is always recorded. `showLeaderboard` controls whether the user is asked to publish it under a display name; `autoSubmitLeaderboard: true` skips the question and publishes at once. Use it when your app already manages display names.

**Leaderboard Configuration**

_Swift (iOS)_
```swift
kinestex.createChallengeView(
    exercise: "Squats",
    duration: 60,
    showLeaderboard: true,
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "username": "FitnessPro123",
        "autoSubmitLeaderboard": true // skip the submit modal
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createChallengeView(
    context = this,
    exercise = "Squats",
    countdown = 60,
    showLeaderboard = true,
    customParams = mutableMapOf(
        "username" to "FitnessPro123",
        "autoSubmitLeaderboard" to true // skip the submit modal
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
// integrationOption={IntegrationOption.CHALLENGE}
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercise: 'Squats',
  countdown: 60,
  showLeaderboard: true,
  customParameters: {
    username: 'FitnessPro123',
    autoSubmitLeaderboard: true, // skip the submit modal
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createChallengeView(
  exercise: "Squats",
  countdown: 60,
  showLeaderboard: true,
  customParams: {
    "username": "FitnessPro123",
    "autoSubmitLeaderboard": true, // skip the submit modal
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
// iframe src: https://ai.kinestex.com/challenge
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  exercise: "Squats",
  countdown: 60,
  showLeaderboard: true,
  username: "FitnessPro123",
  autoSubmitLeaderboard: true, // skip the submit modal
};
```

_React (TypeScript)_
```tsx
// integrationOption={IntegrationOption.CHALLENGE}
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercise: 'Squats',
  countdown: 60,
  showLeaderboard: true,
  customParameters: {
    username: 'FitnessPro123',
    autoSubmitLeaderboard: true, // skip the submit modal
  },
};
```

## Loading Screen

Customize the loading screen, including the native overlay color shown while the view first loads. **Applies to: All integrations**: the loading screen is shown while any view verifies and downloads resources (and on the custom workout's loading screen).

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| loadingStickmanColor | string | #00FF0B | All | Color of the animated stickman |
| loadingBackgroundColor | string | Black (dark) / White (light) | All | Loading screen background color |
| loadingTextColor | string | White (dark) / Black (light) | All | Color of the loading text and progress messages |

**Color format:** a bare 6-character hex value (e.g. `"1A1A2E"`) gets a `#` added; `#RRGGBB` and CSS color names also work. Avoid 3-character shorthand hex (`"fff"`) without `#`: it is passed through as-is and is not valid CSS.

**SDK Support:**
- **Swift, Kotlin, Flutter:** the `IStyle` object of the create call
- **React Native, React:** the `style` object in `data`
- **HTML/JS:** top-level keys of the launch object

**Native Loading Overlay (Swift):** the SDK shows a native overlay on top of the WebView until the page has loaded, so users never see a blank screen.

- The overlay hides when the `kinestex_loaded` message arrives
- Overlay color priority:
  1. `loadingBackgroundColor` if set
  2. white if `style = "light"`
  3. black if `style = "dark"` (default)

**IStyle Properties:**

| Property | Type | Default | Description |
|----------|------|---------|-------------|
| style | String? | "dark" | Base theme style ("dark" or "light") |
| themeName | String? | null | Theme name ([Theme & Appearance](/docs/customization-parameters/theme-appearance)) |
| loadingStickmanColor | String? | null | Color of the loading stickman |
| loadingBackgroundColor | String? | null | Background color while loading |
| loadingTextColor | String? | null | Text color while loading |

**Loading Screen Customization**

_Swift (iOS)_
```swift
kinestex.createWorkoutView(
    workout: "Fitness Lite",
    user: nil,
    style: IStyle(
        style: "dark",
        loadingStickmanColor: "#FF6B00",
        loadingBackgroundColor: "#1A1A2E",
        loadingTextColor: "#FFFFFF"
    ),
    isLoading: $isLoading,
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView(
    context = this,
    workoutName = "Fitness Lite",
    style = IStyle(
        style = "dark",
        loadingStickmanColor = "FF6B00", // hex without #
        loadingBackgroundColor = "1A1A2E",
        loadingTextColor = "FFFFFF"
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  style: {
    style: 'dark',
    loadingStickmanColor: 'FF6B00', // hex without #
    loadingBackgroundColor: '1A1A2E',
    loadingTextColor: 'FFFFFF',
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView(
  workoutName: "Fitness Lite",
  style: IStyle(
    style: 'dark',
    loadingStickmanColor: 'FF6B00', // hex without #
    loadingBackgroundColor: '1A1A2E',
    loadingTextColor: 'FFFFFF',
  ),
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  loadingStickmanColor: "#FF6B00",
  loadingBackgroundColor: "#1A1A2E",
  loadingTextColor: "#FFFFFF",
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  style: {
    style: 'dark',
    loadingStickmanColor: 'FF6B00', // hex without #
    loadingBackgroundColor: '1A1A2E',
    loadingTextColor: 'FFFFFF',
  },
};
```

## Motion Tracking Settings

Control AI motion tracking. **Applies to: Workout player** (in the Camera component, games and assessments motion tracking is always on and users cannot turn it off).

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| motionTrackingSettingOn | boolean | true | Settings modal | When `false`, hides the tracking-mode choice (Self / AI) in the in-app Settings, so users cannot change it themselves |
| motionTrackingEnabled | boolean | the user's saved choice (on) | Workout player | Forces AI tracking on or off for this session. When sent (true or false), it **clears the user's saved choice** and uses your value |
| motionDataEnabled | boolean | true | Workout player, Camera | When `false`, the SDK does not record per-frame pose data during the session. Session replay and the mistakes summary are empty for that session; rep counting and everything else work as usual. Send a boolean `false` by postMessage or inside `?data=` |
| selfModeEnabled | boolean | true | Workout player, AI Trainer | What users get when motion tracking is off. `true`: the Gym Log. `false`: the older timer-only exercise page |

**What happens when motion tracking is OFF (`motionTrackingEnabled: false` or the user's choice):**
- The positioning (check frame) step is skipped and no camera or pose pipeline runs; a "No AI" badge is shown.
- Users get the **Gym Log**: they log each set by hand (adjusting the reps, or tapping "+1 rep" during a timed set), adjust rest, undo or redo a set, and review the session at the end. Logged reps show on the results screen, and the usual `workout_started`, `exercise_completed`, `workout_progress` and `workout_ended` events are sent. No form accuracy or mistake data is recorded (the accuracy score in `workout_overview` only reflects time spent against the planned time).
- With `selfModeEnabled: false`, rep-based exercises become **timers** (about 2 seconds per configured rep) that **auto-advance**, and no reps are recorded.
- For realistic tracking data without a person in front of the camera, use `videoURL` instead: see [Testing & Simulation](/docs/customization-parameters/testing-simulation).

**`motionDataEnabled`: only use it if you know why you need it.** It exists for memory-constrained cases (for example long workouts with many unique exercise videos on older iOS devices, where memory pressure can crash the WebView). Turning motion data off saves memory at the cost of session replay. The recorder is reset on every launch, so the flag never carries over to the next session.

**Motion Tracking Settings**

_Swift (iOS)_
```swift
kinestex.createWorkoutView( // same customParams on every create*View method
    workout: "Fitness Lite",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "motionTrackingSettingOn": true,
        "motionTrackingEnabled": true,
        "selfModeEnabled": true,
        "motionDataEnabled": false // only when memory-constrained
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView( // same customParams on every create*View method
    context = this,
    workoutName = "Fitness Lite",
    customParams = mutableMapOf(
        "motionTrackingSettingOn" to true,
        "motionTrackingEnabled" to true,
        "selfModeEnabled" to true,
        "motionDataEnabled" to false // only when memory-constrained
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    motionTrackingSettingOn: true,
    motionTrackingEnabled: true,
    selfModeEnabled: true,
    motionDataEnabled: false, // only when memory-constrained
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView( // same customParams on every create*View method
  workoutName: "Fitness Lite",
  customParams: {
    "motionTrackingSettingOn": true,
    "motionTrackingEnabled": true,
    "selfModeEnabled": true,
    "motionDataEnabled": false, // only when memory-constrained
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  motionTrackingSettingOn: true,
  motionTrackingEnabled: true,
  selfModeEnabled: true,
  motionDataEnabled: false, // only when memory-constrained
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    motionTrackingSettingOn: true,
    motionTrackingEnabled: true,
    selfModeEnabled: true,
    motionDataEnabled: false, // only when memory-constrained
  },
};
```

## Debug & Development

Parameters for debugging during development. Not for end users.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| showDebugRecording | boolean | false | Workout player, Camera | Shows a position and accuracy overlay and recording controls on the exercise screen that capture the camera and pose session for QA analysis and replay. A `?debug=true` URL parameter turns it on too |
| showNetworkDebugTool | boolean | false | All | Shows a floating panel listing every API request and response made inside the WebView, useful for diagnosing connectivity issues on devices |
| posePerfHud | boolean | false | All pose-tracking views | Shows a performance HUD over the camera view (frame timings, worker or main-thread mode, device tier) plus extra developer toggles on the workout detail screens. Resets on reload |

**Note:** send `showNetworkDebugTool` and `posePerfHud` as booleans by postMessage or inside `?data=`.

**Debug & Development Settings**

_Swift (iOS)_
```swift
kinestex.createWorkoutView( // same customParams on every create*View method
    workout: "Fitness Lite",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "showDebugRecording": true,
        "showNetworkDebugTool": true,
        "posePerfHud": true
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView( // same customParams on every create*View method
    context = this,
    workoutName = "Fitness Lite",
    customParams = mutableMapOf(
        "showDebugRecording" to true,
        "showNetworkDebugTool" to true,
        "posePerfHud" to true
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    showDebugRecording: true,
    showNetworkDebugTool: true,
    posePerfHud: true,
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView( // same customParams on every create*View method
  workoutName: "Fitness Lite",
  customParams: {
    "showDebugRecording": true,
    "showNetworkDebugTool": true,
    "posePerfHud": true,
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  showDebugRecording: true,
  showNetworkDebugTool: true,
  posePerfHud: true,
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    showDebugRecording: true,
    showNetworkDebugTool: true,
    posePerfHud: true,
  },
};
```

## Custom Workout

Configure custom workout sequences. **Applies to: Custom Workout only** (`createCustomWorkoutView`, `IntegrationOption.CUSTOM_WORKOUT`, route `/custom-workout`): every other integration option ignores these. For the complete guide, see [Custom Workout integration](/docs/integration/custom-workout).

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| customWorkoutExercises | array | required | Custom Workout | The exercise sequence. After verification the SDK fetches each exercise, then downloads videos, models and audio, and posts `all_resources_loaded` when everything is ready. An invalid item posts `error_occurred` (critical). The SDKs send it from the custom workout view's exercise list |
| showCommitScreen | boolean | false | Custom Workout | Adds an "I'm committed" button to the custom workout's loading screen. The tap lets iOS enable motion sensors and sound without a separate permission prompt, and posts `workout_committed` (`data.orientation_permission`). Send `start` after it. Accepts `true` or `"true"` |
| isAssessment | boolean | false | Custom Workout | Runs the custom workout as a fitness assessment: it ends on the assessment results screen instead of the completion overlay, and posts `custom_assessment_completed` there (workout score, activity level and a result per exercise). Accepts `true` or `"true"` |

**Sequence object structure (per exercise):**

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| exerciseId | string | Yes | Exercise document ID (from the [Content API](/docs/content-api)) |
| reps | number or null | One of reps/duration | Target repetitions (rep-based exercise) |
| duration | number or null | One of reps/duration | Duration in seconds (timer-based exercise) |
| includeRestPeriod | boolean | Yes | Insert a rest screen **before** this exercise |
| restDuration | number | Yes | Rest length in seconds (a rest is only inserted when it is above 0) |
| stage | "warmup", "exercise" or "cooldown" | No | Colors the rest-screen progress bar by workout stage |

**Custom Workout Flow:**
1. Launch with the exercise list (`customWorkoutExercises`). The loading screen posts `commit_screen_shown` when it appears.
2. Wait for `all_resources_loaded` (`error_occurred` is posted if the sequence is invalid or a download fails).
3. With `showCommitScreen: true`, also wait for `workout_committed` (the user tapped "I'm committed").
4. Send `{ workout_activity_action: "start" }`. The workout does not start until you do ([Workout Activity Actions](/docs/customization-parameters/workout-activity-actions)).

**Note:** `restSpeeches` / `currentRestSpeech` are Camera component parameters ([Camera Component](/docs/customization-parameters/camera-component-params)); custom workouts play their own rest audio, and keep the rest lengths you set (plus 3 s on the first rest when KinesteX plays its greeting). To simulate the workout with a video instead of the live camera, see [Testing & Simulation](/docs/customization-parameters/testing-simulation).

**Custom Workout Parameters**

_Swift (iOS)_
```swift
@State private var workoutAction: [String: Any]? = nil

let customExercises = [
    WorkoutSequenceExercise(
        exerciseId: "exercise-id-1",
        reps: 15,
        includeRestPeriod: true,
        restDuration: 20
    )
]

kinestex.createCustomWorkoutView(
    exercises: customExercises,
    user: nil,
    style: nil,
    isLoading: $isLoading,
    workoutAction: $workoutAction,
    customParams: [
        "isAssessment": false, // true: end on assessment results
        "shouldSendStats": true // optional: save the session on completion
    ],
    onMessageReceived: { message in
        // all_resources_loaded arrives as .custom_type: then start the workout
        // workoutAction = ["workout_activity_action": "start"]
    }
)
```

_Kotlin (Android)_
```kotlin
val customExercises = listOf(
    WorkoutSequenceExercise(
        exerciseId = "exercise-id-1",
        reps = 15,
        duration = null,
        includeRestPeriod = true,
        restDuration = 20
    )
)

KinesteXSDK.createCustomWorkoutView(
    context = this,
    customWorkouts = customExercises,
    customParams = mutableMapOf(
        "isAssessment" to false, // true: end on assessment results
        "shouldSendStats" to true // optional: save the session on completion
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message ->
        if (message is WebViewMessage.AllResourcesLoaded) {
            KinesteXSDK.sendMessage(mapOf("workout_activity_action" to "start"))
        }
    },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customWorkoutExercises: [
    {
      exerciseId: 'exercise-id-1',
      reps: 15,
      duration: null,
      includeRestPeriod: true,
      restDuration: 20,
    },
  ],
  customParameters: {
    isAssessment: false, // true: end on assessment results
    shouldSendStats: true, // optional: save the session on completion
  },
};

// integrationOption={IntegrationOption.CUSTOM_WORKOUT}
// handleMessage: on 'all_resources_loaded' call
// kinestexSDKRef.current?.sendAction('workout_activity_action', 'start');
```

_Flutter_
```dart
final customExercises = [
  WorkoutSequenceExercise(
    exerciseId: "exercise-id-1",
    reps: 15,
    duration: null,
    includeRestPeriod: true,
    restDuration: 20,
  ),
];

KinesteXAIFramework.createCustomWorkoutView(
  customWorkouts: customExercises,
  customParams: {
    "isAssessment": false, // true: end on assessment results
    "shouldSendStats": true, // optional: save the session on completion
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: (message) {
    if (message.data['type'] == 'all_resources_loaded') {
      KinesteXAIFramework.sendAction("workout_activity_action", "start");
    }
  },
);
```

_HTML / JavaScript_
```html
// iframe src: https://ai.kinestex.com/custom-workout
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  customWorkoutExercises: [
    {
      exerciseId: "exercise-id-1",
      reps: 15,
      duration: null,
      includeRestPeriod: true,
      restDuration: 20,
    },
  ],
  isAssessment: false, // true: end on assessment results
  shouldSendStats: true, // optional: save the session on completion
};

// When all_resources_loaded arrives:
iframe.contentWindow.postMessage({ workout_activity_action: "start" }, "https://ai.kinestex.com");
```

_React (TypeScript)_
```tsx
const customWorkoutExercises: WorkoutSequenceExercise[] = [
  {
    exerciseId: 'exercise-id-1',
    reps: 15,
    duration: null,
    includeRestPeriod: true,
    restDuration: 20,
  },
];

const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customWorkoutExercises,
  customParameters: {
    isAssessment: false, // true: end on assessment results
    shouldSendStats: true, // optional: save the session on completion
  },
};

// integrationOption={IntegrationOption.CUSTOM_WORKOUT}
// handleMessage: on 'all_resources_loaded' call
// ref.current?.sendAction('workout_activity_action', 'start');
```

## Workout Activity Actions

Control a running session by posting `{ workout_activity_action: "<value>" }` to the KinesteX view, after `kinestex_launched`. Echo replies have the shape `{ type: "<value>", date }`. Errors arrive as `error_occurred` ([Error & Status Events](/docs/data-points/error-status-events)).

| Value | Extra keys | Works in | What it does | Reply |
|-------|------------|----------|--------------|-------|
| start | none | Custom Workout | Starts the workout built from `customWorkoutExercises`. Send it after `all_resources_loaded` (and after `workout_committed` with `showCommitScreen`). Ignored elsewhere | The workout's own events (`workout_started`, ...) |
| pause_workout | none | Workout player, Challenge, Gym Log | Pauses the exercise (video, timer and tracking). Sent before the exercise screen opens, it applies when it opens | `pause_workout` echo, only when the state changes |
| resume_workout | none | Workout player, Challenge, Gym Log | Resumes a paused exercise | `resume_workout` echo, only when the state changes |
| mute_workout | none | Workout player, Challenge, Gym Log, Camera | Mutes all sound (speech, sound effects, music) for this session; not saved | `mute_workout` echo |
| unmute_workout | none | Workout player, Challenge, Gym Log, Camera | Unmutes. The workout player also turns coach speech back on; in the Camera component a `"Pause Audio"` stays in place | `unmute_workout` echo |
| mute_speech | none | Workout player, Challenge, Gym Log | Mutes spoken feedback only; sound effects still play | `mute_speech` echo |
| unmute_speech | none | Workout player, Challenge, Gym Log | Turns spoken feedback back on | `unmute_speech` echo |
| log | none | Workout player, Challenge, Gym Log | Asks for the latest progress now | `workout_progress`, or `error_occurred` (warning, `"log: no active workout"`) when no workout is loaded, e.g. in the Camera component. See [Workout Events](/docs/data-points/workout-events) |
| load_models | `exercises: string[]`, optional `exerciseFetchType` | Camera | Fetches and caches more exercise models without reloading; the ids that load can then become `currentExercise` | `models_loaded` (`modelIds`), `error_occurred` (critical) for ids that fail, then `speech_fetch_complete`; `error_occurred` (warning, `"load_models: no exercises provided"`) for an empty list |
| get_exercise_setup | `exercises: string[]` | Camera | Describes how to set up each exercise (start position, camera view and side) from the models already loaded, with no network request. [Guide](/docs/integration/camera-component#camera-component-exercise-setup) | One `exercise_setup` per id (ids still loading are answered when they finish); `error_occurred` (warning) for ids never sent in `exercises` or `load_models`, or for an empty list |
| pause_camera | none | Camera | Turns the camera off; models, settings and progress stay. Sent before the camera opens, it keeps it off. [Guide](/docs/integration/camera-component#camera-component-camera-audio) | `pause_camera` echo. Other integrations: `error_occurred` (warning, `"pause_camera: only supported in the camera component"`) |
| resume_camera | none | Camera | Turns the camera back on | `resume_camera` echo, then `camera_selected` when the camera opens. Other integrations: `error_occurred` (warning) |
| reset_progress | none | Camera (open) | Restarts the current exercise from rep 1 (reps, accuracy, mistakes, time) | `reset_progress` with `exerciseId`; `error_occurred` (warning) when no exercise is set or the camera is not open |
| reset_all_progress | none | Camera (open) | Clears every exercise tracked this session and restarts the current one | `reset_all_progress`; `error_occurred` (warning) when the camera is not open |
| reset_check_frame | none | Camera (open) | Shows the positioning check again (also with `showSilhouette: false`); the rep in progress restarts | `reset_check_frame`, then `person_in_frame` when the user is in position; `error_occurred` (warning) when the camera is not open |

**Scope note:** the Camera component does not use `pause_workout`, `resume_workout`, `mute_speech` or `unmute_speech`: use `pause_camera` / `resume_camera` and the `currentExercise` commands below. Games and assessments react to none of these actions. For camera sound and camera-off control, see [Camera Component: camera and audio](/docs/integration/camera-component#camera-component-camera-audio).

**Other messages you can send:**

| Message | Works in | What it does | Reply |
|---------|----------|--------------|-------|
| `{ currentExercise: "<id>" }` | Camera | Switches tracking to that exercise, which must be in `exercises` or loaded with `load_models`. Sending the active value again does nothing | `exercise_change` (summary of the previous exercise) and `exercise_setup`; `error_occurred` (critical, `"currentExercise is not included in exercises list"`) for an unknown id |
| `{ currentExercise: "Pause Exercise" }` | Camera | Stops tracking; the camera stays on | none |
| `{ currentExercise: "Stop Camera" }` | Camera | Stops the camera and pose tracking. Send an exercise id to start again | `stop_camera` |
| `{ currentExercise: "Pause Audio" }` / `"Resume Audio"` | Camera | Turns coach cues and rest speech off or on (the rep sound still plays) | none |
| `{ currentExercise: "Workout Overview" }` | Camera | Sends the session summary so far. Reps on the current exercise keep counting (`successful_repeat` / `action` kind `rep`); presence, hold, form-state and idle events stop until you send an exercise id | `exercise_overview`, `workout_overview` |
| `{ currentRestSpeech: "<phrase>" }` | Camera (with `restSpeeches`) | Plays that downloaded rest speech; `"Stop audio"` stops the current sound. The same phrase twice in a row plays once | none |
| `{ type: "update_trainer_profile", ... }` | AI Trainer | Updates the trainer profile from your own UI. Fields: `age`, `weight`, `height` (JSON numbers), `gender` (`male`, `female`, `other`), `date_of_birth`, `fitness_goals`, `injuries`, `health_conditions`, `fitness_level_pushups`, `fitness_level_squats`, `fitness_level_cardio`, `other_preferences` (values as in [AI Trainer parameters](/docs/customization-parameters/ai-trainer-params)). Partial updates merge; held until the trainer screen is open | `trainer_profile_updated` (`source: "host"`) after a save; `error_occurred` (critical) if the save fails; nothing when nothing changed |
| `{ subscription_result: "purchased" }` or `"dismissed"` | AI Trainer | Your answer to `open_subscription_flow`. `purchased` unlocks the user and resumes the generation that was waiting; `dismissed` drops it | The trainer continues |

**How each SDK sends these:**

| SDK | Commands | Camera exercise switch | Multi-key messages (`load_models`, `get_exercise_setup`, `update_trainer_profile`) |
|-----|----------|------------------------|------------------------------------------|
| Swift | `webViewState.sendMessage([...])`, with a `WebViewState` passed as `webViewState:` to the create call. Custom workouts can also set the `workoutAction` binding | The `currentExercise` binding of `createCameraView` (and its `currentRestSpeech` binding) | Yes |
| Kotlin | `KinesteXSDK.sendMessage(mapOf(...))` | `KinesteXSDK.updateCurrentExercise(id)` | Yes |
| Flutter | `KinesteXAIFramework.sendAction(action, value)` | `sendAction("currentExercise", id)` | **No**: `sendAction` sends a single key |
| React Native | `ref.current?.sendAction(action, value, extras?)` | `ref.current?.changeExercise(id)` or `sendAction("currentExercise", id)` | Yes, through `extras` |
| React | `ref.current?.sendAction(action, value)` | `ref.current?.changeExercise(id)` | **No**: `sendAction` sends a single key |
| HTML/JS | `iframe.contentWindow.postMessage({...}, "https://ai.kinestex.com")` | `postMessage({ currentExercise: id }, ...)` | Yes |

**Workout Activity Actions**

_Swift (iOS)_
```swift
// Pass a WebViewState to the create call, then post commands through it:
// @StateObject private var webViewState = WebViewState()
// kinestex.createWorkoutView(..., onMessageReceived: { ... }, webViewState: webViewState)

// Workout player
webViewState.sendMessage(["workout_activity_action": "pause_workout"])
webViewState.sendMessage(["workout_activity_action": "resume_workout"])
webViewState.sendMessage(["workout_activity_action": "mute_speech"])
webViewState.sendMessage(["workout_activity_action": "log"]) // replies with workout_progress

// Camera component
webViewState.sendMessage(["workout_activity_action": "load_models", "exercises": ["model-id-3"]])
webViewState.sendMessage(["workout_activity_action": "get_exercise_setup", "exercises": ["model-id-3"]])
webViewState.sendMessage(["workout_activity_action": "pause_camera"])
webViewState.sendMessage(["workout_activity_action": "reset_progress"])
currentExercise = "model-id-3" // the createCameraView binding posts { currentExercise }

// AI Trainer
webViewState.sendMessage(["type": "update_trainer_profile", "age": 32, "weight": 70])
webViewState.sendMessage(["subscription_result": "purchased"])
```

_Kotlin (Android)_
```kotlin
// Workout player
KinesteXSDK.sendMessage(mapOf("workout_activity_action" to "pause_workout"))
KinesteXSDK.sendMessage(mapOf("workout_activity_action" to "resume_workout"))
KinesteXSDK.sendMessage(mapOf("workout_activity_action" to "mute_speech"))
KinesteXSDK.sendMessage(mapOf("workout_activity_action" to "log")) // replies with workout_progress

// Camera component
KinesteXSDK.sendMessage(mapOf("workout_activity_action" to "load_models", "exercises" to listOf("model-id-3")))
KinesteXSDK.sendMessage(mapOf("workout_activity_action" to "get_exercise_setup", "exercises" to listOf("model-id-3")))
KinesteXSDK.sendMessage(mapOf("workout_activity_action" to "pause_camera"))
KinesteXSDK.sendMessage(mapOf("workout_activity_action" to "reset_progress"))
KinesteXSDK.updateCurrentExercise("model-id-3")
KinesteXSDK.sendMessage(mapOf("currentRestSpeech" to "Get ready for squats"))

// AI Trainer
KinesteXSDK.sendMessage(mapOf("type" to "update_trainer_profile", "age" to 32, "weight" to 70))
KinesteXSDK.sendMessage(mapOf("subscription_result" to "purchased"))
```

_React Native_
```jsx
const kinestexSDKRef = useRef<KinesteXSDKCamera>(null);
// <KinestexSDK ref={kinestexSDKRef} ... />

// Workout player
kinestexSDKRef.current?.sendAction('workout_activity_action', 'pause_workout');
kinestexSDKRef.current?.sendAction('workout_activity_action', 'resume_workout');
kinestexSDKRef.current?.sendAction('workout_activity_action', 'mute_speech');
kinestexSDKRef.current?.sendAction('workout_activity_action', 'log'); // replies with workout_progress

// Camera component
kinestexSDKRef.current?.sendAction('workout_activity_action', 'load_models', { exercises: ['model-id-3'] });
kinestexSDKRef.current?.sendAction('workout_activity_action', 'get_exercise_setup', { exercises: ['model-id-3'] });
kinestexSDKRef.current?.sendAction('workout_activity_action', 'pause_camera');
kinestexSDKRef.current?.sendAction('workout_activity_action', 'reset_progress');
kinestexSDKRef.current?.sendAction('currentExercise', 'model-id-3');
kinestexSDKRef.current?.sendAction('currentRestSpeech', 'Get ready for squats');

// AI Trainer
kinestexSDKRef.current?.sendAction('type', 'update_trainer_profile', { age: 32, weight: 70 });
kinestexSDKRef.current?.sendAction('subscription_result', 'purchased');
```

_Flutter_
```dart
// Workout player
KinesteXAIFramework.sendAction("workout_activity_action", "pause_workout");
KinesteXAIFramework.sendAction("workout_activity_action", "resume_workout");
KinesteXAIFramework.sendAction("workout_activity_action", "mute_speech");
KinesteXAIFramework.sendAction("workout_activity_action", "log"); // replies with workout_progress

// Camera component
KinesteXAIFramework.sendAction("workout_activity_action", "pause_camera");
KinesteXAIFramework.sendAction("workout_activity_action", "reset_progress");
KinesteXAIFramework.sendAction("currentExercise", "model-id-3");
KinesteXAIFramework.sendAction("currentRestSpeech", "Get ready for squats");

// AI Trainer
KinesteXAIFramework.sendAction("subscription_result", "purchased");

// sendAction sends one key only, so load_models, get_exercise_setup and
// update_trainer_profile cannot be sent from the Flutter SDK.
```

_HTML / JavaScript_
```html
const iframe = document.getElementById("kinestex-iframe");
const send = (message) => iframe.contentWindow.postMessage(message, "https://ai.kinestex.com");

// Workout player
send({ workout_activity_action: "pause_workout" });
send({ workout_activity_action: "resume_workout" });
send({ workout_activity_action: "mute_speech" });
send({ workout_activity_action: "log" }); // replies with workout_progress

// Camera component
send({ workout_activity_action: "load_models", exercises: ["model-id-3"] });
send({ workout_activity_action: "get_exercise_setup", exercises: ["model-id-3"] });
send({ workout_activity_action: "pause_camera" });
send({ workout_activity_action: "reset_progress" });
send({ currentExercise: "model-id-3" });
send({ currentRestSpeech: "Get ready for squats" });

// AI Trainer
send({ type: "update_trainer_profile", age: 32, weight: 70 });
send({ subscription_result: "purchased" });
```

_React (TypeScript)_
```tsx
import { useRef } from 'react';
import { KinesteXSDK, type KinesteXSDKCamera } from 'kinestex-sdk-react-ts';

const ref = useRef<KinesteXSDKCamera>(null);
// <KinesteXSDK ref={ref} ... />

// Workout player
ref.current?.sendAction('workout_activity_action', 'pause_workout');
ref.current?.sendAction('workout_activity_action', 'resume_workout');
ref.current?.sendAction('workout_activity_action', 'mute_speech');
ref.current?.sendAction('workout_activity_action', 'log'); // replies with workout_progress

// Camera component
ref.current?.sendAction('workout_activity_action', 'pause_camera');
ref.current?.sendAction('workout_activity_action', 'reset_progress');
ref.current?.changeExercise('model-id-3');
ref.current?.sendAction('currentRestSpeech', 'Get ready for squats');

// AI Trainer
ref.current?.sendAction('subscription_result', 'purchased');

// sendAction sends one key only, so load_models, get_exercise_setup and
// update_trainer_profile cannot be sent from kinestex-sdk-react-ts.
```

## Navigation

Control navigation and where users go when they leave. **Applies to: All integrations.**

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| instantRedirect | string | none | All | Opens the given in-app route as soon as a message carrying it arrives (even before verification finishes). A leading `/` is added if missing. There is no allowlist: an unknown route lands on the not-found screen |
| exitUrl | string | none | All (standalone and link launches) | For launches with no host app: after `exit_kinestex` is posted, the browser is sent to this URL. Accepts `http://` or `https://` URLs and app deep links (`clientapp://home`); script schemes (`javascript:`, `data:`, `vbscript:`) are rejected |

Both are applied from any message that carries them, not only the first launch.

**Navigation Control**

_Swift (iOS)_
```swift
kinestex.createWorkoutView( // same customParams on every create*View method
    workout: "Fitness Lite",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "instantRedirect": "/personalized-plan",
        "exitUrl": "clientapp://home"
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView( // same customParams on every create*View method
    context = this,
    workoutName = "Fitness Lite",
    customParams = mutableMapOf(
        "instantRedirect" to "/personalized-plan",
        "exitUrl" to "clientapp://home"
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    instantRedirect: '/personalized-plan',
    exitUrl: 'clientapp://home',
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView( // same customParams on every create*View method
  workoutName: "Fitness Lite",
  customParams: {
    "instantRedirect": "/personalized-plan",
    "exitUrl": "clientapp://home",
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  instantRedirect: "/personalized-plan",
  exitUrl: "https://yourapp.com/home",
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    instantRedirect: '/personalized-plan',
    exitUrl: 'https://yourapp.com/home',
  },
};
```

## Assessment Configuration

Parameters for the assessments (TUG, gait speed, balance tests and more). **Applies to: Assessments only.** The assessment itself is chosen with `exercise` ([Challenge Mode](/docs/customization-parameters/challenge-mode), ids in [AI Experiences](/docs/integration/experience-view)). For result data, see [Data Points](/docs/data-points).

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| tugMinRequiredSpace | number | 3.2 | TUG and Gait Speed | Required walk distance in **meters** (above 0). Drives the space check, the walk target and the reported speeds: TUG assumes 2 × the distance (out and back), Gait Speed 1 ×, so `averageSpeedMs_tug` = (2 × distance) / time and `averageGaitSpeed` = distance / time |
| isHorizontalMode | boolean | **false** | TUG and Gait Speed, mobile and tablet only | Only `true` (or `"true"`) turns it on. Runs the walking tests in landscape, widening the camera's field of view so the test fits a much smaller space. Users get "Rotate your device" prompts, so your WebView or activity must allow landscape. Ignored on desktop. Reset on every launch |

**Model accuracy note:** assessments use the same automatically picked MediaPipe model as everything else (`light` or `full` by device speed). There is **no automatic switch to the "heavy" model for balance assessments**: pass `mediapipeModel: "heavy"` if you need maximum landmark accuracy ([Camera & Pose Detection](/docs/customization-parameters/camera-pose-detection)).

**Assessment Configuration**

_Swift (iOS)_
```swift
kinestex.createExperienceView(
    experience: "assessment",
    exercise: "tug",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "tugMinRequiredSpace": 3,
        "isHorizontalMode": true
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createExperiencesView(
    context = this,
    experienceName = "assessment",
    customParams = mutableMapOf(
        "exercise" to "tug",
        "tugMinRequiredSpace" to 3,
        "isHorizontalMode" to true
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
// integrationOption={IntegrationOption.EXPERIENCE} experience="assessment"
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercise: 'tug',
  customParameters: {
    tugMinRequiredSpace: 3,
    isHorizontalMode: true,
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createExperienceView(
  experience: "assessment",
  customParams: {
    "exercise": "tug",
    "tugMinRequiredSpace": 3,
    "isHorizontalMode": true,
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
// iframe src: https://ai.kinestex.com/experiences/assessment
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  exercise: "tug",
  tugMinRequiredSpace: 3,
  isHorizontalMode: true,
};
```

_React (TypeScript)_
```tsx
// integrationOption={IntegrationOption.EXPERIENCE} experience="assessment"
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  exercise: 'tug',
  customParameters: {
    tugMinRequiredSpace: 3,
    isHorizontalMode: true,
  },
};
```

## Audio Configuration

Control which spoken coaching cues play. **Applies to: all views with spoken audio feedback.**

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| includePhrases | string[] | all categories | All | Allow-list of spoken coaching-cue categories to download and play. The core `static` cues (essential instructions) are ALWAYS included. Omit the parameter for all categories; pass a list to enable exactly those (e.g. `["greeting", "farewell"]` re-enables greeting and farewell cues where KinesteX silenced them for your company). An empty array `[]` means static cues only. In the URL: a JSON array |

**Valid `includePhrases` categories:** `"motivational"`, `"praisal"`, `"greeting"`, `"farewell"`, `"closing_exercise"`, `"auto_skip"`. Unknown values are dropped.

**Voice selection** (`voiceActor`) and **language** are under [Language & Localization](/docs/customization-parameters/language-localization). Muting at runtime (`mute_workout`, `mute_speech`) is under [Workout Activity Actions](/docs/customization-parameters/workout-activity-actions).

**Audio Configuration**

_Swift (iOS)_
```swift
kinestex.createWorkoutView( // same customParams on every create*View method
    workout: "Fitness Lite",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "includePhrases": ["greeting", "farewell", "motivational"]
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView( // same customParams on every create*View method
    context = this,
    workoutName = "Fitness Lite",
    customParams = mutableMapOf(
        "includePhrases" to listOf("greeting", "farewell", "motivational")
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    includePhrases: ['greeting', 'farewell', 'motivational'],
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView( // same customParams on every create*View method
  workoutName: "Fitness Lite",
  customParams: {
    "includePhrases": ["greeting", "farewell", "motivational"],
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  includePhrases: ["greeting", "farewell", "motivational"],
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    includePhrases: ['greeting', 'farewell', 'motivational'],
  },
};
```

## Session & Data Saving

Control session saving and data upload. **Applies to: any flow ending on the results screen** (Workout player and Challenge).

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| shouldSendStats | boolean | false (true for AI Trainer) | Workout player, Challenge | Saves the completed session to the KinesteX backend: per-exercise stats, accuracy scores, calories and the motion recording (used for session replay). Saved sessions are available in the [Workout Sessions API](/docs/trainer-api/trainer-api-workout-sessions). For AI Trainer launches the default is `true` so the chat can show the completed-workout card. Send a boolean by postMessage or inside `?data=` |

**Messages posted to the host during saving:**
- `workout_session_saved`: the session was stored (includes the session ID and scores)
- `motion_upload_progress`: motion-recording upload progress
- `session_save_complete`: everything (session and motion data) finished uploading
- `motion_upload_error`: the motion upload failed or timed out

**Offline behavior:** if saving fails (e.g. no connectivity), the result is queued on the device and retried when the connection returns or on the next launch. A successful retry sends `workout_session_saved` (and `plan_progression_saved` for plan workouts) only, without the motion-upload messages.

**Note:** independent of this flag, the results screen always posts the `workout_overview` / `exercise_overview` summaries to the host. `shouldSendStats` only controls **backend persistence**. With `motionDataEnabled: false`, the saved session has no replay data.

**Session Saving Configuration**

_Swift (iOS)_
```swift
kinestex.createWorkoutView(
    workout: "Full Body Burn",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "shouldSendStats": true
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView(
    context = this,
    workoutName = "Full Body Burn",
    customParams = mutableMapOf(
        "shouldSendStats" to true
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    shouldSendStats: true,
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView(
  workoutName: "Full Body Burn",
  customParams: {
    "shouldSendStats": true,
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  shouldSendStats: true,
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    shouldSendStats: true,
  },
};
```

## Plan Context

Pass plan progression context so the SDK associates a directly launched workout with the correct plan. **Applies to: Workout view** (a workout launched directly that should count toward a plan). After the workout finishes, the SDK posts `plan_progression_saved` (or `plan_progression_failed` on error). See [Plans & Programs events](/docs/data-points/plans-programs).

| Parameter | Type | Applies to | What it does internally |
|-----------|------|------------|-------------------------|
| planId | string | Workout view | The ID of the plan the workout belongs to, used on the results screen to resolve the plan and record progression against it. A `?planId=` on the `/workout/{id}` URL wins over the launch value |
| planType | string | Workout view | `"personalized"` or `"goal-based"`. Selects which progression pipeline records the completion (and the matching results screen) |
| progressWorkoutId | string | Workout view | The plan-day workout ID used to record progression when the route does not carry a workout ID |

**When to use:** only when you launch a workout **directly** through the SDK (not through the in-app plan UI) and want it to count toward plan progression. The in-app plan flow handles this itself.

**Progression is only recorded for a meaningful session:** personalized-plan progression requires a minimum efficiency score, and goal-based progression requires some completed work (several reps or about 10s of hold time). A workout abandoned at once does not advance the plan.

**Note:** a workout launched without these fields is a standalone session and does not update plan progression.

**Plan Context Configuration**

_Swift (iOS)_
```swift
kinestex.createWorkoutView(
    workout: "Day 3 Workout",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "planId": "plan_abc123",
        "planType": "personalized",
        "progressWorkoutId": "plan_day_3"
    ],
    onMessageReceived: { message in /* ... */ }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createWorkoutView(
    context = this,
    workoutName = "Day 3 Workout",
    customParams = mutableMapOf(
        "planId" to "plan_abc123",
        "planType" to "personalized",
        "progressWorkoutId" to "plan_day_3"
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    planId: 'plan_abc123',
    planType: 'personalized',
    progressWorkoutId: 'plan_day_3',
  },
};
```

_Flutter_
```dart
KinesteXAIFramework.createWorkoutView(
  workoutName: "Day 3 Workout",
  customParams: {
    "planId": "plan_abc123",
    "planType": "personalized",
    "progressWorkoutId": "plan_day_3",
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  planId: "plan_abc123",
  planType: "personalized",
  progressWorkoutId: "plan_day_3",
};
```

_React (TypeScript)_
```tsx
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    planId: 'plan_abc123',
    planType: 'personalized',
    progressWorkoutId: 'plan_day_3',
  },
};
```

## Plan Onboarding Prefill

Pre-fill or skip onboarding survey questions for personalized plans. All fields are optional: only the provided fields are prefilled and their screens skipped. If every answer is provided for a goal-based plan, the user goes straight to the results. **Applies to: Plan Onboarding only** (route `"plan-onboarding"`).

**Availability:** use `createCustomComponentView` with `route: "plan-onboarding"` (Swift, Kotlin, Flutter), or load `https://ai.kinestex.com/plan-onboarding` in the iframe (HTML/JS). The React Native and React SDKs have no integration option for this route.

| Parameter | Type | Accepted values | Description |
|-----------|------|-----------------|-------------|
| route | string | `"plan-onboarding"` | Must be `"plan-onboarding"` for this feature to work |
| planOnboardingPrefill | object | see the fields below | Object with the prefill values for the survey |
| planOnboardingPrefill.goal | string | `"automatic"`, `"lose_weight"`, `"build_muscle"`, `"get_stronger"`, `"stay_active"` | The fitness goal. `"automatic"` runs the assessment-based personalized path (adds the Duration and Assessment steps); the other goals map to fixed goal-based plans and skip the Duration step |
| planOnboardingPrefill.healthIssues | string[] | `"None"`, `"High Blood Pressure"`, `"Diabetes"`, `"High Cholesterol"`, `"Insomnia"`, `"Depression"` | Pre-selects health issues. The screen is skipped when the array is not empty and `goal` is prefilled too; otherwise it is shown pre-selected. Pass `["None"]` for "no health issues" |
| planOnboardingPrefill.injuries | string[] | `"None"`, `"Shoulder"`, `"Wrist"`, `"Knee"`, `"Hip"`, `"Ankle"`, `"Lower back"` | Pre-selects injuries. The screen is skipped when the array is not empty and `goal` and `healthIssues` are prefilled too; otherwise it is shown pre-selected. Pass `["None"]` for "no injuries". An empty array `[]` counts as unanswered, so the screen is shown |
| planOnboardingPrefill.duration | number | `15`, `30`, `60`, `90` | Preferred workout duration in minutes. Only used on the `"automatic"` goal path |
| planOnboardingPrefill.lifestyle | string | `"Sedentary"`, `"Lightly active"`, `"Moderately active"`, `"Very active"` | Activity level (capitalized with spaces: this screen's vocabulary differs from the top-level `lifestyle` parameter) |
| planOnboardingPrefill.assessmentOnly | boolean | `true` / `false` | When `true`, every survey screen (goal, health issues, injuries, duration, lifestyle) is skipped and the user lands on the fitness assessment. A previously stored plan ID is cleared, so a fresh personalized plan is generated after the assessment. All other prefill fields are ignored when this is set |

**Gotcha:** answers the user already gave in an in-progress onboarding session cached on the device take precedence over prefill values, field by field.

**`assessmentOnly` use case:** **reassessment flows**, when the user already has a profile (goal, lifestyle, ...) in your app and you only want a fresh fitness assessment to regenerate the personalized plan. Do not combine it with the other prefill fields; they are ignored.

**`remind_me_later_clicked` event:** when the user taps "Remind me later" on the Assessment screen of the plan-onboarding flow, the SDK posts `remind_me_later_clicked` so your app can dismiss the SDK and schedule a follow-up. It is only sent from the plan-onboarding page.

**Plan Onboarding Prefill Configuration**

_Swift (iOS)_
```swift
kinestex.createCustomComponentView(
    route: "plan-onboarding",
    user: nil,
    style: nil,
    isLoading: $isLoading,
    customParams: [
        "planOnboardingPrefill": [
            "goal": "lose_weight",
            "healthIssues": ["High Blood Pressure"],
            "injuries": ["None"],
            "duration": 30,
            "lifestyle": "Sedentary"
        ] as [String: Any]
    ],
    onMessageReceived: { message in /* ... */ }
)

// Reassessment-only flow (skips the whole survey):
// customParams: ["planOnboardingPrefill": ["assessmentOnly": true]]
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.createCustomComponentView(
    context = this,
    route = "plan-onboarding",
    customParams = mutableMapOf(
        "planOnboardingPrefill" to mapOf(
            "goal" to "lose_weight",
            "healthIssues" to listOf("High Blood Pressure"),
            "injuries" to listOf("None"),
            "duration" to 30,
            "lifestyle" to "Sedentary"
        )
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_Flutter_
```dart
KinesteXAIFramework.createCustomComponentView(
  route: "plan-onboarding",
  customParams: {
    "planOnboardingPrefill": {
      "goal": "lose_weight",
      "healthIssues": ["High Blood Pressure"],
      "injuries": ["None"],
      "duration": 30,
      "lifestyle": "Sedentary",
    },
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
const srcURL = "https://ai.kinestex.com/plan-onboarding";

const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  planOnboardingPrefill: {
    goal: "lose_weight",
    healthIssues: ["High Blood Pressure"],
    injuries: ["None"],
    duration: 30,
    lifestyle: "Sedentary",
  },
};

// Reassessment-only flow (skips the whole survey)
const reassessmentPostData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  planOnboardingPrefill: {
    assessmentOnly: true,
  },
};
```

## AI Trainer Chat Parameters

Parameters for the [AI Trainer Chat](/docs/ai-trainer-chat) view. **Applies to: AI Trainer only**: every other integration option ignores them.

| Parameter | Type | Default | Applies to | What it does internally |
|-----------|------|---------|------------|-------------------------|
| isSubscribed | boolean | true | AI Trainer | Missing or `true` = subscribed. Only `false` (or the text `"false"` for URL launches) gates workout generation and triggers the `open_subscription_flow` event; see the [subscription gating guide](/docs/guides/guide-subscription-gating). **On session launches the backend's subscription status overrides this flag**: the server is the source of truth and also gates generation itself |
| subscriptionReturnUrl | string | none | AI Trainer | For link and standalone launches with no host app: non-subscribed users are sent here at the generation step instead of receiving `open_subscription_flow`. Accepts `http://` or `https://` URLs and app deep links; script schemes are rejected |
| aiTrainerName | string | none | AI Trainer | Renames the AI trainer in the label above each reply. Shown as-is in every language. Also the chat title when `showAiTrainerNameInHeader` is `true` |
| showAiTrainerNameInHeader | boolean | false | AI Trainer | Shows `aiTrainerName` as the chat's title at the top of the screen (the chat has no title otherwise). Accepts `true` or `"true"` |
| aiTrainerColor | string | the theme's brand color | AI Trainer | Recolors the trainer's star icon: any CSS color, e.g. `"#7C3AED"` |
| aiTrainerGreeting | string | none | AI Trainer | Your own opening line, typed by the trainer at most once per launch (skipped while another prompt is on screen). Display only, not sent to the AI |
| aiTrainerOnboardingGreeting | string | none | AI Trainer | Opening line when a user with no chat history starts onboarding. Falls back to `aiTrainerGreeting` |
| aiTrainerOnboardingCompleteMessage | string | none | AI Trainer | Line typed once when onboarding ends and the first plan starts generating |
| customProfileAction | boolean | false | AI Trainer | The "Profile and more settings" row of the header settings menu sends `trainer_profile_clicked` (with the current profile) instead of opening the KinesteX profile screen. Use it to open your own profile UI |
| customCalendarAction | boolean | false | AI Trainer | The calendar button in the header sends `trainer_calendar_clicked` instead of opening the My Progress screen |
| hideCalendarButton | boolean | false | AI Trainer | Hides the calendar button in the header |
| hideProfileButton | boolean | false | AI Trainer | Hides the settings button in the header, which also removes its quick settings (music, AI motion tracking, pose model) and the "Profile and more settings" row. Takes priority over `customProfileAction` |
| captureDateOfBirth | boolean | false | AI Trainer | The profile step asks for a full date of birth instead of a birth year. KinesteX stores only the age; the date is sent back to you as `date_of_birth` in the profile events |
| date_of_birth | string | none | AI Trainer | `"YYYY-MM-DD"`. Prefills the date of birth. Ignored unless it gives an age between 3 and 120 |

**Runtime messages:** after your app handles `open_subscription_flow`, post `{ subscription_result: "purchased" }` (resumes the waiting generation) or `{ subscription_result: "dismissed" }`. To update the profile from your own UI later, post `{ type: "update_trainer_profile", ... }`. Both are in [Workout Activity Actions](/docs/customization-parameters/workout-activity-actions).

**Fitness-profile prefill fields** (same names as in the `trainer_profile_updated` event, so you can round-trip the schema; invalid values are dropped, never an error):

| Field | Accepted values |
|-------|-----------------|
| fitness_goals | string[] from: `weight_loss`, `muscle_gain`, `strength`, `general_fitness`, `wellness_flexibility`, `cardio_endurance`. `weight_loss` is not offered to users with an underweight BMI (under 18.5) and is dropped when they save their goals |
| injuries | Array of `{ body_part, preference, severity }`. `body_part`: Neck, Shoulders, Chest, Arms, Forearms, Abdomen, Knees, Hips, Ankles, Upper Back, Lower Back, Glutes, Hamstrings, Calves, Heels (any letter case, underscores or spaces). `preference`: `avoid` (default) or `include`. `severity` (optional): `light`, `moderate`, `severe`. Empty array = explicitly "no injuries" |
| health_conditions | string[]. Standard values: Diabetes, Hypertension, Asthma, Osteoporosis, Other. Other strings are kept as free-text "Other" details |
| fitness_level_pushups | `"0-5"`, `"6-15"`, `"16+"` (or the full sentence the profile events carry) |
| fitness_level_squats | `"0-10"`, `"11-21"`, `"22+"` (or the full sentence the profile events carry) |
| fitness_level_cardio | One of the cardio self-assessment sentences shown in the trainer wizard (an unrecognized value makes the wizard ask again) |
| other_preferences | Free text |

See [Pre-filling user data](/docs/ai-trainer-chat#prefill) for the full guide. Prefill seeds the wizard's answers: the questions are still shown, pre-answered. `age`, `height`, `weight` and `gender` also prefill the trainer, but only when explicitly provided at launch; `body_parts` prefills the target areas ([User Profile](/docs/customization-parameters/user-profile)).

## URL Parameters

Almost every parameter can also be passed in the launch URL, which is useful for standalone links and web embeds. A URL-only launch needs no postMessage at all: the app verifies from the URL parameters on its own. **Applies to: All integrations.**

**Two URL modes:**

1. **Single encoded payload:** `?data=<URL-safe base64 of a JSON object>`. When it decodes, it is the **entire** URL payload: every other query parameter is ignored (except `style`, `delegate`, `debug` and `themeName`, which are also read straight from the URL). Values keep their JSON types, so send real booleans and numbers. Encode it with, for example: `btoa(JSON.stringify(params)).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "")`.
2. **Individual parameters:** `?userId=user-123&company=YOUR_COMPANY&key=YOUR_API_KEY&style=dark&showSilhouette=false`. Empty values are skipped. Known booleans accept `true`, `false`, `1` or `0` (any letter case); known numbers are parsed as numbers; a value that starts with `[` or `{` is parsed as JSON. Everything else stays text.

**Precedence:** values sent by postMessage **override** URL values (the URL acts as defaults), with these exceptions:

| URL Parameter | Equivalent Config | Example | Precedence |
|---------------|-------------------|---------|------------|
| style | style | ?style=light | **URL wins** over postMessage |
| delegate | defaultDelegate | ?delegate=GPU | **URL wins** over postMessage |
| debug | showDebugRecording | ?debug=true | Combined with the postMessage value (either turns it on) |

**Booleans read from individual URL parameters:** `isHideHeaderMain`, `isDrawingPose`, `hideFeelingDialog`, `hideOtherGender`, `hideConnectTvButton`, `legacyRestScreen`, `dynamicRestEnabled`, `includeRealtimeAccuracy`, `showSilhouette`, `showDebugRecording`, `showFormGuidance`, `streamFormGuidance`, `includePoseBorders`, `showLeaderboard`, `shouldAskCamera`, `shouldShowCameraSelector`, `showSettings`, `motionTrackingSettingOn`, `motionTrackingEnabled`, `selfModeEnabled`, `start_from_rest`, `nativeParentScroll`, `isHorizontalMode`, `customProfileAction`, `customCalendarAction`, `hideCalendarButton`, `hideProfileButton`, `showAiTrainerNameInHeader`, `captureDateOfBirth`, `includeFramingHints`, `includeFormState`, `enableGestureControl`, `frameExitPrompt`, `frameExitPause`, `isAssessment`. Also accepted as text: `pauseCamera`, `muteWorkout`, `showCommitScreen` and `boundedPoseWait` (`"true"`), and `isSubscribed` (`"false"`).

**Numbers read from individual URL parameters:** `age`, `height`, `weight`, `countdown`, `reps`, `restDuration`, `minPoseDetectionConfidence`, `minTrackingConfidence`, `minPosePresenceConfidence`, `tugMinRequiredSpace`, `inactivityTimeout`.

**Every other boolean or number** (for example `shouldSendStats`, `disableCookies`, `disableGuide`, `autoSubmitLeaderboard`, `hideCompletionOverlay`, `hideStatisticsHeader`, `preventGestureControl`, `immediateShowSkip`, `shouldShowOpenCameraSettings`, `motionDataEnabled`, `gameTotalRounds`): send it by postMessage or inside `?data=`.

**Lists and objects** (`exercises`, `restSpeeches`, `includePhrases`, `customWorkoutExercises`, `challenges_home`, `checkFrameText`, `planOnboardingPrefill`, `completed_exercises`, `fitness_goals`, `injuries`, `health_conditions`, `body_parts`): as individual URL parameters they must be URL-encoded JSON, e.g. `?exercises=%5B%22model-id-1%22%5D` for `["model-id-1"]`. **`includePoseData`** also accepts a comma list: `?includePoseData=poseLandmarks,events`.

**Reloads:** the launch query is kept for the browser tab, so a reload that drops it still launches with the same parameters.

**Leaving a URL-only launch:** with no host app to close the view, use `exitUrl` ([Navigation](/docs/customization-parameters/navigation-params)) and, for the AI Trainer, `subscriptionReturnUrl` ([AI Trainer parameters](/docs/customization-parameters/ai-trainer-params)).

## Complete Example

A workout launch that combines several parameter categories:

**Complete Configuration Example**

_Swift (iOS)_
```swift
let kinestex = KinesteXAIKit(
    apiKey: "YOUR_API_KEY",
    companyName: "MyFitnessApp",
    userId: "user_12345"
)

let user = UserDetails(
    age: 28,
    height: 165,
    weight: 60,
    gender: .Female,
    lifestyle: .Active
)

// Theme and loading screen via IStyle
let customStyle = IStyle(
    style: "dark",
    loadingStickmanColor: "#00FF88",
    loadingBackgroundColor: "#1A1A2E",
    loadingTextColor: "#FFFFFF"
)

kinestex.createWorkoutView(
    workout: "Fitness Lite",
    user: user,
    style: customStyle,
    isLoading: $isLoading,
    customParams: [
        // Language
        "language": "es",
        // UI Controls
        "disableGuide": true,
        "hideFeelingDialog": true,
        // Camera
        "landmarkColor": "#00FF88",
        "shouldShowCameraSelector": true,
        // Real-time motion events in the workout
        "includePoseData": ["events"],
        "includeFormState": true,
        // Save the session
        "shouldSendStats": true
    ],
    onMessageReceived: { message in
        // Handle messages
    }
)
```

_Kotlin (Android)_
```kotlin
KinesteXSDK.initialize(
    context = this,
    apiKey = "YOUR_API_KEY",
    companyName = "MyFitnessApp",
    userId = "user_12345"
)

val userDetails = UserDetails(
    age = 28,
    height = 165,
    weight = 60,
    gender = Gender.FEMALE,
    lifestyle = Lifestyle.ACTIVE
)

KinesteXSDK.createWorkoutView(
    context = this,
    workoutName = "Fitness Lite",
    user = userDetails,
    // Theme and loading screen via IStyle (hex without #)
    style = IStyle(
        style = "dark",
        loadingStickmanColor = "00FF88",
        loadingBackgroundColor = "1A1A2E",
        loadingTextColor = "FFFFFF"
    ),
    customParams = mutableMapOf(
        // Language
        "language" to "es",
        // UI Controls
        "disableGuide" to true,
        "hideFeelingDialog" to true,
        // Camera
        "landmarkColor" to "#00FF88",
        "shouldShowCameraSelector" to true,
        // Real-time motion events in the workout
        "includePoseData" to listOf("events"),
        "includeFormState" to true,
        // Save the session
        "shouldSendStats" to true
    ),
    isLoading = viewModel.isLoading,
    onMessageReceived = { message -> handleWebViewMessage(message) },
    permissionHandler = this
)
```

_React Native_
```jsx
// <KinestexSDK data={postData} integrationOption={IntegrationOption.WORKOUT} workout="Fitness Lite" handleMessage={...} />
const postData: IPostData = {
  // Required
  key: 'YOUR_API_KEY',
  userId: 'user_12345',
  company: 'MyFitnessApp',

  // User profile
  age: 28,
  height: 165,
  weight: 60,
  gender: 'female',

  // Theme and loading screen
  style: {
    style: 'dark',
    loadingStickmanColor: '00FF88',
    loadingBackgroundColor: '1A1A2E',
    loadingTextColor: 'FFFFFF',
  },

  customParameters: {
    lifestyle: 'active',
    // Language
    language: 'es',
    // UI Controls
    disableGuide: true,
    hideFeelingDialog: true,
    // Camera
    landmarkColor: '#00FF88',
    shouldShowCameraSelector: true,
    // Real-time motion events in the workout
    includePoseData: ['events'],
    includeFormState: true,
    // Save the session
    shouldSendStats: true,
  },
};
```

_Flutter_
```dart
await KinesteXAIFramework.initialize(
  apiKey: "YOUR_API_KEY",
  companyName: "MyFitnessApp",
  userId: "user_12345",
);

final userDetails = UserDetails(
  age: 28,
  height: 165,
  weight: 60,
  gender: Gender.Female,
  lifestyle: Lifestyle.Active,
);

KinesteXAIFramework.createWorkoutView(
  workoutName: "Fitness Lite",
  user: userDetails,
  // Theme and loading screen via IStyle (hex without #)
  style: IStyle(
    style: 'dark',
    loadingStickmanColor: '00FF88',
    loadingBackgroundColor: '1A1A2E',
    loadingTextColor: 'FFFFFF',
  ),
  customParams: {
    // Language
    "language": "es",
    // UI Controls
    "disableGuide": true,
    "hideFeelingDialog": true,
    // Camera
    "landmarkColor": "#00FF88",
    "shouldShowCameraSelector": true,
    // Real-time motion events in the workout
    "includePoseData": ["events"],
    "includeFormState": true,
    // Save the session
    "shouldSendStats": true,
  },
  isShowKinestex: showKinesteX,
  isLoading: isLoading,
  onMessageReceived: handleMessage,
);
```

_HTML / JavaScript_
```html
// <iframe id="kinestex-iframe" src="https://ai.kinestex.com/workout/Fitness%20Lite"
//         allow="camera; autoplay; accelerometer; gyroscope; magnetometer"></iframe>
const iframe = document.getElementById("kinestex-iframe");

const postData = {
  // Required
  userId: "user_12345",
  company: "MyFitnessApp",
  key: "YOUR_API_KEY",

  // User profile
  age: 28,
  height: 165,
  weight: 60,
  gender: "female",
  lifestyle: "active",

  // Theme and loading screen
  style: "dark",
  loadingStickmanColor: "#00FF88",
  loadingBackgroundColor: "#1A1A2E",
  loadingTextColor: "#FFFFFF",

  // Language
  language: "es",

  // UI Controls
  disableGuide: true,
  hideFeelingDialog: true,

  // Camera
  landmarkColor: "#00FF88",
  shouldShowCameraSelector: true,

  // Real-time motion events in the workout
  includePoseData: ["events"],
  includeFormState: true,

  // Save the session
  shouldSendStats: true,
};

// Send the launch data when KinesteX has loaded
window.addEventListener("message", (event) => {
  if (event.origin !== "https://ai.kinestex.com") return;
  const message = JSON.parse(event.data);
  if (message.type === "kinestex_loaded") {
    iframe.contentWindow.postMessage(postData, "https://ai.kinestex.com");
  }
});
```

_React (TypeScript)_
```tsx
// <KinesteXSDK data={postData} integrationOption={IntegrationOption.WORKOUT} workout="Fitness Lite" handleMessage={...} />
const postData: IPostData = {
  // Required
  key: 'YOUR_API_KEY',
  userId: 'user_12345',
  company: 'MyFitnessApp',

  // User profile
  age: 28,
  height: 165,
  weight: 60,
  gender: 'female',

  // Theme and loading screen
  style: {
    style: 'dark',
    loadingStickmanColor: '00FF88',
    loadingBackgroundColor: '1A1A2E',
    loadingTextColor: 'FFFFFF',
  },

  customParameters: {
    lifestyle: 'active',
    // Language
    language: 'es',
    // UI Controls
    disableGuide: true,
    hideFeelingDialog: true,
    // Camera
    landmarkColor: '#00FF88',
    shouldShowCameraSelector: true,
    // Real-time motion events in the workout
    includePoseData: ['events'],
    includeFormState: true,
    // Save the session
    shouldSendStats: true,
  },
};
```

---
Source: https://www.kinestex.com/docs/customization-parameters · Index: https://www.kinestex.com/llms.txt
