API Reference
Reference of KinesteX SDK integration methods, available on all platforms (Swift, Kotlin, React Native, Flutter, HTML/JS, React TypeScript). Each method embeds a KinesteX view in your app. Open the guide for full integration steps with code for every platform. The exact name differs on some SDKs: see Entry points by SDK below.
Integration views (not sure which one? See Choose an integration):
| Method | Guide | Description |
| createTrainerChatView() | AI Trainer Chat | Recommended. Conversational AI personal trainer: onboarding, fitness assessment, a workout generated for every session, next-session scheduling |
| createWorkoutView() | Workout View | A single workout |
| createPlanView() | Plan View | A specific workout plan |
| createChallengeView() | Challenge View | Exercise challenge mode |
| createLeaderboardView() | Leaderboard View | Ready-made challenge leaderboard |
| createExperienceView() | AI Experiences | AI-powered games and clinical assessments |
| createAdminWorkoutEditor() | Admin Workout Editor | Embedded workout & exercise editor (Swift, Kotlin, Flutter) |
| createCustomWorkoutView() | Custom Workout | Custom exercise sequences you define, optionally run as a scored assessment |
| createCameraComponent() | Camera Component | Real-time motion tracking and motion events for fully custom UI |
Sunset views (no longer maintained; existing integrations keep working, do not use them for new integrations):
| Method | Guide | Use instead |
| createMainView() | Complete UX | AI Trainer Chat, which offers far more personalization |
| createPersonalizedPlanView() | Personalized Plan View | AI Trainer Chat, which replaces it with a conversational, adaptive plan |
User details (passed when you create a view, see Configuration). Swift, Kotlin and Flutter take them as a UserDetails object, which requires all five fields; React Native and React TS take age, height, weight and gender on data, and lifestyle in data.customParameters (their Lifestyle enum on data is sent as a number); HTML/JS on postData:
| Field | Type | Values KinesteX understands |
| age | number | Age in years |
| height | number | Height in cm |
| weight | number | Weight in kg |
| gender | string | "male" or "female", any letter case. The AI Trainer also accepts "other" |
| lifestyle | string | "sedentary", "lightly_active", "active", "moderately_active" or "very_active", any letter case. Stored on the user's KinesteX profile (used by the personalized plan) |
Related references:
- Customization Parameters: every parameter each view accepts
- Data Points: events the SDK sends back to your app
- Content APIs (Updated): fetch workouts, plans, and exercises over REST, with server-side filtering, pagination, and localization (one language per request, or up to three at once)
- Content API (Legacy): the older SDK-centric content endpoints, still supported
- AI Trainer API: REST access to the conversational trainer, semantic exercise search, workout-session history, and managed subscriptions
- Guides & Examples: end-to-end walkthroughs (completed-workouts list, subscription gating, chatbot on semantic search)
Entry points by SDK
Swift (KinesteXAIKit) uses instance methods, Kotlin (KinesteXSDK) and Flutter (KinesteXAIFramework) use static functions, React Native and React TS render one component with an integrationOption, and HTML/JS loads a URL in an iframe.
| Integration | Swift | Kotlin | Flutter | React Native / React TS | HTML/JS (iframe path) |
| AI Trainer Chat | createTrainerChatView | createTrainerChatView | createTrainerChatView | AI_TRAINER_CHAT | /trainer |
| Workout | createWorkoutView(workout:) | createWorkoutView(workoutName) | createWorkoutView(workoutName:) | WORKOUT + workout prop | /workout/{id or name} |
| Plan | createPlanView(plan:) | createPlanView(planName) | createPlanView(planName:) | PLAN + plan prop | /plan/{id or name} |
| Challenge | createChallengeView(exercise:duration:showLeaderboard:) | createChallengeView(exercise, countdown, ..., showLeaderboard) | createChallengeView(exercise:countdown:showLeaderboard:) | CHALLENGE + data.exercise, data.countdown | /challenge |
| Leaderboard | createLeaderboardView(exercise:username:) | createLeaderboardView(exercise, username) | createLeaderboardView(exercise:username:) | LEADERBOARD + username prop | /leaderboard |
| AI Experiences | createExperienceView(experience:exercise:duration:) | `createExperiencesView(experienceName)` (pass exercise in customParams) | createExperienceView(experience:) (pass exercise in customParams) | EXPERIENCE + experience prop, data.exercise | /experiences/{name} |
| Custom Workout | createCustomWorkoutView(exercises:workoutAction:) | createCustomWorkoutView(customWorkouts) | createCustomWorkoutView(customWorkouts:) | CUSTOM_WORKOUT + data.customWorkoutExercises | /custom-workout |
| Camera Component | `createCameraView(exercises:currentExercise:)` | createCameraComponent(exercises, currentExercise) | createCameraComponent(exercises:currentExercise:) | CAMERA + data.exercises, data.currentExercise | /camera |
| Admin Workout Editor | createAdminWorkoutEditor(organization:) | createAdminWorkoutEditor(organization) | createAdminWorkoutEditor(organization:) | not available | not available |
Any KinesteX route (e.g. session/{id}) | createCustomComponentView(route:) | createCustomComponentView(route) | createCustomComponentView(route:) | not available | any path |
| Complete UX (sunset) | `createCategoryView(planCategory:)` | createMainView(planCategory) | createMainView(planCategory:) | MAIN + data.planCategory | / + planC |
| Personalized Plan (sunset) | createPersonalizedPlanView | createPersonalizedPlanView | createPersonalizedPlanView | PERSONALIZED_PLAN | /personalized-plan |
React Native and React TS import IntegrationOption from kinestex-sdk-react-native/src/types and kinestex-sdk-react-ts respectively.
Sending commands by SDK
Runtime commands (for example { "workout_activity_action": "pause_workout" }, { "subscription_result": "purchased" } or { "type": "update_trainer_profile", ... }) are JSON objects posted into the running view. Full list: Workout activity actions.
| SDK | Single key ({ action: value }) | Any JSON object | Switch the camera exercise |
| Swift | webViewState.sendMessage([...]) (pass a WebViewState as webViewState: when you create the view) | webViewState.sendMessage([...]) | change the currentExercise binding of createCameraView |
| Kotlin | KinesteXSDK.sendMessage(mapOf(...)) (2.2.0+) | KinesteXSDK.sendMessage(mapOf(...)) | KinesteXSDK.updateCurrentExercise(...) |
| Flutter | KinesteXAIFramework.sendAction(action, value) | not supported | KinesteXAIFramework.sendAction("currentExercise", name) (create the camera widget once: rebuilding createCameraComponent, even with a new updatedExercise:, reloads the page) |
| React Native | ref.sendAction(action, value) | ref.sendAction(action, value, extras) (1.3.0+): posts { [action]: value, ...extras } | ref.changeExercise(...) |
| React TS | ref.sendAction(action, value) | not supported | ref.changeExercise(...) or ref.sendAction("currentExercise", name) |
| HTML/JS | iframe.contentWindow.postMessage({ ... }, origin) | same (post a plain object, not a JSON string) | postMessage({ currentExercise: "..." }, origin) |
Flutter and React TS can only post one key and one string value, so they cannot send commands that carry more fields: load_models and get_exercise_setup (need exercises) and update_trainer_profile.
Receiving events by SDK
Every event is a JSON object with a type (see Data Points).
| SDK | Callback | Events without a typed case |
| Swift | onMessageReceived: (KinestexMessage) -> Void, one case per common event, every case carries the full JSON as [String: Any] | .custom_type(data): read data["type"] |
| Kotlin | onMessageReceived: (WebViewMessage) -> Unit, a sealed class with data: Map<String, Any> | WebViewMessage.CustomType: read message.data["type"] |
| Flutter | onMessageReceived: Function(WebViewMessage) with data: Map<String, dynamic> | CustomType: read message.data['type'] |
| React Native / React TS | handleMessage(type: string, data: object): data is the full JSON | n/a (no typed cases) |
| HTML/JS | window.addEventListener("message", ...), check event.origin, then JSON.parse(event.data) | n/a |
The typed cases differ per SDK. Kotlin also types all_resources_loaded, workout_exit_request and workout_completion_overlay_dismissed; Flutter also types exit_leaderboard and workout_session_saved. On Swift those five arrive as .custom_type. The AI trainer events and the real-time motion events arrive as the custom type on every native SDK, except mistake, successful_repeat (Swift .reps, Kotlin and Flutter Reps), left_camera_frame and returned_camera_frame, which are typed. Handle a type in your custom-type branch when it has no typed case on your SDK.