KinesteX

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):

MethodGuideDescription
createTrainerChatView()AI Trainer ChatRecommended. Conversational AI personal trainer: onboarding, fitness assessment, a workout generated for every session, next-session scheduling
createWorkoutView()Workout ViewA single workout
createPlanView()Plan ViewA specific workout plan
createChallengeView()Challenge ViewExercise challenge mode
createLeaderboardView()Leaderboard ViewReady-made challenge leaderboard
createExperienceView()AI ExperiencesAI-powered games and clinical assessments
createAdminWorkoutEditor()Admin Workout EditorEmbedded workout & exercise editor (Swift, Kotlin, Flutter)
createCustomWorkoutView()Custom WorkoutCustom exercise sequences you define, optionally run as a scored assessment
createCameraComponent()Camera ComponentReal-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):

MethodGuideUse instead
createMainView()Complete UXAI Trainer Chat, which offers far more personalization
createPersonalizedPlanView()Personalized Plan ViewAI 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:

FieldTypeValues KinesteX understands
agenumberAge in years
heightnumberHeight in cm
weightnumberWeight in kg
genderstring"male" or "female", any letter case. The AI Trainer also accepts "other"
lifestylestring"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.


IntegrationSwiftKotlinFlutterReact Native / React TSHTML/JS (iframe path)
AI Trainer ChatcreateTrainerChatViewcreateTrainerChatViewcreateTrainerChatViewAI_TRAINER_CHAT/trainer
WorkoutcreateWorkoutView(workout:)createWorkoutView(workoutName)createWorkoutView(workoutName:)WORKOUT + workout prop/workout/{id or name}
PlancreatePlanView(plan:)createPlanView(planName)createPlanView(planName:)PLAN + plan prop/plan/{id or name}
ChallengecreateChallengeView(exercise:duration:showLeaderboard:)createChallengeView(exercise, countdown, ..., showLeaderboard)createChallengeView(exercise:countdown:showLeaderboard:)CHALLENGE + data.exercise, data.countdown/challenge
LeaderboardcreateLeaderboardView(exercise:username:)createLeaderboardView(exercise, username)createLeaderboardView(exercise:username:)LEADERBOARD + username prop/leaderboard
AI ExperiencescreateExperienceView(experience:exercise:duration:)`createExperiencesView(experienceName)` (pass exercise in customParams)createExperienceView(experience:) (pass exercise in customParams)EXPERIENCE + experience prop, data.exercise/experiences/{name}
Custom WorkoutcreateCustomWorkoutView(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 EditorcreateAdminWorkoutEditor(organization:)createAdminWorkoutEditor(organization)createAdminWorkoutEditor(organization:)not availablenot available
Any KinesteX route (e.g. session/{id})createCustomComponentView(route:)createCustomComponentView(route)createCustomComponentView(route:)not availableany path
Complete UX (sunset)`createCategoryView(planCategory:)`createMainView(planCategory)createMainView(planCategory:)MAIN + data.planCategory/ + planC
Personalized Plan (sunset)createPersonalizedPlanViewcreatePersonalizedPlanViewcreatePersonalizedPlanViewPERSONALIZED_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.


SDKSingle key ({ action: value })Any JSON objectSwitch the camera exercise
SwiftwebViewState.sendMessage([...]) (pass a WebViewState as webViewState: when you create the view)webViewState.sendMessage([...])change the currentExercise binding of createCameraView
KotlinKinesteXSDK.sendMessage(mapOf(...)) (2.2.0+)KinesteXSDK.sendMessage(mapOf(...))KinesteXSDK.updateCurrentExercise(...)
FlutterKinesteXAIFramework.sendAction(action, value)not supportedKinesteXAIFramework.sendAction("currentExercise", name) (create the camera widget once: rebuilding createCameraComponent, even with a new updatedExercise:, reloads the page)
React Nativeref.sendAction(action, value)ref.sendAction(action, value, extras) (1.3.0+): posts { [action]: value, ...extras }ref.changeExercise(...)
React TSref.sendAction(action, value)not supportedref.changeExercise(...) or ref.sendAction("currentExercise", name)
HTML/JSiframe.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).


SDKCallbackEvents without a typed case
SwiftonMessageReceived: (KinestexMessage) -> Void, one case per common event, every case carries the full JSON as [String: Any].custom_type(data): read data["type"]
KotlinonMessageReceived: (WebViewMessage) -> Unit, a sealed class with data: Map<String, Any>WebViewMessage.CustomType: read message.data["type"]
FlutteronMessageReceived: Function(WebViewMessage) with data: Map<String, dynamic>CustomType: read message.data['type']
React Native / React TShandleMessage(type: string, data: object): data is the full JSONn/a (no typed cases)
HTML/JSwindow.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.